| 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 | 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" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 ChildProcess::current()->AddRefProcess(); | 91 ChildProcess::current()->AddRefProcess(); |
| 92 if (!single_process_) { | 92 if (!single_process_) { |
| 93 // We can only initialize WebKit on one thread, and in single process mode | 93 // We can only initialize WebKit on one thread, and in single process mode |
| 94 // we run the utility thread on separate thread. This means that if any code | 94 // we run the utility thread on separate thread. This means that if any code |
| 95 // needs WebKit initialized in the utility process, they need to have | 95 // needs WebKit initialized in the utility process, they need to have |
| 96 // another path to support single process mode. | 96 // another path to support single process mode. |
| 97 blink_platform_impl_.reset(new BlinkPlatformImpl); | 97 blink_platform_impl_.reset(new BlinkPlatformImpl); |
| 98 blink::initialize(blink_platform_impl_.get()); | 98 blink::initialize(blink_platform_impl_.get()); |
| 99 } | 99 } |
| 100 GetContentClient()->utility()->UtilityThreadStarted(); | 100 GetContentClient()->utility()->UtilityThreadStarted(); |
| 101 GetContentClient()->utility()->RegisterMojoServices(service_registry()); |
| 101 } | 102 } |
| 102 | 103 |
| 103 bool UtilityThreadImpl::OnControlMessageReceived(const IPC::Message& msg) { | 104 bool UtilityThreadImpl::OnControlMessageReceived(const IPC::Message& msg) { |
| 104 if (GetContentClient()->utility()->OnMessageReceived(msg)) | 105 if (GetContentClient()->utility()->OnMessageReceived(msg)) |
| 105 return true; | 106 return true; |
| 106 | 107 |
| 107 bool handled = true; | 108 bool handled = true; |
| 108 IPC_BEGIN_MESSAGE_MAP(UtilityThreadImpl, msg) | 109 IPC_BEGIN_MESSAGE_MAP(UtilityThreadImpl, msg) |
| 109 IPC_MESSAGE_HANDLER(UtilityMsg_BatchMode_Started, OnBatchModeStarted) | 110 IPC_MESSAGE_HANDLER(UtilityMsg_BatchMode_Started, OnBatchModeStarted) |
| 110 IPC_MESSAGE_HANDLER(UtilityMsg_BatchMode_Finished, OnBatchModeFinished) | 111 IPC_MESSAGE_HANDLER(UtilityMsg_BatchMode_Finished, OnBatchModeFinished) |
| (...skipping 30 matching lines...) Expand all Loading... |
| 141 Send(new UtilityHostMsg_LoadPluginFailed(i, plugin_paths[i])); | 142 Send(new UtilityHostMsg_LoadPluginFailed(i, plugin_paths[i])); |
| 142 else | 143 else |
| 143 Send(new UtilityHostMsg_LoadedPlugin(i, plugin)); | 144 Send(new UtilityHostMsg_LoadedPlugin(i, plugin)); |
| 144 } | 145 } |
| 145 | 146 |
| 146 ReleaseProcessIfNeeded(); | 147 ReleaseProcessIfNeeded(); |
| 147 } | 148 } |
| 148 #endif | 149 #endif |
| 149 | 150 |
| 150 } // namespace content | 151 } // namespace content |
| OLD | NEW |