| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 // Close the channel to cause UtilityProcessHostImpl to be deleted. We need | 61 // Close the channel to cause UtilityProcessHostImpl to be deleted. We need |
| 62 // to take a different code path than the multi-process case because that | 62 // to take a different code path than the multi-process case because that |
| 63 // depends on the child process going away to close the channel, but that | 63 // depends on the child process going away to close the channel, but that |
| 64 // can't happen when we're in single process mode. | 64 // can't happen when we're in single process mode. |
| 65 channel()->Close(); | 65 channel()->Close(); |
| 66 } else { | 66 } else { |
| 67 ChildProcess::current()->ReleaseProcess(); | 67 ChildProcess::current()->ReleaseProcess(); |
| 68 } | 68 } |
| 69 } | 69 } |
| 70 | 70 |
| 71 scoped_refptr<base::SingleThreadTaskRunner> |
| 72 UtilityThreadImpl::GetIOTaskRunner() { |
| 73 return ChildProcess::current()->io_task_runner(); |
| 74 } |
| 75 |
| 71 void UtilityThreadImpl::EnsureBlinkInitialized() { | 76 void UtilityThreadImpl::EnsureBlinkInitialized() { |
| 72 if (blink_platform_impl_ || IsInBrowserProcess()) { | 77 if (blink_platform_impl_ || IsInBrowserProcess()) { |
| 73 // We can only initialize WebKit on one thread, and in single process mode | 78 // We can only initialize WebKit on one thread, and in single process mode |
| 74 // we run the utility thread on separate thread. This means that if any code | 79 // we run the utility thread on separate thread. This means that if any code |
| 75 // needs WebKit initialized in the utility process, they need to have | 80 // needs WebKit initialized in the utility process, they need to have |
| 76 // another path to support single process mode. | 81 // another path to support single process mode. |
| 77 return; | 82 return; |
| 78 } | 83 } |
| 79 | 84 |
| 80 blink_platform_impl_.reset(new UtilityBlinkPlatformImpl); | 85 blink_platform_impl_.reset(new UtilityBlinkPlatformImpl); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 } | 132 } |
| 128 | 133 |
| 129 void UtilityThreadImpl::BindServiceFactoryRequest( | 134 void UtilityThreadImpl::BindServiceFactoryRequest( |
| 130 service_manager::mojom::ServiceFactoryRequest request) { | 135 service_manager::mojom::ServiceFactoryRequest request) { |
| 131 DCHECK(service_factory_); | 136 DCHECK(service_factory_); |
| 132 service_factory_bindings_.AddBinding(service_factory_.get(), | 137 service_factory_bindings_.AddBinding(service_factory_.get(), |
| 133 std::move(request)); | 138 std::move(request)); |
| 134 } | 139 } |
| 135 | 140 |
| 136 } // namespace content | 141 } // namespace content |
| OLD | NEW |