Commit 9b5afe9f authored by davemoore's avatar davemoore Committed by Commit bot

Third attempt to land change to remove NativeViewportService and

ViewManager from mojo_shell.

Original cl was https://codereview.chromium.org/477923004/

BUG=
TBR=ben@chromium.org

Review URL: https://codereview.chromium.org/578353002

Cr-Commit-Position: refs/heads/master@{#295537}
parent 9ae8cb70
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
namespace mojo { namespace mojo {
AuraInit::AuraInit() { AuraInit::AuraInit() {
aura::Env::CreateInstance(true); aura::Env::CreateInstance(false);
context_factory_.reset(new ContextFactoryMojo); context_factory_.reset(new ContextFactoryMojo);
aura::Env::GetInstance()->set_context_factory(context_factory_.get()); aura::Env::GetInstance()->set_context_factory(context_factory_.get());
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
'mojo_geometry_lib', 'mojo_geometry_lib',
'mojo_html_viewer', 'mojo_html_viewer',
'mojo_js', 'mojo_js',
'mojo_native_viewport_service_lib', 'mojo_native_viewport_service',
'mojo_network_service', 'mojo_network_service',
'mojo_pepper_container_app', 'mojo_pepper_container_app',
'mojo_png_viewer', 'mojo_png_viewer',
...@@ -148,8 +148,6 @@ ...@@ -148,8 +148,6 @@
'../base/base.gyp:base', '../base/base.gyp:base',
'../base/base.gyp:base_static', '../base/base.gyp:base_static',
'../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations', '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
'../net/net.gyp:net',
'../url/url.gyp:url_lib',
'mojo_application_manager', 'mojo_application_manager',
'mojo_base.gyp:mojo_application_bindings', 'mojo_base.gyp:mojo_application_bindings',
'mojo_base.gyp:mojo_common_lib', 'mojo_base.gyp:mojo_common_lib',
...@@ -157,7 +155,6 @@ ...@@ -157,7 +155,6 @@
'mojo_base.gyp:mojo_system_impl', 'mojo_base.gyp:mojo_system_impl',
'mojo_base.gyp:mojo_application_chromium', 'mojo_base.gyp:mojo_application_chromium',
'mojo_external_service_bindings', 'mojo_external_service_bindings',
'mojo_native_viewport_service_lib',
'mojo_network_bindings', 'mojo_network_bindings',
'mojo_spy', 'mojo_spy',
], ],
...@@ -195,10 +192,13 @@ ...@@ -195,10 +192,13 @@
'shell/test_child_process.h', 'shell/test_child_process.h',
'shell/ui_application_loader_android.cc', 'shell/ui_application_loader_android.cc',
'shell/ui_application_loader_android.h', 'shell/ui_application_loader_android.h',
'shell/view_manager_loader.cc',
'shell/view_manager_loader.h',
], ],
'conditions': [ 'conditions': [
['component=="shared_library"', {
'dependencies': [
'../ui/gl/gl.gyp:gl',
],
}],
['OS=="linux"', { ['OS=="linux"', {
'dependencies': [ 'dependencies': [
'../build/linux/system.gyp:dbus', '../build/linux/system.gyp:dbus',
...@@ -208,25 +208,13 @@ ...@@ -208,25 +208,13 @@
['OS=="android"', { ['OS=="android"', {
'dependencies': [ 'dependencies': [
'mojo_network_service_lib', 'mojo_network_service_lib',
'mojo_native_viewport_service_lib',
], ],
'sources': [ 'sources': [
'shell/network_application_loader.cc', 'shell/network_application_loader.cc',
'shell/network_application_loader.h', 'shell/network_application_loader.h',
], ],
}], }],
['use_aura==1', {
'dependencies': [
# These are only necessary as long as we hard code use of ViewManager.
'../skia/skia.gyp:skia',
'mojo_view_manager',
'mojo_view_manager_bindings',
],
}, { # use_aura==0
'sources!': [
'shell/view_manager_loader.cc',
'shell/view_manager_loader.h',
],
}],
], ],
}, },
{ {
...@@ -234,10 +222,7 @@ ...@@ -234,10 +222,7 @@
'target_name': 'mojo_shell_test_support', 'target_name': 'mojo_shell_test_support',
'type': 'static_library', 'type': 'static_library',
'dependencies': [ 'dependencies': [
'../base/base.gyp:base',
'../base/base.gyp:base_static', '../base/base.gyp:base_static',
'../url/url.gyp:url_lib',
'mojo_application_manager',
'mojo_base.gyp:mojo_system_impl', 'mojo_base.gyp:mojo_system_impl',
'mojo_shell_lib', 'mojo_shell_lib',
], ],
...@@ -252,24 +237,20 @@ ...@@ -252,24 +237,20 @@
'type': 'executable', 'type': 'executable',
'dependencies': [ 'dependencies': [
'../base/base.gyp:base', '../base/base.gyp:base',
'../ui/gl/gl.gyp:gl',
'../url/url.gyp:url_lib',
'mojo_application_manager',
'mojo_base.gyp:mojo_common_lib', 'mojo_base.gyp:mojo_common_lib',
'mojo_base.gyp:mojo_environment_chromium', 'mojo_base.gyp:mojo_environment_chromium',
'mojo_base.gyp:mojo_system_impl',
'mojo_shell_lib', 'mojo_shell_lib',
], ],
'sources': [
'shell/desktop/mojo_main.cc',
],
'conditions': [ 'conditions': [
['use_ozone==1', { ['component=="shared_library"', {
'dependencies': [ 'dependencies': [
'../ui/ozone/ozone.gyp:ozone', '../ui/gfx/gfx.gyp:gfx',
], ],
}], }],
], ],
'sources': [
'shell/desktop/mojo_main.cc',
],
}, },
{ {
# GN version: //mojo/shell:mojo_shell_tests # GN version: //mojo/shell:mojo_shell_tests
...@@ -281,8 +262,6 @@ ...@@ -281,8 +262,6 @@
'../base/base.gyp:test_support_base', '../base/base.gyp:test_support_base',
'../testing/gtest.gyp:gtest', '../testing/gtest.gyp:gtest',
'../net/net.gyp:net_test_support', '../net/net.gyp:net_test_support',
# TODO(vtl): We don't currently need this, but I imagine we will soon.
# '../ui/gl/gl.gyp:gl',
'../url/url.gyp:url_lib', '../url/url.gyp:url_lib',
'mojo_application_manager', 'mojo_application_manager',
'mojo_base.gyp:mojo_common_lib', 'mojo_base.gyp:mojo_common_lib',
...@@ -320,7 +299,6 @@ ...@@ -320,7 +299,6 @@
'dependencies': [ 'dependencies': [
'../base/base.gyp:base', '../base/base.gyp:base',
'../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations', '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
'../net/net.gyp:net',
'../url/url.gyp:url_lib', '../url/url.gyp:url_lib',
'mojo_content_handler_bindings', 'mojo_content_handler_bindings',
'mojo_network_bindings', 'mojo_network_bindings',
...@@ -482,7 +460,6 @@ ...@@ -482,7 +460,6 @@
'../ui/compositor/compositor.gyp:compositor', '../ui/compositor/compositor.gyp:compositor',
'../ui/events/events.gyp:events', '../ui/events/events.gyp:events',
'../ui/events/events.gyp:events_base', '../ui/events/events.gyp:events_base',
'../ui/gl/gl.gyp:gl',
'../webkit/common/gpu/webkit_gpu.gyp:webkit_gpu', '../webkit/common/gpu/webkit_gpu.gyp:webkit_gpu',
'mojo_cc_support', 'mojo_cc_support',
'mojo_native_viewport_bindings', 'mojo_native_viewport_bindings',
......
...@@ -81,7 +81,7 @@ ...@@ -81,7 +81,7 @@
], ],
'sources': [ 'sources': [
'examples/sample_app/gles2_client_impl.cc', 'examples/sample_app/gles2_client_impl.cc',
'examples/sample_app/gles2_client_impl.cc', 'examples/sample_app/gles2_client_impl.h',
'examples/sample_app/sample_app.cc', 'examples/sample_app/sample_app.cc',
'examples/sample_app/spinning_cube.cc', 'examples/sample_app/spinning_cube.cc',
'examples/sample_app/spinning_cube.h', 'examples/sample_app/spinning_cube.h',
...@@ -567,7 +567,6 @@ ...@@ -567,7 +567,6 @@
'../skia/skia.gyp:skia', '../skia/skia.gyp:skia',
'../ui/gfx/gfx.gyp:gfx', '../ui/gfx/gfx.gyp:gfx',
'../ui/gfx/gfx.gyp:gfx_geometry', '../ui/gfx/gfx.gyp:gfx_geometry',
'../ui/gl/gl.gyp:gl',
'mojo_base.gyp:mojo_application_chromium', 'mojo_base.gyp:mojo_application_chromium',
'mojo_base.gyp:mojo_cpp_bindings', 'mojo_base.gyp:mojo_cpp_bindings',
'mojo_base.gyp:mojo_utility', 'mojo_base.gyp:mojo_utility',
...@@ -663,7 +662,6 @@ ...@@ -663,7 +662,6 @@
'../ui/base/ui_base.gyp:ui_base', '../ui/base/ui_base.gyp:ui_base',
'../ui/gfx/gfx.gyp:gfx', '../ui/gfx/gfx.gyp:gfx',
'../ui/gfx/gfx.gyp:gfx_geometry', '../ui/gfx/gfx.gyp:gfx_geometry',
'../ui/gl/gl.gyp:gl',
'../ui/resources/ui_resources.gyp:ui_resources', '../ui/resources/ui_resources.gyp:ui_resources',
'../ui/resources/ui_resources.gyp:ui_test_pak', '../ui/resources/ui_resources.gyp:ui_test_pak',
'../ui/views/views.gyp:views', '../ui/views/views.gyp:views',
...@@ -698,7 +696,6 @@ ...@@ -698,7 +696,6 @@
'dependencies': [ 'dependencies': [
'../base/base.gyp:base', '../base/base.gyp:base',
'../ui/gfx/gfx.gyp:gfx_geometry', '../ui/gfx/gfx.gyp:gfx_geometry',
'../ui/gl/gl.gyp:gl',
'../url/url.gyp:url_lib', '../url/url.gyp:url_lib',
'mojo_base.gyp:mojo_application_chromium', 'mojo_base.gyp:mojo_application_chromium',
'mojo_base.gyp:mojo_cpp_bindings', 'mojo_base.gyp:mojo_cpp_bindings',
...@@ -723,7 +720,6 @@ ...@@ -723,7 +720,6 @@
'dependencies': [ 'dependencies': [
'../base/base.gyp:base', '../base/base.gyp:base',
'../ui/gfx/gfx.gyp:gfx_geometry', '../ui/gfx/gfx.gyp:gfx_geometry',
'../ui/gl/gl.gyp:gl',
'../url/url.gyp:url_lib', '../url/url.gyp:url_lib',
'mojo_base.gyp:mojo_application_chromium', 'mojo_base.gyp:mojo_application_chromium',
'mojo_base.gyp:mojo_cpp_bindings', 'mojo_base.gyp:mojo_cpp_bindings',
......
...@@ -328,8 +328,6 @@ ...@@ -328,8 +328,6 @@
{ {
# GN version: //mojo/services/native_viewport # GN version: //mojo/services/native_viewport
'target_name': 'mojo_native_viewport_service_lib', 'target_name': 'mojo_native_viewport_service_lib',
# This is linked directly into the embedder, so we make it a static_library.
# TODO(davemoore): Make this a true service.
'type': 'static_library', 'type': 'static_library',
'dependencies': [ 'dependencies': [
'../base/base.gyp:base', '../base/base.gyp:base',
...@@ -399,6 +397,21 @@ ...@@ -399,6 +397,21 @@
}], }],
], ],
}, },
{
'target_name': 'mojo_native_viewport_service',
'type': 'loadable_module',
'dependencies': [
'mojo_native_viewport_bindings',
'mojo_native_viewport_service_lib',
'<(mojo_system_for_loadable_module)',
],
'export_dependent_settings': [
'mojo_native_viewport_bindings',
],
'sources': [
'services/native_viewport/main.cc',
],
},
{ {
# GN version: //mojo/services/public/interfaces/navigation # GN version: //mojo/services/public/interfaces/navigation
'target_name': 'mojo_navigation_bindings', 'target_name': 'mojo_navigation_bindings',
...@@ -761,7 +774,7 @@ ...@@ -761,7 +774,7 @@
{ {
# GN version: //mojo/services/view_manager # GN version: //mojo/services/view_manager
'target_name': 'mojo_view_manager', 'target_name': 'mojo_view_manager',
'type': '<(component)', 'type': 'loadable_module',
'dependencies': [ 'dependencies': [
'../base/base.gyp:base', '../base/base.gyp:base',
'../cc/cc.gyp:cc_surfaces', '../cc/cc.gyp:cc_surfaces',
...@@ -771,6 +784,8 @@ ...@@ -771,6 +784,8 @@
'../ui/events/events.gyp:events_base', '../ui/events/events.gyp:events_base',
'../ui/gfx/gfx.gyp:gfx', '../ui/gfx/gfx.gyp:gfx',
'../ui/gfx/gfx.gyp:gfx_geometry', '../ui/gfx/gfx.gyp:gfx_geometry',
'../webkit/common/gpu/webkit_gpu.gyp:webkit_gpu',
'mojo_base.gyp:mojo_common_lib',
'mojo_base.gyp:mojo_application_chromium', 'mojo_base.gyp:mojo_application_chromium',
'mojo_base.gyp:mojo_common_lib', 'mojo_base.gyp:mojo_common_lib',
'mojo_geometry_bindings', 'mojo_geometry_bindings',
...@@ -783,7 +798,11 @@ ...@@ -783,7 +798,11 @@
'mojo_surfaces_lib', 'mojo_surfaces_lib',
'mojo_view_manager_bindings', 'mojo_view_manager_bindings',
'mojo_view_manager_common', 'mojo_view_manager_common',
'<(mojo_system_for_component)', 'mojo_gpu_bindings',
'<(mojo_system_for_loadable_module)',
# No direct dependencies, but needed for tests that use the
# view_manager.
'mojo_native_viewport_service',
], ],
'sources': [ 'sources': [
'services/view_manager/access_policy.h', 'services/view_manager/access_policy.h',
...@@ -809,6 +828,9 @@ ...@@ -809,6 +828,9 @@
'services/view_manager/window_manager_access_policy.cc', 'services/view_manager/window_manager_access_policy.cc',
'services/view_manager/window_manager_access_policy.h', 'services/view_manager/window_manager_access_policy.h',
], ],
'includes': [
'mojo_public_gles2_for_loadable_module.gypi',
],
'defines': [ 'defines': [
'MOJO_VIEW_MANAGER_IMPLEMENTATION', 'MOJO_VIEW_MANAGER_IMPLEMENTATION',
], ],
...@@ -820,7 +842,6 @@ ...@@ -820,7 +842,6 @@
'dependencies': [ 'dependencies': [
'../base/base.gyp:base', '../base/base.gyp:base',
'../base/base.gyp:test_support_base', '../base/base.gyp:test_support_base',
'../ui/gl/gl.gyp:gl',
], ],
'sources': [ 'sources': [
'services/public/cpp/view_manager/lib/view_manager_test_suite.cc', 'services/public/cpp/view_manager/lib/view_manager_test_suite.cc',
...@@ -828,12 +849,6 @@ ...@@ -828,12 +849,6 @@
'services/public/cpp/view_manager/lib/view_manager_unittests.cc', 'services/public/cpp/view_manager/lib/view_manager_unittests.cc',
], ],
'conditions': [ 'conditions': [
['OS=="linux" or OS=="win"', {
'dependencies': [
'../third_party/mesa/mesa.gyp:osmesa',
'mojo_native_viewport_service_lib',
],
}],
['use_x11==1', { ['use_x11==1', {
'dependencies': [ 'dependencies': [
'../ui/gfx/x/gfx_x11.gyp:gfx_x11', '../ui/gfx/x/gfx_x11.gyp:gfx_x11',
...@@ -852,7 +867,6 @@ ...@@ -852,7 +867,6 @@
'../testing/gtest.gyp:gtest', '../testing/gtest.gyp:gtest',
'../ui/aura/aura.gyp:aura', '../ui/aura/aura.gyp:aura',
'../ui/gfx/gfx.gyp:gfx_geometry', '../ui/gfx/gfx.gyp:gfx_geometry',
'../ui/gl/gl.gyp:gl',
'mojo_application_manager', 'mojo_application_manager',
'mojo_base.gyp:mojo_system_impl', 'mojo_base.gyp:mojo_system_impl',
'mojo_base.gyp:mojo_application_chromium', 'mojo_base.gyp:mojo_application_chromium',
...@@ -864,12 +878,22 @@ ...@@ -864,12 +878,22 @@
'mojo_view_manager_bindings', 'mojo_view_manager_bindings',
'mojo_view_manager_common', 'mojo_view_manager_common',
'mojo_view_manager_run_unittests', 'mojo_view_manager_run_unittests',
# Included only to force deps for bots.
'mojo_native_viewport_service',
'mojo_view_manager',
], ],
'sources': [ 'sources': [
'services/view_manager/test_change_tracker.cc', 'services/view_manager/test_change_tracker.cc',
'services/view_manager/test_change_tracker.h', 'services/view_manager/test_change_tracker.h',
'services/view_manager/view_manager_unittest.cc', 'services/view_manager/view_manager_unittest.cc',
], ],
'conditions': [
['OS=="win"', {
'dependencies': [
'../ui/gfx/gfx.gyp:gfx',
],
}],
],
}, },
{ {
'target_name': 'package_mojo_view_manager', 'target_name': 'package_mojo_view_manager',
...@@ -921,7 +945,6 @@ ...@@ -921,7 +945,6 @@
'dependencies': [ 'dependencies': [
'../base/base.gyp:test_support_base', '../base/base.gyp:test_support_base',
'../testing/gtest.gyp:gtest', '../testing/gtest.gyp:gtest',
'../ui/gl/gl.gyp:gl',
'mojo_application_manager', 'mojo_application_manager',
'mojo_base.gyp:mojo_system_impl', 'mojo_base.gyp:mojo_system_impl',
'mojo_base.gyp:mojo_environment_chromium', 'mojo_base.gyp:mojo_environment_chromium',
......
...@@ -9,7 +9,6 @@ group("services") { ...@@ -9,7 +9,6 @@ group("services") {
"//mojo/services/clipboard", "//mojo/services/clipboard",
"//mojo/services/gles2:bindings", "//mojo/services/gles2:bindings",
"//mojo/services/html_viewer", "//mojo/services/html_viewer",
"//mojo/services/native_viewport",
"//mojo/services/network", "//mojo/services/network",
"//mojo/services/public/interfaces/clipboard", "//mojo/services/public/interfaces/clipboard",
"//mojo/services/public/interfaces/content_handler", "//mojo/services/public/interfaces/content_handler",
...@@ -22,10 +21,14 @@ group("services") { ...@@ -22,10 +21,14 @@ group("services") {
"//mojo/services/surfaces", "//mojo/services/surfaces",
"//mojo/services/test_service:bindings", "//mojo/services/test_service:bindings",
] ]
if (!is_android) {
deps += ["//mojo/services/native_viewport"]
}
if (use_aura) { if (use_aura) {
deps += [ deps += [
"//mojo/services/public/interfaces/view_manager", "//mojo/services/public/interfaces/view_manager",
"//mojo/services/public/interfaces/window_manager", "//mojo/services/public/interfaces/window_manager",
"//mojo/services/view_manager",
"//mojo/services/window_manager", "//mojo/services/window_manager",
] ]
} }
......
...@@ -8,5 +8,7 @@ include_rules = [ ...@@ -8,5 +8,7 @@ include_rules = [
"+skia", "+skia",
"+third_party/WebKit/public", "+third_party/WebKit/public",
"+third_party/skia/include", "+third_party/skia/include",
"+ui/base",
"+ui/events",
"+ui/native_theme", "+ui/native_theme",
] ]
...@@ -16,6 +16,13 @@ ...@@ -16,6 +16,13 @@
#include "mojo/services/public/interfaces/content_handler/content_handler.mojom.h" #include "mojo/services/public/interfaces/content_handler/content_handler.mojom.h"
#include "third_party/WebKit/public/web/WebKit.h" #include "third_party/WebKit/public/web/WebKit.h"
#if !defined(COMPONENT_BUILD)
#include "base/i18n/icu_util.h"
#include "base/path_service.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/ui_base_paths.h"
#endif
namespace mojo { namespace mojo {
class HTMLViewer; class HTMLViewer;
...@@ -63,6 +70,16 @@ class HTMLViewer : public ApplicationDelegate, ...@@ -63,6 +70,16 @@ class HTMLViewer : public ApplicationDelegate,
shell_ = app->shell(); shell_ = app->shell();
blink_platform_impl_.reset(new BlinkPlatformImpl(app)); blink_platform_impl_.reset(new BlinkPlatformImpl(app));
blink::initialize(blink_platform_impl_.get()); blink::initialize(blink_platform_impl_.get());
#if !defined(COMPONENT_BUILD)
base::i18n::InitializeICU();
ui::RegisterPathProvider();
base::FilePath ui_test_pak_path;
CHECK(PathService::Get(ui::UI_TEST_PAK, &ui_test_pak_path));
ui::ResourceBundle::InitSharedInstanceWithPakPath(ui_test_pak_path);
#endif
compositor_thread_.Start(); compositor_thread_.Start();
web_media_player_factory_.reset(new WebMediaPlayerFactory( web_media_player_factory_.reset(new WebMediaPlayerFactory(
compositor_thread_.message_loop_proxy())); compositor_thread_.message_loop_proxy()));
......
...@@ -4,10 +4,22 @@ ...@@ -4,10 +4,22 @@
import("//build/config/ui.gni") import("//build/config/ui.gni")
# GYP version: mojo/mojo_services.gypi:mojo_native_viewport_service_lib if (!is_android) {
static_library("native_viewport") { shared_library("native_viewport") {
output_name = "mojo_native_viewport" output_name = "mojo_native_viewport_service"
deps = [
":lib",
"//mojo/public/c/system:for_shared_library",
"//mojo/services/public/interfaces/native_viewport",
"//ui/gl",
]
sources = [ "main.cc" ]
}
}
source_set("lib") {
deps = [ deps = [
"//base", "//base",
"//cc/surfaces", "//cc/surfaces",
...@@ -25,6 +37,7 @@ static_library("native_viewport") { ...@@ -25,6 +37,7 @@ static_library("native_viewport") {
"//ui/events/platform", "//ui/events/platform",
"//ui/gfx", "//ui/gfx",
"//ui/gfx/geometry", "//ui/gfx/geometry",
"//ui/gl",
] ]
sources = [ sources = [
...@@ -49,13 +62,6 @@ static_library("native_viewport") { ...@@ -49,13 +62,6 @@ static_library("native_viewport") {
deps += [ "//mojo:jni_headers" ] deps += [ "//mojo:jni_headers" ]
} }
if (is_win) {
deps += [
# TODO(GYP)
# '../ui/platform_window/win/win_window.gyp:win_window',
]
}
if (use_x11) { if (use_x11) {
sources += [ "platform_viewport_x11.cc" ] sources += [ "platform_viewport_x11.cc" ]
deps += [ deps += [
......
include_rules = [ include_rules = [
"+cc/surfaces", "+cc/surfaces",
"+gpu/command_buffer/service/mailbox_manager.h", "+gpu/command_buffer/service/mailbox_manager.h",
"+mojo/application",
"+mojo/services/public/cpp/geometry", "+mojo/services/public/cpp/geometry",
"+mojo/services/public/cpp/input_events", "+mojo/services/public/cpp/input_events",
"+mojo/services/public/cpp/surfaces", "+mojo/services/public/cpp/surfaces",
......
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/message_loop/message_loop.h"
#include "gpu/command_buffer/service/mailbox_manager.h"
#include "mojo/application/application_runner_chromium.h"
#include "mojo/public/c/system/main.h"
#include "mojo/public/cpp/application/application_connection.h"
#include "mojo/public/cpp/application/application_delegate.h"
#include "mojo/public/cpp/application/interface_factory_impl.h"
#include "mojo/services/native_viewport/gpu_impl.h"
#include "mojo/services/native_viewport/native_viewport_impl.h"
#include "ui/gl/gl_share_group.h"
#include "ui/gl/gl_surface.h"
namespace mojo {
class NativeViewportAppDelegate
: public ApplicationDelegate,
public InterfaceFactory<NativeViewport>,
public InterfaceFactory<Gpu>,
public InterfaceFactory<NativeViewportConfig> {
public:
NativeViewportAppDelegate()
: share_group_(new gfx::GLShareGroup),
mailbox_manager_(new gpu::gles2::MailboxManager),
is_test_(false),
is_initialized_(false) {}
virtual ~NativeViewportAppDelegate() {}
private:
class NativeViewportConfigImpl : public InterfaceImpl<NativeViewportConfig> {
public:
NativeViewportConfigImpl(NativeViewportAppDelegate* app_delegate)
: app_delegate_(app_delegate) {}
virtual void UseTestConfig(
const mojo::Callback<void()>& callback) OVERRIDE {
app_delegate_->is_test_ = true;
callback.Run();
}
private:
NativeViewportAppDelegate* app_delegate_;
};
// ApplicationDelegate implementation.
virtual void Initialize(ApplicationImpl* application) OVERRIDE {
app_ = application;
}
virtual bool ConfigureIncomingConnection(
mojo::ApplicationConnection* connection) OVERRIDE {
connection->AddService<NativeViewport>(this);
connection->AddService<Gpu>(this);
connection->AddService<NativeViewportConfig>(this);
return true;
}
// InterfaceFactory<NativeViewport> implementation.
virtual void Create(ApplicationConnection* connection,
InterfaceRequest<NativeViewport> request) OVERRIDE {
#if !defined(COMPONENT_BUILD)
if (!is_initialized_) {
if (is_test_)
gfx::GLSurface::InitializeOneOffForTests();
else
gfx::GLSurface::InitializeOneOff();
is_initialized_ = true;
}
#endif
BindToRequest(new NativeViewportImpl(app_), &request);
}
// InterfaceFactory<Gpu> implementation.
virtual void Create(ApplicationConnection* connection,
InterfaceRequest<Gpu> request) OVERRIDE {
BindToRequest(new GpuImpl(share_group_.get(), mailbox_manager_.get()),
&request);
}
// InterfaceFactory<NVTestConfig> implementation.
virtual void Create(ApplicationConnection* connection,
InterfaceRequest<NativeViewportConfig> request) OVERRIDE {
BindToRequest(new NativeViewportConfigImpl(this), &request);
}
ApplicationImpl* app_;
scoped_refptr<gfx::GLShareGroup> share_group_;
scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_;
bool is_test_;
bool is_initialized_;
DISALLOW_COPY_AND_ASSIGN(NativeViewportAppDelegate);
};
}
MojoResult MojoMain(MojoHandle shell_handle) {
mojo::ApplicationRunnerChromium runner(new mojo::NativeViewportAppDelegate);
runner.set_message_loop_type(base::MessageLoop::TYPE_UI);
return runner.Run(shell_handle);
}
...@@ -34,6 +34,8 @@ source_set("view_manager") { ...@@ -34,6 +34,8 @@ source_set("view_manager") {
"//mojo/services/public/cpp/surfaces", "//mojo/services/public/cpp/surfaces",
"//mojo/services/public/interfaces/geometry", "//mojo/services/public/interfaces/geometry",
"//mojo/services/public/interfaces/gpu", "//mojo/services/public/interfaces/gpu",
"//mojo/services/public/interfaces/native_viewport",
"//mojo/services/public/interfaces/surfaces",
"//mojo/services/public/interfaces/view_manager", "//mojo/services/public/interfaces/view_manager",
"//mojo/services/public/interfaces/window_manager", "//mojo/services/public/interfaces/window_manager",
"//skia", "//skia",
...@@ -47,6 +49,7 @@ source_set("view_manager") { ...@@ -47,6 +49,7 @@ source_set("view_manager") {
source_set("common") { source_set("common") {
sources = [ sources = [
"types.h" "ids.h",
"types.h",
] ]
} }
...@@ -16,15 +16,14 @@ source_set("run_unittests") { ...@@ -16,15 +16,14 @@ source_set("run_unittests") {
deps = [ deps = [
"//base", "//base",
"//base/test:test_support", "//base/test:test_support",
"//ui/gl",
] ]
if (is_linux || is_win) {
deps += [
"//third_party/mesa:osmesa",
"//mojo/services/native_viewport",
]
}
if (use_x11) { if (use_x11) {
deps += [ "//ui/gfx/x" ] deps += ["//ui/gfx/x"]
} }
if (is_component_build) {
deps += ["//ui/gl"]
}
} }
...@@ -26,8 +26,11 @@ void ViewManagerTestSuite::Initialize() { ...@@ -26,8 +26,11 @@ void ViewManagerTestSuite::Initialize() {
gfx::InitializeThreadedX11(); gfx::InitializeThreadedX11();
#endif #endif
base::TestSuite::Initialize(); #if defined(COMPONENT_BUILD)
gfx::GLSurface::InitializeOneOffForTests(); gfx::GLSurface::InitializeOneOffForTests();
#endif
base::TestSuite::Initialize();
// base::TestSuite and ViewsInit both try to load icu. That's ok for tests. // base::TestSuite and ViewsInit both try to load icu. That's ok for tests.
base::i18n::AllowMultipleInitializeCallsForTesting(); base::i18n::AllowMultipleInitializeCallsForTesting();
......
...@@ -26,4 +26,11 @@ interface NativeViewportClient { ...@@ -26,4 +26,11 @@ interface NativeViewportClient {
OnEvent(Event event) => (); OnEvent(Event event) => ();
}; };
// Connect to this interface before any other connections are made and call
// UseTestConfig(), blocking on the reply. This will ensure that the correct
// global initialization is done before subsequent connections.
interface NativeViewportConfig {
UseTestConfig() => ();
};
} }
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
import("//build/config/ui.gni")
# GYP version: mojo/mojo_services.gypi:mojo_view_manager # GYP version: mojo/mojo_services.gypi:mojo_view_manager
component("view_manager") { component("view_manager") {
deps = [ deps = [
...@@ -40,7 +42,6 @@ component("view_manager") { ...@@ -40,7 +42,6 @@ component("view_manager") {
"default_access_policy.h", "default_access_policy.h",
"display_manager.cc", "display_manager.cc",
"display_manager.h", "display_manager.h",
"ids.h",
"main.cc", "main.cc",
"server_view.cc", "server_view.cc",
"server_view.h", "server_view.h",
...@@ -65,19 +66,24 @@ test("mojo_view_manager_unittests") { ...@@ -65,19 +66,24 @@ test("mojo_view_manager_unittests") {
"//mojo/application", "//mojo/application",
"//mojo/application_manager", "//mojo/application_manager",
"//mojo/environment:chromium", "//mojo/environment:chromium",
"//mojo/services/public/cpp/input_events",
"//mojo/services/public/cpp/geometry", "//mojo/services/public/cpp/geometry",
"//mojo/services/public/cpp/view_manager", "//mojo/services/public/cpp/view_manager",
"//mojo/services/public/cpp/view_manager/lib:run_unittests", "//mojo/services/public/cpp/view_manager/lib:run_unittests",
"//mojo/services/public/cpp/view_manager:common", "//mojo/services/public/cpp/view_manager:common",
"//mojo/services/public/interfaces/input_events",
"//mojo/services/public/interfaces/geometry",
"//mojo/services/public/interfaces/view_manager",
"//mojo/shell:test_support", "//mojo/shell:test_support",
"//mojo/system", "//mojo/system",
"//testing/gtest", "//testing/gtest",
"//ui/gfx/geometry",
] ]
if (use_x11) {
deps += ["//ui/gfx/x"]
}
if (is_component_build) {
deps += ["//ui/gl"]
}
sources = [ sources = [
"test_change_tracker.cc", "test_change_tracker.cc",
"test_change_tracker.h", "test_change_tracker.h",
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#include "mojo/services/public/cpp/view_manager/types.h" #include "mojo/services/public/cpp/view_manager/types.h"
#include "mojo/services/public/cpp/view_manager/util.h" #include "mojo/services/public/cpp/view_manager/util.h"
#include "mojo/services/view_manager/view_manager_export.h"
namespace mojo { namespace mojo {
namespace service { namespace service {
...@@ -21,7 +20,7 @@ const ConnectionSpecificId kInvalidConnectionId = 0; ...@@ -21,7 +20,7 @@ const ConnectionSpecificId kInvalidConnectionId = 0;
const ConnectionSpecificId kWindowManagerConnection = 1; const ConnectionSpecificId kWindowManagerConnection = 1;
// Adds a bit of type safety to view ids. // Adds a bit of type safety to view ids.
struct MOJO_VIEW_MANAGER_EXPORT ViewId { struct ViewId {
ViewId(ConnectionSpecificId connection_id, ConnectionSpecificId view_id) ViewId(ConnectionSpecificId connection_id, ConnectionSpecificId view_id)
: connection_id(connection_id), : connection_id(connection_id),
view_id(view_id) {} view_id(view_id) {}
......
...@@ -31,6 +31,10 @@ ...@@ -31,6 +31,10 @@
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/rect.h"
#if defined(OS_WIN)
#include "ui/gfx/win/window_impl.h"
#endif
namespace mojo { namespace mojo {
namespace service { namespace service {
...@@ -455,9 +459,14 @@ class ViewManagerTest : public testing::Test { ...@@ -455,9 +459,14 @@ class ViewManagerTest : public testing::Test {
virtual void SetUp() OVERRIDE { virtual void SetUp() OVERRIDE {
ASSERT_TRUE(ViewManagerProxy::IsInInitialState()); ASSERT_TRUE(ViewManagerProxy::IsInInitialState());
test_helper_.Init(); test_helper_.Init();
#if defined(OS_WIN)
// As we unload the wndproc of window classes we need to be sure to
// unregister them.
gfx::WindowImpl::UnregisterClassesAtExit();
#endif
test_helper_.SetLoaderForURL( test_helper_.SetLoaderForURL(
scoped_ptr<ApplicationLoader>(new EmbedApplicationLoader()), scoped_ptr<ApplicationLoader>(new EmbedApplicationLoader()),
GURL(kTestServiceURL)); GURL(kTestServiceURL));
...@@ -556,13 +565,8 @@ TEST_F(ViewManagerTest, MultipleEmbedRootsBeforeWTHReady) { ...@@ -556,13 +565,8 @@ TEST_F(ViewManagerTest, MultipleEmbedRootsBeforeWTHReady) {
} }
// Verifies client gets a valid id. // Verifies client gets a valid id.
#if defined(OS_LINUX)
// http://crbug.com/396492 // http://crbug.com/396492
#define MAYBE_ValidId DISABLED_ValidId TEST_F(ViewManagerTest, DISABLED_ValidId) {
#else
#define MAYBE_ValidId ValidId
#endif
TEST_F(ViewManagerTest, MAYBE_ValidId) {
// TODO(beng): this should really have the URL of the application that // TODO(beng): this should really have the URL of the application that
// connected to ViewManagerInit. // connected to ViewManagerInit.
EXPECT_EQ("OnEmbed creator=", EXPECT_EQ("OnEmbed creator=",
......
...@@ -38,6 +38,7 @@ source_set("lib") { ...@@ -38,6 +38,7 @@ source_set("lib") {
"//mojo/services/public/cpp/view_manager", "//mojo/services/public/cpp/view_manager",
"//mojo/services/public/interfaces/window_manager", "//mojo/services/public/interfaces/window_manager",
"//ui/base", "//ui/base",
"//ui/events",
"//ui/gfx", "//ui/gfx",
"//ui/gfx/geometry", "//ui/gfx/geometry",
"//ui/wm", "//ui/wm",
...@@ -65,12 +66,6 @@ test("mojo_core_window_manager_unittests") { ...@@ -65,12 +66,6 @@ test("mojo_core_window_manager_unittests") {
"//testing/gtest", "//testing/gtest",
"//ui/gl", "//ui/gl",
] ]
if (is_linux) {
deps += [
"//third_party/mesa:osmesa",
"//mojo/services/native_viewport",
]
}
if (use_x11) { if (use_x11) {
deps += [ "//ui/gfx/x" ] deps += [ "//ui/gfx/x" ]
} }
......
...@@ -11,15 +11,11 @@ executable("mojo_shell") { ...@@ -11,15 +11,11 @@ executable("mojo_shell") {
"//base", "//base",
"//mojo/common", "//mojo/common",
"//mojo/environment:chromium", "//mojo/environment:chromium",
"//mojo/application_manager", "//ui/gfx",
"//mojo/system",
"//third_party/icu",
"//ui/gl",
"//url",
] ]
if (use_ozone) { if (is_component_build) {
deps += [ "//ui/ozone" ] deps += ["//ui/gl"]
} }
sources = [ sources = [
...@@ -40,13 +36,9 @@ source_set("lib") { ...@@ -40,13 +36,9 @@ source_set("lib") {
"//mojo/common", "//mojo/common",
"//mojo/gles2", "//mojo/gles2",
"//mojo/public/interfaces/application", "//mojo/public/interfaces/application",
"//mojo/services/native_viewport",
"//mojo/services/public/interfaces/native_viewport",
"//mojo/services/public/interfaces/network", "//mojo/services/public/interfaces/network",
"//mojo/spy", "//mojo/spy",
"//mojo/system", "//mojo/system",
"//net",
"//url",
] ]
sources = [ sources = [
...@@ -84,11 +76,10 @@ source_set("lib") { ...@@ -84,11 +76,10 @@ source_set("lib") {
] ]
if (is_linux) { if (is_linux) {
deps += [ deps += ["//dbus"]
"//dbus"
]
} else if (is_android) { } else if (is_android) {
deps += [ deps += [
"//mojo/services/native_viewport:lib",
"//mojo/services/network:lib", "//mojo/services/network:lib",
] ]
sources += [ sources += [
...@@ -96,18 +87,6 @@ source_set("lib") { ...@@ -96,18 +87,6 @@ source_set("lib") {
"network_application_loader.h", "network_application_loader.h",
] ]
} }
if (use_aura) {
deps += [
# These are only necessary as long as we hard code use of ViewManager.
"//skia",
"//mojo/services/view_manager",
"//mojo/services/public/interfaces/view_manager",
]
sources += [
"view_manager_loader.cc",
"view_manager_loader.h",
]
}
} }
mojom("app_child_process_bindings") { mojom("app_child_process_bindings") {
...@@ -170,10 +149,7 @@ source_set("test_support") { ...@@ -170,10 +149,7 @@ source_set("test_support") {
deps = [ deps = [
":lib", ":lib",
"//base",
"//base:base_static", "//base:base_static",
"//mojo/application_manager",
"//mojo/system", "//mojo/system",
"//url",
] ]
} }
...@@ -21,28 +21,24 @@ ...@@ -21,28 +21,24 @@
#include "mojo/public/cpp/application/application_connection.h" #include "mojo/public/cpp/application/application_connection.h"
#include "mojo/public/cpp/application/application_delegate.h" #include "mojo/public/cpp/application/application_delegate.h"
#include "mojo/public/cpp/application/application_impl.h" #include "mojo/public/cpp/application/application_impl.h"
#include "mojo/services/native_viewport/gpu_impl.h"
#include "mojo/services/native_viewport/native_viewport_impl.h"
#include "mojo/shell/dynamic_application_loader.h" #include "mojo/shell/dynamic_application_loader.h"
#include "mojo/shell/in_process_dynamic_service_runner.h" #include "mojo/shell/in_process_dynamic_service_runner.h"
#include "mojo/shell/out_of_process_dynamic_service_runner.h" #include "mojo/shell/out_of_process_dynamic_service_runner.h"
#include "mojo/shell/switches.h" #include "mojo/shell/switches.h"
#include "mojo/shell/ui_application_loader_android.h" #include "mojo/shell/ui_application_loader_android.h"
#include "mojo/spy/spy.h" #include "mojo/spy/spy.h"
#include "ui/gl/gl_share_group.h"
#if defined(OS_LINUX) #if defined(OS_LINUX)
#include "mojo/shell/dbus_application_loader_linux.h" #include "mojo/shell/dbus_application_loader_linux.h"
#endif // defined(OS_LINUX) #endif // defined(OS_LINUX)
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
#include "mojo/services/native_viewport/gpu_impl.h"
#include "mojo/services/native_viewport/native_viewport_impl.h"
#include "mojo/shell/network_application_loader.h" #include "mojo/shell/network_application_loader.h"
#include "ui/gl/gl_share_group.h"
#endif // defined(OS_ANDROID) #endif // defined(OS_ANDROID)
#if defined(USE_AURA)
#include "mojo/shell/view_manager_loader.h"
#endif
namespace mojo { namespace mojo {
namespace shell { namespace shell {
namespace { namespace {
...@@ -111,6 +107,7 @@ class EmptyServiceProvider : public InterfaceImpl<ServiceProvider> { ...@@ -111,6 +107,7 @@ class EmptyServiceProvider : public InterfaceImpl<ServiceProvider> {
} // namespace } // namespace
#if defined(OS_ANDROID)
class Context::NativeViewportApplicationLoader class Context::NativeViewportApplicationLoader
: public ApplicationLoader, : public ApplicationLoader,
public ApplicationDelegate, public ApplicationDelegate,
...@@ -161,6 +158,7 @@ class Context::NativeViewportApplicationLoader ...@@ -161,6 +158,7 @@ class Context::NativeViewportApplicationLoader
scoped_ptr<ApplicationImpl> app_; scoped_ptr<ApplicationImpl> app_;
DISALLOW_COPY_AND_ASSIGN(NativeViewportApplicationLoader); DISALLOW_COPY_AND_ASSIGN(NativeViewportApplicationLoader);
}; };
#endif
Context::Context() { Context::Context() {
DCHECK(!base::MessageLoop::current()); DCHECK(!base::MessageLoop::current());
...@@ -201,24 +199,6 @@ void Context::Init() { ...@@ -201,24 +199,6 @@ void Context::Init() {
scoped_ptr<ApplicationLoader>(new NativeViewportApplicationLoader()), scoped_ptr<ApplicationLoader>(new NativeViewportApplicationLoader()),
this)), this)),
GURL("mojo:mojo_native_viewport_service")); GURL("mojo:mojo_native_viewport_service"));
#else
{
scoped_ptr<BackgroundShellApplicationLoader> loader(
new BackgroundShellApplicationLoader(
scoped_ptr<ApplicationLoader>(
new NativeViewportApplicationLoader()),
"native_viewport",
base::MessageLoop::TYPE_UI));
application_manager_.SetLoaderForURL(
loader.PassAs<ApplicationLoader>(),
GURL("mojo:mojo_native_viewport_service"));
}
#endif
#if defined(USE_AURA)
// TODO(sky): need a better way to find this. It shouldn't be linked in.
application_manager_.SetLoaderForURL(
scoped_ptr<ApplicationLoader>(new ViewManagerLoader()),
GURL("mojo:mojo_view_manager"));
#endif #endif
#if defined(OS_LINUX) #if defined(OS_LINUX)
......
...@@ -12,14 +12,21 @@ ...@@ -12,14 +12,21 @@
#include "mojo/shell/init.h" #include "mojo/shell/init.h"
#include "mojo/shell/switches.h" #include "mojo/shell/switches.h"
#include "ui/gfx/switches.h" #include "ui/gfx/switches.h"
#if defined(COMPONENT_BUILD)
#include "ui/gl/gl_surface.h" #include "ui/gl/gl_surface.h"
#endif
namespace { namespace {
void RunApps(mojo::shell::Context* context, std::vector<GURL> app_urls) { void RunApps(mojo::shell::Context* context) {
for (std::vector<GURL>::const_iterator it = app_urls.begin(); const base::CommandLine& command_line =
it != app_urls.end(); ++it) { *base::CommandLine::ForCurrentProcess();
context->Run(*it); base::CommandLine::StringVector args = command_line.GetArgs();
for (base::CommandLine::StringVector::const_iterator it = args.begin();
it != args.end();
++it) {
context->Run(GURL(*it));
} }
} }
...@@ -43,8 +50,9 @@ int main(int argc, char** argv) { ...@@ -43,8 +50,9 @@ int main(int argc, char** argv) {
*base::CommandLine::ForCurrentProcess())) { *base::CommandLine::ForCurrentProcess())) {
child_process->Main(); child_process->Main();
} else { } else {
#if defined(COMPONENT_BUILD)
gfx::GLSurface::InitializeOneOff(); gfx::GLSurface::InitializeOneOff();
#endif
// We want the shell::Context to outlive the MessageLoop so that pipes are // We want the shell::Context to outlive the MessageLoop so that pipes are
// all gracefully closed / error-out before we try to shut the Context down. // all gracefully closed / error-out before we try to shut the Context down.
mojo::shell::Context shell_context; mojo::shell::Context shell_context;
...@@ -59,17 +67,7 @@ int main(int argc, char** argv) { ...@@ -59,17 +67,7 @@ int main(int argc, char** argv) {
GURL(command_line.GetSwitchValueASCII(switches::kOrigin))); GURL(command_line.GetSwitchValueASCII(switches::kOrigin)));
} }
std::vector<GURL> app_urls; message_loop.PostTask(FROM_HERE, base::Bind(RunApps, &shell_context));
base::CommandLine::StringVector args = command_line.GetArgs();
for (base::CommandLine::StringVector::const_iterator it = args.begin();
it != args.end();
++it)
app_urls.push_back(GURL(*it));
message_loop.PostTask(FROM_HERE,
base::Bind(RunApps,
&shell_context,
app_urls));
message_loop.Run(); message_loop.Run();
} }
} }
......
...@@ -112,8 +112,9 @@ void InProcessDynamicServiceRunner::Run() { ...@@ -112,8 +112,9 @@ void InProcessDynamicServiceRunner::Run() {
#if !defined(COMPONENT_BUILD) #if !defined(COMPONENT_BUILD)
// Warn on this really weird case: The library requires the GLES2 // Warn on this really weird case: The library requires the GLES2
// control functions, but doesn't require the GLES2 implementation. // control functions, but doesn't require the GLES2 implementation.
LOG(WARNING) << "App library has MojoSetGLES2ControlThunks, but " LOG(WARNING) << app_path_.value()
"doesn't have MojoSetGLES2ImplThunks."; << " has MojoSetGLES2ControlThunks, "
"but doesn't have MojoSetGLES2ImplThunks.";
#endif #endif
} }
...@@ -144,9 +145,8 @@ void InProcessDynamicServiceRunner::Run() { ...@@ -144,9 +145,8 @@ void InProcessDynamicServiceRunner::Run() {
LOG(ERROR) << "MojoMain returned an error: " << result; LOG(ERROR) << "MojoMain returned an error: " << result;
} while (false); } while (false);
bool success = app_completed_callback_runner_.Run(); app_completed_callback_runner_.Run();
app_completed_callback_runner_.Reset(); app_completed_callback_runner_.Reset();
LOG_IF(ERROR, !success) << "Failed post run app_completed_callback";
} }
} // namespace shell } // namespace shell
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment