Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(590)

Side by Side Diff: content/utility/utility_thread_impl.cc

Issue 1149833007: Embed a mojo ApplicationManager in content/browser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/utility/utility_thread_impl.h" 5 #include "content/utility/utility_thread_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/memory/scoped_vector.h" 10 #include "base/memory/scoped_vector.h"
11 #include "content/child/blink_platform_impl.h" 11 #include "content/child/blink_platform_impl.h"
12 #include "content/child/child_process.h" 12 #include "content/child/child_process.h"
13 #include "content/common/child_process_messages.h" 13 #include "content/common/child_process_messages.h"
14 #include "content/common/utility_messages.h" 14 #include "content/common/utility_messages.h"
15 #include "content/public/common/content_switches.h" 15 #include "content/public/common/content_switches.h"
16 #include "content/public/utility/content_utility_client.h" 16 #include "content/public/utility/content_utility_client.h"
17 #include "content/utility/utility_blink_platform_impl.h" 17 #include "content/utility/utility_blink_platform_impl.h"
18 #include "content/utility/utility_process_control_impl.h"
18 #include "ipc/ipc_sync_channel.h" 19 #include "ipc/ipc_sync_channel.h"
19 #include "third_party/WebKit/public/web/WebKit.h" 20 #include "third_party/WebKit/public/web/WebKit.h"
20 21
21 #if defined(OS_POSIX) && defined(ENABLE_PLUGINS) 22 #if defined(OS_POSIX) && defined(ENABLE_PLUGINS)
22 #include "base/files/file_path.h" 23 #include "base/files/file_path.h"
23 #include "content/common/plugin_list.h" 24 #include "content/common/plugin_list.h"
24 #endif 25 #endif
25 26
26 namespace content { 27 namespace content {
27 28
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 ChildProcess::current()->AddRefProcess(); 79 ChildProcess::current()->AddRefProcess();
79 if (!IsInBrowserProcess()) { 80 if (!IsInBrowserProcess()) {
80 // We can only initialize WebKit on one thread, and in single process mode 81 // We can only initialize WebKit on one thread, and in single process mode
81 // we run the utility thread on separate thread. This means that if any code 82 // we run the utility thread on separate thread. This means that if any code
82 // needs WebKit initialized in the utility process, they need to have 83 // needs WebKit initialized in the utility process, they need to have
83 // another path to support single process mode. 84 // another path to support single process mode.
84 blink_platform_impl_.reset(new UtilityBlinkPlatformImpl); 85 blink_platform_impl_.reset(new UtilityBlinkPlatformImpl);
85 blink::initialize(blink_platform_impl_.get()); 86 blink::initialize(blink_platform_impl_.get());
86 } 87 }
87 GetContentClient()->utility()->UtilityThreadStarted(); 88 GetContentClient()->utility()->UtilityThreadStarted();
89
90 process_control_.reset(new UtilityProcessControlImpl);
91 service_registry()->AddService(base::Bind(
92 &UtilityThreadImpl::BindProcessControlRequest, base::Unretained(this)));
93
88 GetContentClient()->utility()->RegisterMojoServices(service_registry()); 94 GetContentClient()->utility()->RegisterMojoServices(service_registry());
89 } 95 }
90 96
91 bool UtilityThreadImpl::OnControlMessageReceived(const IPC::Message& msg) { 97 bool UtilityThreadImpl::OnControlMessageReceived(const IPC::Message& msg) {
92 if (GetContentClient()->utility()->OnMessageReceived(msg)) 98 if (GetContentClient()->utility()->OnMessageReceived(msg))
93 return true; 99 return true;
94 100
95 bool handled = true; 101 bool handled = true;
96 IPC_BEGIN_MESSAGE_MAP(UtilityThreadImpl, msg) 102 IPC_BEGIN_MESSAGE_MAP(UtilityThreadImpl, msg)
97 IPC_MESSAGE_HANDLER(UtilityMsg_BatchMode_Started, OnBatchModeStarted) 103 IPC_MESSAGE_HANDLER(UtilityMsg_BatchMode_Started, OnBatchModeStarted)
(...skipping 30 matching lines...) Expand all
128 plugin_paths[i], &plugins, &plugin)) 134 plugin_paths[i], &plugins, &plugin))
129 Send(new UtilityHostMsg_LoadPluginFailed(i, plugin_paths[i])); 135 Send(new UtilityHostMsg_LoadPluginFailed(i, plugin_paths[i]));
130 else 136 else
131 Send(new UtilityHostMsg_LoadedPlugin(i, plugin)); 137 Send(new UtilityHostMsg_LoadedPlugin(i, plugin));
132 } 138 }
133 139
134 ReleaseProcessIfNeeded(); 140 ReleaseProcessIfNeeded();
135 } 141 }
136 #endif 142 #endif
137 143
144 void UtilityThreadImpl::BindProcessControlRequest(
145 mojo::InterfaceRequest<ProcessControl> request) {
146 DCHECK(process_control_);
147 process_control_bindings_.AddBinding(process_control_.get(), request.Pass());
148 }
149
138 } // namespace content 150 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698