| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 Init(); | 50 Init(); |
| 51 } | 51 } |
| 52 | 52 |
| 53 UtilityThreadImpl::~UtilityThreadImpl() { | 53 UtilityThreadImpl::~UtilityThreadImpl() { |
| 54 } | 54 } |
| 55 | 55 |
| 56 void UtilityThreadImpl::Shutdown() { | 56 void UtilityThreadImpl::Shutdown() { |
| 57 ChildThreadImpl::Shutdown(); | 57 ChildThreadImpl::Shutdown(); |
| 58 | 58 |
| 59 if (blink_platform_impl_) | 59 if (blink_platform_impl_) |
| 60 blink::shutdownWithoutV8(); | 60 blink::Platform::shutdown(); |
| 61 } | 61 } |
| 62 | 62 |
| 63 void UtilityThreadImpl::ReleaseProcessIfNeeded() { | 63 void UtilityThreadImpl::ReleaseProcessIfNeeded() { |
| 64 if (batch_mode_) | 64 if (batch_mode_) |
| 65 return; | 65 return; |
| 66 | 66 |
| 67 if (IsInBrowserProcess()) { | 67 if (IsInBrowserProcess()) { |
| 68 // Close the channel to cause UtilityProcessHostImpl to be deleted. We need | 68 // Close the channel to cause UtilityProcessHostImpl to be deleted. We need |
| 69 // to take a different code path than the multi-process case because that | 69 // to take a different code path than the multi-process case because that |
| 70 // depends on the child process going away to close the channel, but that | 70 // depends on the child process going away to close the channel, but that |
| 71 // can't happen when we're in single process mode. | 71 // can't happen when we're in single process mode. |
| 72 channel()->Close(); | 72 channel()->Close(); |
| 73 } else { | 73 } else { |
| 74 ChildProcess::current()->ReleaseProcess(); | 74 ChildProcess::current()->ReleaseProcess(); |
| 75 } | 75 } |
| 76 } | 76 } |
| 77 | 77 |
| 78 void UtilityThreadImpl::EnsureBlinkInitialized() { | 78 void UtilityThreadImpl::EnsureBlinkInitialized() { |
| 79 if (blink_platform_impl_ || IsInBrowserProcess()) { | 79 if (blink_platform_impl_ || IsInBrowserProcess()) { |
| 80 // We can only initialize WebKit on one thread, and in single process mode | 80 // 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 | 81 // 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 | 82 // needs WebKit initialized in the utility process, they need to have |
| 83 // another path to support single process mode. | 83 // another path to support single process mode. |
| 84 return; | 84 return; |
| 85 } | 85 } |
| 86 | 86 |
| 87 blink_platform_impl_.reset(new UtilityBlinkPlatformImpl); | 87 blink_platform_impl_.reset(new UtilityBlinkPlatformImpl); |
| 88 blink::initializeWithoutV8(blink_platform_impl_.get()); | 88 blink::Platform::initialize(blink_platform_impl_.get()); |
| 89 } | 89 } |
| 90 | 90 |
| 91 void UtilityThreadImpl::Init() { | 91 void UtilityThreadImpl::Init() { |
| 92 batch_mode_ = false; | 92 batch_mode_ = false; |
| 93 ChildProcess::current()->AddRefProcess(); | 93 ChildProcess::current()->AddRefProcess(); |
| 94 GetContentClient()->utility()->UtilityThreadStarted(); | 94 GetContentClient()->utility()->UtilityThreadStarted(); |
| 95 | 95 |
| 96 process_control_.reset(new UtilityProcessControlImpl); | 96 process_control_.reset(new UtilityProcessControlImpl); |
| 97 service_registry()->AddService(base::Bind( | 97 service_registry()->AddService(base::Bind( |
| 98 &UtilityThreadImpl::BindProcessControlRequest, base::Unretained(this))); | 98 &UtilityThreadImpl::BindProcessControlRequest, base::Unretained(this))); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 #endif | 148 #endif |
| 149 | 149 |
| 150 void UtilityThreadImpl::BindProcessControlRequest( | 150 void UtilityThreadImpl::BindProcessControlRequest( |
| 151 mojo::InterfaceRequest<ProcessControl> request) { | 151 mojo::InterfaceRequest<ProcessControl> request) { |
| 152 DCHECK(process_control_); | 152 DCHECK(process_control_); |
| 153 process_control_bindings_.AddBinding(process_control_.get(), | 153 process_control_bindings_.AddBinding(process_control_.get(), |
| 154 std::move(request)); | 154 std::move(request)); |
| 155 } | 155 } |
| 156 | 156 |
| 157 } // namespace content | 157 } // namespace content |
| OLD | NEW |