OLD | NEW |
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 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
12 #include "content/child/blink_platform_impl.h" | 12 #include "content/child/blink_platform_impl.h" |
13 #include "content/child/child_process.h" | 13 #include "content/child/child_process.h" |
14 #include "content/common/child_process_messages.h" | 14 #include "content/common/child_process_messages.h" |
15 #include "content/common/utility_messages.h" | 15 #include "content/common/utility_messages.h" |
16 #include "content/public/common/content_switches.h" | 16 #include "content/public/common/content_switches.h" |
17 #include "content/public/utility/content_utility_client.h" | 17 #include "content/public/utility/content_utility_client.h" |
18 #include "content/utility/utility_blink_platform_impl.h" | 18 #include "content/utility/utility_blink_platform_impl.h" |
19 #include "content/utility/utility_process_control_impl.h" | 19 #include "content/utility/utility_process_control_impl.h" |
20 #include "ipc/ipc_sync_channel.h" | 20 #include "ipc/ipc_sync_channel.h" |
| 21 #include "services/shell/public/cpp/interface_registry.h" |
21 #include "third_party/WebKit/public/web/WebKit.h" | 22 #include "third_party/WebKit/public/web/WebKit.h" |
22 | 23 |
23 #if defined(OS_POSIX) && defined(ENABLE_PLUGINS) | 24 #if defined(OS_POSIX) && defined(ENABLE_PLUGINS) |
24 #include "base/files/file_path.h" | 25 #include "base/files/file_path.h" |
25 #include "content/common/plugin_list.h" | 26 #include "content/common/plugin_list.h" |
26 #endif | 27 #endif |
27 | 28 |
28 namespace content { | 29 namespace content { |
29 | 30 |
30 namespace { | 31 namespace { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 blink_platform_impl_.reset(new UtilityBlinkPlatformImpl); | 89 blink_platform_impl_.reset(new UtilityBlinkPlatformImpl); |
89 blink::Platform::initialize(blink_platform_impl_.get()); | 90 blink::Platform::initialize(blink_platform_impl_.get()); |
90 } | 91 } |
91 | 92 |
92 void UtilityThreadImpl::Init() { | 93 void UtilityThreadImpl::Init() { |
93 batch_mode_ = false; | 94 batch_mode_ = false; |
94 ChildProcess::current()->AddRefProcess(); | 95 ChildProcess::current()->AddRefProcess(); |
95 GetContentClient()->utility()->UtilityThreadStarted(); | 96 GetContentClient()->utility()->UtilityThreadStarted(); |
96 | 97 |
97 process_control_.reset(new UtilityProcessControlImpl); | 98 process_control_.reset(new UtilityProcessControlImpl); |
98 service_registry()->AddService(base::Bind( | 99 interface_registry()->AddInterface(base::Bind( |
99 &UtilityThreadImpl::BindProcessControlRequest, base::Unretained(this))); | 100 &UtilityThreadImpl::BindProcessControlRequest, base::Unretained(this))); |
100 | 101 |
101 GetContentClient()->utility()->RegisterMojoServices(service_registry()); | 102 GetContentClient()->utility()->RegisterMojoInterfaces(interface_registry()); |
102 } | 103 } |
103 | 104 |
104 bool UtilityThreadImpl::OnControlMessageReceived(const IPC::Message& msg) { | 105 bool UtilityThreadImpl::OnControlMessageReceived(const IPC::Message& msg) { |
105 if (GetContentClient()->utility()->OnMessageReceived(msg)) | 106 if (GetContentClient()->utility()->OnMessageReceived(msg)) |
106 return true; | 107 return true; |
107 | 108 |
108 bool handled = true; | 109 bool handled = true; |
109 IPC_BEGIN_MESSAGE_MAP(UtilityThreadImpl, msg) | 110 IPC_BEGIN_MESSAGE_MAP(UtilityThreadImpl, msg) |
110 IPC_MESSAGE_HANDLER(UtilityMsg_BatchMode_Started, OnBatchModeStarted) | 111 IPC_MESSAGE_HANDLER(UtilityMsg_BatchMode_Started, OnBatchModeStarted) |
111 IPC_MESSAGE_HANDLER(UtilityMsg_BatchMode_Finished, OnBatchModeFinished) | 112 IPC_MESSAGE_HANDLER(UtilityMsg_BatchMode_Finished, OnBatchModeFinished) |
(...skipping 12 matching lines...) Expand all Loading... |
124 } | 125 } |
125 | 126 |
126 void UtilityThreadImpl::BindProcessControlRequest( | 127 void UtilityThreadImpl::BindProcessControlRequest( |
127 mojo::InterfaceRequest<mojom::ProcessControl> request) { | 128 mojo::InterfaceRequest<mojom::ProcessControl> request) { |
128 DCHECK(process_control_); | 129 DCHECK(process_control_); |
129 process_control_bindings_.AddBinding(process_control_.get(), | 130 process_control_bindings_.AddBinding(process_control_.get(), |
130 std::move(request)); | 131 std::move(request)); |
131 } | 132 } |
132 | 133 |
133 } // namespace content | 134 } // namespace content |
OLD | NEW |