diff --git a/mojo/aura/aura_init.cc b/mojo/aura/aura_init.cc index df17ab77b66ec..a99ce25fc3a88 100644 --- a/mojo/aura/aura_init.cc +++ b/mojo/aura/aura_init.cc @@ -11,7 +11,7 @@ namespace mojo { AuraInit::AuraInit() { - aura::Env::CreateInstance(false); + aura::Env::CreateInstance(true); context_factory_.reset(new ContextFactoryMojo); aura::Env::GetInstance()->set_context_factory(context_factory_.get()); diff --git a/mojo/mojo.gyp b/mojo/mojo.gyp index 37b91d76c493c..890af4e63cc53 100644 --- a/mojo/mojo.gyp +++ b/mojo/mojo.gyp @@ -40,7 +40,7 @@ 'mojo_geometry_lib', 'mojo_html_viewer', 'mojo_js', - 'mojo_native_viewport_service', + 'mojo_native_viewport_service_lib', 'mojo_network_service', 'mojo_pepper_container_app', 'mojo_png_viewer', @@ -148,6 +148,8 @@ '../base/base.gyp:base', '../base/base.gyp:base_static', '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations', + '../net/net.gyp:net', + '../url/url.gyp:url_lib', 'mojo_application_manager', 'mojo_base.gyp:mojo_application_bindings', 'mojo_base.gyp:mojo_common_lib', @@ -155,6 +157,7 @@ 'mojo_base.gyp:mojo_system_impl', 'mojo_base.gyp:mojo_application_chromium', 'mojo_external_service_bindings', + 'mojo_native_viewport_service_lib', 'mojo_network_bindings', 'mojo_spy', ], @@ -192,13 +195,10 @@ 'shell/test_child_process.h', 'shell/ui_application_loader_android.cc', 'shell/ui_application_loader_android.h', + 'shell/view_manager_loader.cc', + 'shell/view_manager_loader.h', ], 'conditions': [ - ['component=="shared_library"', { - 'dependencies': [ - '../ui/gl/gl.gyp:gl', - ], - }], ['OS=="linux"', { 'dependencies': [ '../build/linux/system.gyp:dbus', @@ -208,13 +208,25 @@ ['OS=="android"', { 'dependencies': [ 'mojo_network_service_lib', - 'mojo_native_viewport_service_lib', ], 'sources': [ 'shell/network_application_loader.cc', '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', + ], + }], ], }, { @@ -222,7 +234,10 @@ 'target_name': 'mojo_shell_test_support', 'type': 'static_library', 'dependencies': [ + '../base/base.gyp:base', '../base/base.gyp:base_static', + '../url/url.gyp:url_lib', + 'mojo_application_manager', 'mojo_base.gyp:mojo_system_impl', 'mojo_shell_lib', ], @@ -237,20 +252,24 @@ 'type': 'executable', 'dependencies': [ '../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_environment_chromium', + 'mojo_base.gyp:mojo_system_impl', 'mojo_shell_lib', ], - 'sources': [ - 'shell/desktop/mojo_main.cc', - ], 'conditions': [ - ['component=="shared_library"', { + ['use_ozone==1', { 'dependencies': [ - '../ui/gfx/gfx.gyp:gfx', + '../ui/ozone/ozone.gyp:ozone', ], }], ], + 'sources': [ + 'shell/desktop/mojo_main.cc', + ], }, { # GN version: //mojo/shell:mojo_shell_tests @@ -262,6 +281,8 @@ '../base/base.gyp:test_support_base', '../testing/gtest.gyp:gtest', '../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', 'mojo_application_manager', 'mojo_base.gyp:mojo_common_lib', @@ -299,6 +320,7 @@ 'dependencies': [ '../base/base.gyp:base', '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations', + '../net/net.gyp:net', '../url/url.gyp:url_lib', 'mojo_content_handler_bindings', 'mojo_network_bindings', @@ -460,6 +482,7 @@ '../ui/compositor/compositor.gyp:compositor', '../ui/events/events.gyp:events', '../ui/events/events.gyp:events_base', + '../ui/gl/gl.gyp:gl', '../webkit/common/gpu/webkit_gpu.gyp:webkit_gpu', 'mojo_cc_support', 'mojo_native_viewport_bindings', diff --git a/mojo/mojo_examples.gypi b/mojo/mojo_examples.gypi index b46514944928f..76c434d2f0c8c 100644 --- a/mojo/mojo_examples.gypi +++ b/mojo/mojo_examples.gypi @@ -81,7 +81,7 @@ ], 'sources': [ 'examples/sample_app/gles2_client_impl.cc', - 'examples/sample_app/gles2_client_impl.h', + 'examples/sample_app/gles2_client_impl.cc', 'examples/sample_app/sample_app.cc', 'examples/sample_app/spinning_cube.cc', 'examples/sample_app/spinning_cube.h', @@ -567,6 +567,7 @@ '../skia/skia.gyp:skia', '../ui/gfx/gfx.gyp:gfx', '../ui/gfx/gfx.gyp:gfx_geometry', + '../ui/gl/gl.gyp:gl', 'mojo_base.gyp:mojo_application_chromium', 'mojo_base.gyp:mojo_cpp_bindings', 'mojo_base.gyp:mojo_utility', @@ -662,6 +663,7 @@ '../ui/base/ui_base.gyp:ui_base', '../ui/gfx/gfx.gyp:gfx', '../ui/gfx/gfx.gyp:gfx_geometry', + '../ui/gl/gl.gyp:gl', '../ui/resources/ui_resources.gyp:ui_resources', '../ui/resources/ui_resources.gyp:ui_test_pak', '../ui/views/views.gyp:views', @@ -696,6 +698,7 @@ 'dependencies': [ '../base/base.gyp:base', '../ui/gfx/gfx.gyp:gfx_geometry', + '../ui/gl/gl.gyp:gl', '../url/url.gyp:url_lib', 'mojo_base.gyp:mojo_application_chromium', 'mojo_base.gyp:mojo_cpp_bindings', @@ -720,6 +723,7 @@ 'dependencies': [ '../base/base.gyp:base', '../ui/gfx/gfx.gyp:gfx_geometry', + '../ui/gl/gl.gyp:gl', '../url/url.gyp:url_lib', 'mojo_base.gyp:mojo_application_chromium', 'mojo_base.gyp:mojo_cpp_bindings', diff --git a/mojo/mojo_services.gypi b/mojo/mojo_services.gypi index a0aef82a39361..4b686114eadae 100644 --- a/mojo/mojo_services.gypi +++ b/mojo/mojo_services.gypi @@ -328,6 +328,8 @@ { # GN version: //mojo/services/native_viewport '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', 'dependencies': [ '../base/base.gyp:base', @@ -397,21 +399,6 @@ }], ], }, - { - '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 'target_name': 'mojo_navigation_bindings', @@ -774,7 +761,7 @@ { # GN version: //mojo/services/view_manager 'target_name': 'mojo_view_manager', - 'type': 'loadable_module', + 'type': '<(component)', 'dependencies': [ '../base/base.gyp:base', '../cc/cc.gyp:cc_surfaces', @@ -784,8 +771,6 @@ '../ui/events/events.gyp:events_base', '../ui/gfx/gfx.gyp:gfx', '../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_common_lib', 'mojo_geometry_bindings', @@ -798,8 +783,7 @@ 'mojo_surfaces_lib', 'mojo_view_manager_bindings', 'mojo_view_manager_common', - 'mojo_gpu_bindings', - '<(mojo_system_for_loadable_module)', + '<(mojo_system_for_component)', ], 'sources': [ 'services/view_manager/access_policy.h', @@ -825,9 +809,6 @@ 'services/view_manager/window_manager_access_policy.cc', 'services/view_manager/window_manager_access_policy.h', ], - 'includes': [ - 'mojo_public_gles2_for_loadable_module.gypi', - ], 'defines': [ 'MOJO_VIEW_MANAGER_IMPLEMENTATION', ], @@ -839,6 +820,7 @@ 'dependencies': [ '../base/base.gyp:base', '../base/base.gyp:test_support_base', + '../ui/gl/gl.gyp:gl', ], 'sources': [ 'services/public/cpp/view_manager/lib/view_manager_test_suite.cc', @@ -846,6 +828,12 @@ 'services/public/cpp/view_manager/lib/view_manager_unittests.cc', ], 'conditions': [ + ['OS=="linux" or OS=="win"', { + 'dependencies': [ + '../third_party/mesa/mesa.gyp:osmesa', + 'mojo_native_viewport_service_lib', + ], + }], ['use_x11==1', { 'dependencies': [ '../ui/gfx/x/gfx_x11.gyp:gfx_x11', @@ -864,6 +852,7 @@ '../testing/gtest.gyp:gtest', '../ui/aura/aura.gyp:aura', '../ui/gfx/gfx.gyp:gfx_geometry', + '../ui/gl/gl.gyp:gl', 'mojo_application_manager', 'mojo_base.gyp:mojo_system_impl', 'mojo_base.gyp:mojo_application_chromium', @@ -881,13 +870,6 @@ 'services/view_manager/test_change_tracker.h', 'services/view_manager/view_manager_unittest.cc', ], - 'conditions': [ - ['OS=="win"', { - 'dependencies': [ - '../ui/gfx/gfx.gyp:gfx', - ], - }], - ], }, { 'target_name': 'package_mojo_view_manager', @@ -939,6 +921,7 @@ 'dependencies': [ '../base/base.gyp:test_support_base', '../testing/gtest.gyp:gtest', + '../ui/gl/gl.gyp:gl', 'mojo_application_manager', 'mojo_base.gyp:mojo_system_impl', 'mojo_base.gyp:mojo_environment_chromium', diff --git a/mojo/services/BUILD.gn b/mojo/services/BUILD.gn index 5b4498c9d174f..90988abeaac0f 100644 --- a/mojo/services/BUILD.gn +++ b/mojo/services/BUILD.gn @@ -9,6 +9,7 @@ group("services") { "//mojo/services/clipboard", "//mojo/services/gles2:bindings", "//mojo/services/html_viewer", + "//mojo/services/native_viewport", "//mojo/services/network", "//mojo/services/public/interfaces/clipboard", "//mojo/services/public/interfaces/content_handler", @@ -21,14 +22,10 @@ group("services") { "//mojo/services/surfaces", "//mojo/services/test_service:bindings", ] - if (!is_android) { - deps += ["//mojo/services/native_viewport"] - } if (use_aura) { deps += [ "//mojo/services/public/interfaces/view_manager", "//mojo/services/public/interfaces/window_manager", - "//mojo/services/view_manager", "//mojo/services/window_manager", ] } diff --git a/mojo/services/html_viewer/DEPS b/mojo/services/html_viewer/DEPS index ca538eeb4bfd0..8fa252f4bb750 100644 --- a/mojo/services/html_viewer/DEPS +++ b/mojo/services/html_viewer/DEPS @@ -8,7 +8,5 @@ include_rules = [ "+skia", "+third_party/WebKit/public", "+third_party/skia/include", - "+ui/base", - "+ui/events", "+ui/native_theme", ] diff --git a/mojo/services/html_viewer/html_viewer.cc b/mojo/services/html_viewer/html_viewer.cc index 24a8050bd8b5d..10bc3c06438dc 100644 --- a/mojo/services/html_viewer/html_viewer.cc +++ b/mojo/services/html_viewer/html_viewer.cc @@ -16,13 +16,6 @@ #include "mojo/services/public/interfaces/content_handler/content_handler.mojom.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 { class HTMLViewer; @@ -70,16 +63,6 @@ class HTMLViewer : public ApplicationDelegate, shell_ = app->shell(); blink_platform_impl_.reset(new BlinkPlatformImpl(app)); 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(); web_media_player_factory_.reset(new WebMediaPlayerFactory( compositor_thread_.message_loop_proxy())); diff --git a/mojo/services/native_viewport/BUILD.gn b/mojo/services/native_viewport/BUILD.gn index 75960189512ae..966883cc9ccf4 100644 --- a/mojo/services/native_viewport/BUILD.gn +++ b/mojo/services/native_viewport/BUILD.gn @@ -4,22 +4,10 @@ import("//build/config/ui.gni") -if (!is_android) { - shared_library("native_viewport") { - output_name = "mojo_native_viewport_service" +# GYP version: mojo/mojo_services.gypi:mojo_native_viewport_service_lib +static_library("native_viewport") { + output_name = "mojo_native_viewport" - deps = [ - ":lib", - "//mojo/public/c/system:for_shared_library", - "//mojo/services/public/interfaces/native_viewport", - "//ui/gl", - ] - - sources = [ "main.cc" ] - } -} - -source_set("lib") { deps = [ "//base", "//cc/surfaces", @@ -37,7 +25,6 @@ source_set("lib") { "//ui/events/platform", "//ui/gfx", "//ui/gfx/geometry", - "//ui/gl", ] sources = [ @@ -62,6 +49,13 @@ source_set("lib") { deps += [ "//mojo:jni_headers" ] } + if (is_win) { + deps += [ + # TODO(GYP) + # '../ui/platform_window/win/win_window.gyp:win_window', + ] + } + if (use_x11) { sources += [ "platform_viewport_x11.cc" ] deps += [ diff --git a/mojo/services/native_viewport/DEPS b/mojo/services/native_viewport/DEPS index abf7ef8050ea7..957e0f0915c37 100644 --- a/mojo/services/native_viewport/DEPS +++ b/mojo/services/native_viewport/DEPS @@ -1,7 +1,6 @@ include_rules = [ "+cc/surfaces", "+gpu/command_buffer/service/mailbox_manager.h", - "+mojo/application", "+mojo/services/public/cpp/geometry", "+mojo/services/public/cpp/input_events", "+mojo/services/public/cpp/surfaces", diff --git a/mojo/services/native_viewport/main.cc b/mojo/services/native_viewport/main.cc deleted file mode 100644 index fb150da28daed..0000000000000 --- a/mojo/services/native_viewport/main.cc +++ /dev/null @@ -1,102 +0,0 @@ -// 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, - public InterfaceFactory, - public InterfaceFactory { - 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 { - public: - NativeViewportConfigImpl(NativeViewportAppDelegate* app_delegate) - : app_delegate_(app_delegate) {} - - virtual void UseTestConfig( - const mojo::Callback& 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(this); - connection->AddService(this); - connection->AddService(this); - return true; - } - - // InterfaceFactory implementation. - virtual void Create(ApplicationConnection* connection, - InterfaceRequest 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 implementation. - virtual void Create(ApplicationConnection* connection, - InterfaceRequest request) OVERRIDE { - BindToRequest(new GpuImpl(share_group_.get(), mailbox_manager_.get()), - &request); - } - - // InterfaceFactory implementation. - virtual void Create(ApplicationConnection* connection, - InterfaceRequest request) OVERRIDE { - BindToRequest(new NativeViewportConfigImpl(this), &request); - } - - ApplicationImpl* app_; - scoped_refptr share_group_; - scoped_refptr 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); -} diff --git a/mojo/services/public/cpp/view_manager/BUILD.gn b/mojo/services/public/cpp/view_manager/BUILD.gn index 7677ee7603b6b..664640d06e15c 100644 --- a/mojo/services/public/cpp/view_manager/BUILD.gn +++ b/mojo/services/public/cpp/view_manager/BUILD.gn @@ -34,8 +34,6 @@ source_set("view_manager") { "//mojo/services/public/cpp/surfaces", "//mojo/services/public/interfaces/geometry", "//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/window_manager", "//skia", @@ -49,7 +47,6 @@ source_set("view_manager") { source_set("common") { sources = [ - "ids.h", - "types.h", + "types.h" ] } diff --git a/mojo/services/public/cpp/view_manager/lib/BUILD.gn b/mojo/services/public/cpp/view_manager/lib/BUILD.gn index df44a34d43454..32f4f3d416dcd 100644 --- a/mojo/services/public/cpp/view_manager/lib/BUILD.gn +++ b/mojo/services/public/cpp/view_manager/lib/BUILD.gn @@ -16,14 +16,15 @@ source_set("run_unittests") { deps = [ "//base", "//base/test:test_support", + "//ui/gl", ] - - if (use_x11) { - deps += ["//ui/gfx/x"] + if (is_linux || is_win) { + deps += [ + "//third_party/mesa:osmesa", + "//mojo/services/native_viewport", + ] } - - if (is_component_build) { - deps += ["//ui/gl"] + if (use_x11) { + deps += [ "//ui/gfx/x" ] } - } diff --git a/mojo/services/public/cpp/view_manager/lib/view_manager_test_suite.cc b/mojo/services/public/cpp/view_manager/lib/view_manager_test_suite.cc index abe0906e4e42a..30cbad68440ff 100644 --- a/mojo/services/public/cpp/view_manager/lib/view_manager_test_suite.cc +++ b/mojo/services/public/cpp/view_manager/lib/view_manager_test_suite.cc @@ -26,11 +26,8 @@ void ViewManagerTestSuite::Initialize() { gfx::InitializeThreadedX11(); #endif -#if defined(COMPONENT_BUILD) - gfx::GLSurface::InitializeOneOffForTests(); -#endif - base::TestSuite::Initialize(); + gfx::GLSurface::InitializeOneOffForTests(); // base::TestSuite and ViewsInit both try to load icu. That's ok for tests. base::i18n::AllowMultipleInitializeCallsForTesting(); diff --git a/mojo/services/public/interfaces/native_viewport/native_viewport.mojom b/mojo/services/public/interfaces/native_viewport/native_viewport.mojom index 6c9fd199a9307..a182a1493c053 100644 --- a/mojo/services/public/interfaces/native_viewport/native_viewport.mojom +++ b/mojo/services/public/interfaces/native_viewport/native_viewport.mojom @@ -26,11 +26,4 @@ interface NativeViewportClient { 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() => (); -}; - } diff --git a/mojo/services/view_manager/BUILD.gn b/mojo/services/view_manager/BUILD.gn index 3cc385343d1ec..21b2796638cf0 100644 --- a/mojo/services/view_manager/BUILD.gn +++ b/mojo/services/view_manager/BUILD.gn @@ -2,8 +2,6 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import("//build/config/ui.gni") - # GYP version: mojo/mojo_services.gypi:mojo_view_manager component("view_manager") { deps = [ @@ -42,6 +40,7 @@ component("view_manager") { "default_access_policy.h", "display_manager.cc", "display_manager.h", + "ids.h", "main.cc", "server_view.cc", "server_view.h", @@ -66,24 +65,19 @@ test("mojo_view_manager_unittests") { "//mojo/application", "//mojo/application_manager", "//mojo/environment:chromium", + "//mojo/services/public/cpp/input_events", "//mojo/services/public/cpp/geometry", "//mojo/services/public/cpp/view_manager", "//mojo/services/public/cpp/view_manager/lib:run_unittests", "//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/system", "//testing/gtest", - "//ui/gfx/geometry", ] - if (use_x11) { - deps += ["//ui/gfx/x"] - } - - if (is_component_build) { - deps += ["//ui/gl"] - } - sources = [ "test_change_tracker.cc", "test_change_tracker.h", diff --git a/mojo/services/view_manager/ids.h b/mojo/services/view_manager/ids.h index 0d1c48644790c..4a27c627b4e63 100644 --- a/mojo/services/view_manager/ids.h +++ b/mojo/services/view_manager/ids.h @@ -7,6 +7,7 @@ #include "mojo/services/public/cpp/view_manager/types.h" #include "mojo/services/public/cpp/view_manager/util.h" +#include "mojo/services/view_manager/view_manager_export.h" namespace mojo { namespace service { @@ -20,7 +21,7 @@ const ConnectionSpecificId kInvalidConnectionId = 0; const ConnectionSpecificId kWindowManagerConnection = 1; // Adds a bit of type safety to view ids. -struct ViewId { +struct MOJO_VIEW_MANAGER_EXPORT ViewId { ViewId(ConnectionSpecificId connection_id, ConnectionSpecificId view_id) : connection_id(connection_id), view_id(view_id) {} diff --git a/mojo/services/view_manager/view_manager_unittest.cc b/mojo/services/view_manager/view_manager_unittest.cc index cc972d436de05..be9e7ccf940c3 100644 --- a/mojo/services/view_manager/view_manager_unittest.cc +++ b/mojo/services/view_manager/view_manager_unittest.cc @@ -31,10 +31,6 @@ #include "testing/gtest/include/gtest/gtest.h" #include "ui/gfx/geometry/rect.h" -#if defined(OS_WIN) -#include "ui/gfx/win/window_impl.h" -#endif - namespace mojo { namespace service { @@ -459,13 +455,8 @@ class ViewManagerTest : public testing::Test { virtual void SetUp() OVERRIDE { ASSERT_TRUE(ViewManagerProxy::IsInInitialState()); - 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_.Init(); test_helper_.SetLoaderForURL( scoped_ptr(new EmbedApplicationLoader()), @@ -565,8 +556,13 @@ TEST_F(ViewManagerTest, MultipleEmbedRootsBeforeWTHReady) { } // Verifies client gets a valid id. +#if defined(OS_LINUX) // http://crbug.com/396492 -TEST_F(ViewManagerTest, DISABLED_ValidId) { +#define MAYBE_ValidId 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 // connected to ViewManagerInit. EXPECT_EQ("OnEmbed creator=", diff --git a/mojo/services/window_manager/BUILD.gn b/mojo/services/window_manager/BUILD.gn index 4887a3d687407..6e8ece8365b5a 100644 --- a/mojo/services/window_manager/BUILD.gn +++ b/mojo/services/window_manager/BUILD.gn @@ -38,7 +38,6 @@ source_set("lib") { "//mojo/services/public/cpp/view_manager", "//mojo/services/public/interfaces/window_manager", "//ui/base", - "//ui/events", "//ui/gfx", "//ui/gfx/geometry", "//ui/wm", @@ -66,6 +65,12 @@ test("mojo_core_window_manager_unittests") { "//testing/gtest", "//ui/gl", ] + if (is_linux) { + deps += [ + "//third_party/mesa:osmesa", + "//mojo/services/native_viewport", + ] + } if (use_x11) { deps += [ "//ui/gfx/x" ] } diff --git a/mojo/shell/BUILD.gn b/mojo/shell/BUILD.gn index 320f4eba54782..eb62ff2adf8d2 100644 --- a/mojo/shell/BUILD.gn +++ b/mojo/shell/BUILD.gn @@ -11,11 +11,15 @@ executable("mojo_shell") { "//base", "//mojo/common", "//mojo/environment:chromium", - "//ui/gfx", + "//mojo/application_manager", + "//mojo/system", + "//third_party/icu", + "//ui/gl", + "//url", ] - if (is_component_build) { - deps += ["//ui/gl"] + if (use_ozone) { + deps += [ "//ui/ozone" ] } sources = [ @@ -36,9 +40,13 @@ source_set("lib") { "//mojo/common", "//mojo/gles2", "//mojo/public/interfaces/application", + "//mojo/services/native_viewport", + "//mojo/services/public/interfaces/native_viewport", "//mojo/services/public/interfaces/network", "//mojo/spy", "//mojo/system", + "//net", + "//url", ] sources = [ @@ -76,10 +84,11 @@ source_set("lib") { ] if (is_linux) { - deps += ["//dbus"] + deps += [ + "//dbus" + ] } else if (is_android) { deps += [ - "//mojo/services/native_viewport:lib", "//mojo/services/network:lib", ] sources += [ @@ -87,6 +96,18 @@ source_set("lib") { "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") { @@ -149,7 +170,10 @@ source_set("test_support") { deps = [ ":lib", + "//base", "//base:base_static", + "//mojo/application_manager", "//mojo/system", + "//url", ] } diff --git a/mojo/shell/context.cc b/mojo/shell/context.cc index 64db00b05a502..203dec89aba13 100644 --- a/mojo/shell/context.cc +++ b/mojo/shell/context.cc @@ -21,24 +21,28 @@ #include "mojo/public/cpp/application/application_connection.h" #include "mojo/public/cpp/application/application_delegate.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/in_process_dynamic_service_runner.h" #include "mojo/shell/out_of_process_dynamic_service_runner.h" #include "mojo/shell/switches.h" #include "mojo/shell/ui_application_loader_android.h" #include "mojo/spy/spy.h" +#include "ui/gl/gl_share_group.h" #if defined(OS_LINUX) #include "mojo/shell/dbus_application_loader_linux.h" #endif // defined(OS_LINUX) #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 "ui/gl/gl_share_group.h" #endif // defined(OS_ANDROID) +#if defined(USE_AURA) +#include "mojo/shell/view_manager_loader.h" +#endif + namespace mojo { namespace shell { namespace { @@ -107,7 +111,6 @@ class EmptyServiceProvider : public InterfaceImpl { } // namespace -#if defined(OS_ANDROID) class Context::NativeViewportApplicationLoader : public ApplicationLoader, public ApplicationDelegate, @@ -158,7 +161,6 @@ class Context::NativeViewportApplicationLoader scoped_ptr app_; DISALLOW_COPY_AND_ASSIGN(NativeViewportApplicationLoader); }; -#endif Context::Context() { DCHECK(!base::MessageLoop::current()); @@ -199,6 +201,24 @@ void Context::Init() { scoped_ptr(new NativeViewportApplicationLoader()), this)), GURL("mojo:mojo_native_viewport_service")); +#else + { + scoped_ptr loader( + new BackgroundShellApplicationLoader( + scoped_ptr( + new NativeViewportApplicationLoader()), + "native_viewport", + base::MessageLoop::TYPE_UI)); + application_manager_.SetLoaderForURL( + loader.PassAs(), + 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(new ViewManagerLoader()), + GURL("mojo:mojo_view_manager")); #endif #if defined(OS_LINUX) diff --git a/mojo/shell/desktop/mojo_main.cc b/mojo/shell/desktop/mojo_main.cc index 3dac7c78abce1..7d57e89d98b1e 100644 --- a/mojo/shell/desktop/mojo_main.cc +++ b/mojo/shell/desktop/mojo_main.cc @@ -12,21 +12,14 @@ #include "mojo/shell/init.h" #include "mojo/shell/switches.h" #include "ui/gfx/switches.h" - -#if defined(COMPONENT_BUILD) #include "ui/gl/gl_surface.h" -#endif namespace { -void RunApps(mojo::shell::Context* context) { - const base::CommandLine& command_line = - *base::CommandLine::ForCurrentProcess(); - base::CommandLine::StringVector args = command_line.GetArgs(); - for (base::CommandLine::StringVector::const_iterator it = args.begin(); - it != args.end(); - ++it) { - context->Run(GURL(*it)); +void RunApps(mojo::shell::Context* context, std::vector app_urls) { + for (std::vector::const_iterator it = app_urls.begin(); + it != app_urls.end(); ++it) { + context->Run(*it); } } @@ -50,9 +43,8 @@ int main(int argc, char** argv) { *base::CommandLine::ForCurrentProcess())) { child_process->Main(); } else { -#if defined(COMPONENT_BUILD) gfx::GLSurface::InitializeOneOff(); -#endif + // 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. mojo::shell::Context shell_context; @@ -67,7 +59,17 @@ int main(int argc, char** argv) { GURL(command_line.GetSwitchValueASCII(switches::kOrigin))); } - message_loop.PostTask(FROM_HERE, base::Bind(RunApps, &shell_context)); + std::vector app_urls; + 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(); } } diff --git a/mojo/shell/in_process_dynamic_service_runner.cc b/mojo/shell/in_process_dynamic_service_runner.cc index c98ef0f8fd3d6..25431a845f2de 100644 --- a/mojo/shell/in_process_dynamic_service_runner.cc +++ b/mojo/shell/in_process_dynamic_service_runner.cc @@ -112,9 +112,8 @@ void InProcessDynamicServiceRunner::Run() { #if !defined(COMPONENT_BUILD) // Warn on this really weird case: The library requires the GLES2 // control functions, but doesn't require the GLES2 implementation. - LOG(WARNING) << app_path_.value() - << " has MojoSetGLES2ControlThunks, " - "but doesn't have MojoSetGLES2ImplThunks."; + LOG(WARNING) << "App library has MojoSetGLES2ControlThunks, but " + "doesn't have MojoSetGLES2ImplThunks."; #endif } @@ -145,8 +144,9 @@ void InProcessDynamicServiceRunner::Run() { LOG(ERROR) << "MojoMain returned an error: " << result; } while (false); - app_completed_callback_runner_.Run(); + bool success = app_completed_callback_runner_.Run(); app_completed_callback_runner_.Reset(); + LOG_IF(ERROR, !success) << "Failed post run app_completed_callback"; } } // namespace shell