| 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" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 blink_platform_impl_.reset(new UtilityBlinkPlatformImpl); | 89 blink_platform_impl_.reset(new UtilityBlinkPlatformImpl); |
| 90 blink::Platform::initialize(blink_platform_impl_.get()); | 90 blink::Platform::initialize(blink_platform_impl_.get()); |
| 91 } | 91 } |
| 92 | 92 |
| 93 void UtilityThreadImpl::Init() { | 93 void UtilityThreadImpl::Init() { |
| 94 batch_mode_ = false; | 94 batch_mode_ = false; |
| 95 ChildProcess::current()->AddRefProcess(); | 95 ChildProcess::current()->AddRefProcess(); |
| 96 GetContentClient()->utility()->UtilityThreadStarted(); | 96 GetContentClient()->utility()->UtilityThreadStarted(); |
| 97 | 97 |
| 98 process_control_.reset(new UtilityProcessControlImpl); | 98 process_control_.reset(new UtilityProcessControlImpl); |
| 99 interface_registry()->AddInterface(base::Bind( | 99 GetInterfaceRegistry()->AddInterface(base::Bind( |
| 100 &UtilityThreadImpl::BindProcessControlRequest, base::Unretained(this))); | 100 &UtilityThreadImpl::BindProcessControlRequest, base::Unretained(this))); |
| 101 | 101 |
| 102 GetContentClient()->utility()->RegisterMojoInterfaces(interface_registry()); | 102 GetContentClient()->utility()->ExposeInterfacesToBrowser( |
| 103 GetInterfaceRegistry()); |
| 103 } | 104 } |
| 104 | 105 |
| 105 bool UtilityThreadImpl::OnControlMessageReceived(const IPC::Message& msg) { | 106 bool UtilityThreadImpl::OnControlMessageReceived(const IPC::Message& msg) { |
| 106 if (GetContentClient()->utility()->OnMessageReceived(msg)) | 107 if (GetContentClient()->utility()->OnMessageReceived(msg)) |
| 107 return true; | 108 return true; |
| 108 | 109 |
| 109 bool handled = true; | 110 bool handled = true; |
| 110 IPC_BEGIN_MESSAGE_MAP(UtilityThreadImpl, msg) | 111 IPC_BEGIN_MESSAGE_MAP(UtilityThreadImpl, msg) |
| 111 IPC_MESSAGE_HANDLER(UtilityMsg_BatchMode_Started, OnBatchModeStarted) | 112 IPC_MESSAGE_HANDLER(UtilityMsg_BatchMode_Started, OnBatchModeStarted) |
| 112 IPC_MESSAGE_HANDLER(UtilityMsg_BatchMode_Finished, OnBatchModeFinished) | 113 IPC_MESSAGE_HANDLER(UtilityMsg_BatchMode_Finished, OnBatchModeFinished) |
| (...skipping 12 matching lines...) Expand all Loading... |
| 125 } | 126 } |
| 126 | 127 |
| 127 void UtilityThreadImpl::BindProcessControlRequest( | 128 void UtilityThreadImpl::BindProcessControlRequest( |
| 128 mojo::InterfaceRequest<mojom::ProcessControl> request) { | 129 mojo::InterfaceRequest<mojom::ProcessControl> request) { |
| 129 DCHECK(process_control_); | 130 DCHECK(process_control_); |
| 130 process_control_bindings_.AddBinding(process_control_.get(), | 131 process_control_bindings_.AddBinding(process_control_.get(), |
| 131 std::move(request)); | 132 std::move(request)); |
| 132 } | 133 } |
| 133 | 134 |
| 134 } // namespace content | 135 } // namespace content |
| OLD | NEW |