| 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/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 Init(); | 42 Init(); |
| 43 } | 43 } |
| 44 | 44 |
| 45 UtilityThreadImpl::~UtilityThreadImpl() { | 45 UtilityThreadImpl::~UtilityThreadImpl() { |
| 46 } | 46 } |
| 47 | 47 |
| 48 void UtilityThreadImpl::Shutdown() { | 48 void UtilityThreadImpl::Shutdown() { |
| 49 ChildThread::Shutdown(); | 49 ChildThread::Shutdown(); |
| 50 | 50 |
| 51 if (!single_process_) | 51 if (!single_process_) |
| 52 WebKit::shutdown(); | 52 blink::shutdown(); |
| 53 } | 53 } |
| 54 | 54 |
| 55 bool UtilityThreadImpl::Send(IPC::Message* msg) { | 55 bool UtilityThreadImpl::Send(IPC::Message* msg) { |
| 56 return ChildThread::Send(msg); | 56 return ChildThread::Send(msg); |
| 57 } | 57 } |
| 58 | 58 |
| 59 void UtilityThreadImpl::ReleaseProcessIfNeeded() { | 59 void UtilityThreadImpl::ReleaseProcessIfNeeded() { |
| 60 if (batch_mode_) | 60 if (batch_mode_) |
| 61 return; | 61 return; |
| 62 | 62 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 85 | 85 |
| 86 void UtilityThreadImpl::Init() { | 86 void UtilityThreadImpl::Init() { |
| 87 batch_mode_ = false; | 87 batch_mode_ = false; |
| 88 ChildProcess::current()->AddRefProcess(); | 88 ChildProcess::current()->AddRefProcess(); |
| 89 if (!single_process_) { | 89 if (!single_process_) { |
| 90 // We can only initialize WebKit on one thread, and in single process mode | 90 // We can only initialize WebKit on one thread, and in single process mode |
| 91 // we run the utility thread on separate thread. This means that if any code | 91 // we run the utility thread on separate thread. This means that if any code |
| 92 // needs WebKit initialized in the utility process, they need to have | 92 // needs WebKit initialized in the utility process, they need to have |
| 93 // another path to support single process mode. | 93 // another path to support single process mode. |
| 94 webkit_platform_support_.reset(new WebKitPlatformSupportImpl); | 94 webkit_platform_support_.reset(new WebKitPlatformSupportImpl); |
| 95 WebKit::initialize(webkit_platform_support_.get()); | 95 blink::initialize(webkit_platform_support_.get()); |
| 96 } | 96 } |
| 97 GetContentClient()->utility()->UtilityThreadStarted(); | 97 GetContentClient()->utility()->UtilityThreadStarted(); |
| 98 } | 98 } |
| 99 | 99 |
| 100 bool UtilityThreadImpl::OnControlMessageReceived(const IPC::Message& msg) { | 100 bool UtilityThreadImpl::OnControlMessageReceived(const IPC::Message& msg) { |
| 101 if (GetContentClient()->utility()->OnMessageReceived(msg)) | 101 if (GetContentClient()->utility()->OnMessageReceived(msg)) |
| 102 return true; | 102 return true; |
| 103 | 103 |
| 104 bool handled = true; | 104 bool handled = true; |
| 105 IPC_BEGIN_MESSAGE_MAP(UtilityThreadImpl, msg) | 105 IPC_BEGIN_MESSAGE_MAP(UtilityThreadImpl, msg) |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 Send(new UtilityHostMsg_LoadPluginFailed(i, plugin_paths[i])); | 137 Send(new UtilityHostMsg_LoadPluginFailed(i, plugin_paths[i])); |
| 138 else | 138 else |
| 139 Send(new UtilityHostMsg_LoadedPlugin(i, plugin)); | 139 Send(new UtilityHostMsg_LoadedPlugin(i, plugin)); |
| 140 } | 140 } |
| 141 | 141 |
| 142 ReleaseProcessIfNeeded(); | 142 ReleaseProcessIfNeeded(); |
| 143 } | 143 } |
| 144 #endif | 144 #endif |
| 145 | 145 |
| 146 } // namespace content | 146 } // namespace content |
| OLD | NEW |