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 @@
namespace mojo {
AuraInit::AuraInit() {
aura::Env::CreateInstance(true);
aura::Env::CreateInstance(false);
context_factory_.reset(new ContextFactoryMojo);
aura::Env::GetInstance()->set_context_factory(context_factory_.get());
......
......@@ -40,7 +40,7 @@
'mojo_geometry_lib',
'mojo_html_viewer',
'mojo_js',
'mojo_native_viewport_service_lib',
'mojo_native_viewport_service',
'mojo_network_service',
'mojo_pepper_container_app',
'mojo_png_viewer',
......@@ -148,8 +148,6 @@
'../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',
......@@ -157,7 +155,6 @@
'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',
],
......@@ -195,10 +192,13 @@
'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,25 +208,13 @@
['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',
],
}],
],
},
{
......@@ -234,10 +222,7 @@
'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',
],
......@@ -252,24 +237,20 @@
'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': [
['use_ozone==1', {
['component=="shared_library"', {
'dependencies': [
'../ui/ozone/ozone.gyp:ozone',
'../ui/gfx/gfx.gyp:gfx',
],
}],
],
'sources': [
'shell/desktop/mojo_main.cc',
],
},
{
# GN version: //mojo/shell:mojo_shell_tests
......@@ -281,8 +262,6 @@
'../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',
......@@ -320,7 +299,6 @@
'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',
......@@ -482,7 +460,6 @@
'../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',
......
......@@ -81,7 +81,7 @@
],
'sources': [
'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/spinning_cube.cc',
'examples/sample_app/spinning_cube.h',
......@@ -567,7 +567,6 @@
'../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',
......@@ -663,7 +662,6 @@
'../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',
......@@ -698,7 +696,6 @@
'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',
......@@ -723,7 +720,6 @@
'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',
......
......@@ -328,8 +328,6 @@
{
# 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',
......@@ -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
'target_name': 'mojo_navigation_bindings',
......@@ -761,7 +774,7 @@
{
# GN version: //mojo/services/view_manager
'target_name': 'mojo_view_manager',
'type': '<(component)',
'type': 'loadable_module',
'dependencies': [
'../base/base.gyp:base',
'../cc/cc.gyp:cc_surfaces',
......@@ -771,6 +784,8 @@
'../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',
......@@ -783,7 +798,11 @@
'mojo_surfaces_lib',
'mojo_view_manager_bindings',
'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': [
'services/view_manager/access_policy.h',
......@@ -809,6 +828,9 @@
'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',
],
......@@ -820,7 +842,6 @@
'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',
......@@ -828,12 +849,6 @@
'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',
......@@ -852,7 +867,6 @@
'../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',
......@@ -864,12 +878,22 @@
'mojo_view_manager_bindings',
'mojo_view_manager_common',
'mojo_view_manager_run_unittests',
# Included only to force deps for bots.
'mojo_native_viewport_service',
'mojo_view_manager',
],
'sources': [
'services/view_manager/test_change_tracker.cc',
'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',
......@@ -921,7 +945,6 @@
'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',
......
......@@ -9,7 +9,6 @@ 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",
......@@ -22,10 +21,14 @@ 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",
]
}
......
......@@ -8,5 +8,7 @@ include_rules = [
"+skia",
"+third_party/WebKit/public",
"+third_party/skia/include",
"+ui/base",
"+ui/events",
"+ui/native_theme",
]
......@@ -16,6 +16,13 @@
#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;
......@@ -63,6 +70,16 @@ 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()));
......
......@@ -4,10 +4,22 @@
import("//build/config/ui.gni")
# GYP version: mojo/mojo_services.gypi:mojo_native_viewport_service_lib
static_library("native_viewport") {
output_name = "mojo_native_viewport"
if (!is_android) {
shared_library("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 = [
"//base",
"//cc/surfaces",
......@@ -25,6 +37,7 @@ static_library("native_viewport") {
"//ui/events/platform",
"//ui/gfx",
"//ui/gfx/geometry",
"//ui/gl",
]
sources = [
......@@ -49,13 +62,6 @@ static_library("native_viewport") {
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 += [
......
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",
......
// 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") {
"//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",
......@@ -47,6 +49,7 @@ source_set("view_manager") {
source_set("common") {
sources = [
"types.h"
"ids.h",
"types.h",
]
}
......@@ -16,15 +16,14 @@ source_set("run_unittests") {
deps = [
"//base",
"//base/test:test_support",
"//ui/gl",
]
if (is_linux || is_win) {
deps += [
"//third_party/mesa:osmesa",
"//mojo/services/native_viewport",
]
}
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() {
gfx::InitializeThreadedX11();
#endif
base::TestSuite::Initialize();
#if defined(COMPONENT_BUILD)
gfx::GLSurface::InitializeOneOffForTests();
#endif
base::TestSuite::Initialize();
// base::TestSuite and ViewsInit both try to load icu. That's ok for tests.
base::i18n::AllowMultipleInitializeCallsForTesting();
......
......@@ -26,4 +26,11 @@ 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() => ();
};
}
......@@ -2,6 +2,8 @@
# 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 = [
......@@ -40,7 +42,6 @@ component("view_manager") {
"default_access_policy.h",
"display_manager.cc",
"display_manager.h",
"ids.h",
"main.cc",
"server_view.cc",
"server_view.h",
......@@ -65,19 +66,24 @@ 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",
......
......@@ -7,7 +7,6 @@
#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 {
......@@ -21,7 +20,7 @@ const ConnectionSpecificId kInvalidConnectionId = 0;
const ConnectionSpecificId kWindowManagerConnection = 1;
// Adds a bit of type safety to view ids.
struct MOJO_VIEW_MANAGER_EXPORT ViewId {
struct ViewId {
ViewId(ConnectionSpecificId connection_id, ConnectionSpecificId view_id)
: connection_id(connection_id),
view_id(view_id) {}
......
......@@ -31,6 +31,10 @@
#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 {
......@@ -455,9 +459,14 @@ 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_.SetLoaderForURL(
scoped_ptr<ApplicationLoader>(new EmbedApplicationLoader()),
GURL(kTestServiceURL));
......@@ -556,13 +565,8 @@ TEST_F(ViewManagerTest, MultipleEmbedRootsBeforeWTHReady) {
}
// Verifies client gets a valid id.
#if defined(OS_LINUX)
// http://crbug.com/396492
#define MAYBE_ValidId DISABLED_ValidId
#else
#define MAYBE_ValidId ValidId
#endif
TEST_F(ViewManagerTest, MAYBE_ValidId) {
TEST_F(ViewManagerTest, DISABLED_ValidId) {
// TODO(beng): this should really have the URL of the application that
// connected to ViewManagerInit.
EXPECT_EQ("OnEmbed creator=",
......
......@@ -38,6 +38,7 @@ 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",
......@@ -65,12 +66,6 @@ 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" ]
}
......
......@@ -11,15 +11,11 @@ executable("mojo_shell") {
"//base",
"//mojo/common",
"//mojo/environment:chromium",
"//mojo/application_manager",
"//mojo/system",
"//third_party/icu",
"//ui/gl",
"//url",
"//ui/gfx",
]
if (use_ozone) {
deps += [ "//ui/ozone" ]
if (is_component_build) {
deps += ["//ui/gl"]
}
sources = [
......@@ -40,13 +36,9 @@ 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 = [
......@@ -84,11 +76,10 @@ 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 += [
......@@ -96,18 +87,6 @@ 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") {
......@@ -170,10 +149,7 @@ source_set("test_support") {
deps = [
":lib",
"//base",
"//base:base_static",
"//mojo/application_manager",
"//mojo/system",
"//url",
]
}
......@@ -21,28 +21,24 @@
#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 {
......@@ -111,6 +107,7 @@ class EmptyServiceProvider : public InterfaceImpl<ServiceProvider> {
} // namespace
#if defined(OS_ANDROID)
class Context::NativeViewportApplicationLoader
: public ApplicationLoader,
public ApplicationDelegate,
......@@ -161,6 +158,7 @@ class Context::NativeViewportApplicationLoader
scoped_ptr<ApplicationImpl> app_;
DISALLOW_COPY_AND_ASSIGN(NativeViewportApplicationLoader);
};
#endif
Context::Context() {
DCHECK(!base::MessageLoop::current());
......@@ -201,24 +199,6 @@ void Context::Init() {
scoped_ptr<ApplicationLoader>(new NativeViewportApplicationLoader()),
this)),
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
#if defined(OS_LINUX)
......
......@@ -12,14 +12,21 @@
#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, std::vector<GURL> app_urls) {
for (std::vector<GURL>::const_iterator it = app_urls.begin();
it != app_urls.end(); ++it) {
context->Run(*it);
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));
}
}
......@@ -43,8 +50,9 @@ 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;
......@@ -59,17 +67,7 @@ int main(int argc, char** argv) {
GURL(command_line.GetSwitchValueASCII(switches::kOrigin)));
}
std::vector<GURL> 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.PostTask(FROM_HERE, base::Bind(RunApps, &shell_context));
message_loop.Run();
}
}
......
......@@ -112,8 +112,9 @@ 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 library has MojoSetGLES2ControlThunks, but "
"doesn't have MojoSetGLES2ImplThunks.";
LOG(WARNING) << app_path_.value()
<< " has MojoSetGLES2ControlThunks, "
"but doesn't have MojoSetGLES2ImplThunks.";
#endif
}
......@@ -144,9 +145,8 @@ void InProcessDynamicServiceRunner::Run() {
LOG(ERROR) << "MojoMain returned an error: " << result;
} while (false);
bool success = app_completed_callback_runner_.Run();
app_completed_callback_runner_.Run();
app_completed_callback_runner_.Reset();
LOG_IF(ERROR, !success) << "Failed post run app_completed_callback";
}
} // 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