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" |
11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
12 #include "content/child/blink_platform_impl.h" | 12 #include "content/child/blink_platform_impl.h" |
13 #include "content/child/child_process.h" | 13 #include "content/child/child_process.h" |
14 #include "content/common/child_process_messages.h" | 14 #include "content/common/child_process_messages.h" |
15 #include "content/common/utility_messages.h" | 15 #include "content/common/utility_messages.h" |
16 #include "content/public/common/content_switches.h" | 16 #include "content/public/common/content_switches.h" |
17 #include "content/public/common/service_manager_connection.h" | 17 #include "content/public/common/service_manager_connection.h" |
18 #include "content/public/common/simple_connection_filter.h" | 18 #include "content/public/common/simple_connection_filter.h" |
19 #include "content/public/utility/content_utility_client.h" | 19 #include "content/public/utility/content_utility_client.h" |
20 #include "content/utility/utility_blink_platform_impl.h" | 20 #include "content/utility/utility_blink_platform_impl.h" |
21 #include "content/utility/utility_service_factory.h" | 21 #include "content/utility/utility_service_factory.h" |
22 #include "ipc/ipc_sync_channel.h" | 22 #include "ipc/ipc_sync_channel.h" |
23 #include "ppapi/features/features.h" | 23 #include "ppapi/features/features.h" |
24 #include "services/service_manager/public/cpp/binder_registry.h" | 24 #include "services/service_manager/public/cpp/binder_registry.h" |
| 25 #include "services/service_manager/public/cpp/interface_registry.h" |
| 26 #include "third_party/WebKit/public/platform/WebImageGenerator.h" |
25 #include "third_party/WebKit/public/web/WebKit.h" | 27 #include "third_party/WebKit/public/web/WebKit.h" |
| 28 #include "third_party/skia/include/core/SkGraphics.h" |
26 | 29 |
27 #if defined(OS_POSIX) && BUILDFLAG(ENABLE_PLUGINS) | 30 #if defined(OS_POSIX) && BUILDFLAG(ENABLE_PLUGINS) |
28 #include "base/files/file_path.h" | 31 #include "base/files/file_path.h" |
29 #include "content/common/plugin_list.h" | 32 #include "content/common/plugin_list.h" |
30 #endif | 33 #endif |
31 | 34 |
32 namespace content { | 35 namespace content { |
33 | 36 |
34 UtilityThreadImpl::UtilityThreadImpl() | 37 UtilityThreadImpl::UtilityThreadImpl() |
35 : ChildThreadImpl(ChildThreadImpl::Options::Builder() | 38 : ChildThreadImpl(ChildThreadImpl::Options::Builder() |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 // we run the utility thread on separate thread. This means that if any code | 77 // 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 | 78 // needs WebKit initialized in the utility process, they need to have |
76 // another path to support single process mode. | 79 // another path to support single process mode. |
77 return; | 80 return; |
78 } | 81 } |
79 | 82 |
80 blink_platform_impl_.reset(new UtilityBlinkPlatformImpl); | 83 blink_platform_impl_.reset(new UtilityBlinkPlatformImpl); |
81 blink::Platform::Initialize(blink_platform_impl_.get()); | 84 blink::Platform::Initialize(blink_platform_impl_.get()); |
82 } | 85 } |
83 | 86 |
| 87 void UtilityThreadImpl::EnsureReadyForSkia() { |
| 88 // Hook up blink's codecs so skia can call them. |
| 89 SkGraphics::SetImageGeneratorFromEncodedDataFactory( |
| 90 blink::WebImageGenerator::Create); |
| 91 } |
| 92 |
84 void UtilityThreadImpl::Init() { | 93 void UtilityThreadImpl::Init() { |
85 batch_mode_ = false; | 94 batch_mode_ = false; |
86 ChildProcess::current()->AddRefProcess(); | 95 ChildProcess::current()->AddRefProcess(); |
87 | 96 |
88 auto registry = base::MakeUnique<service_manager::BinderRegistry>(); | 97 auto registry = base::MakeUnique<service_manager::BinderRegistry>(); |
89 registry->AddInterface( | 98 registry->AddInterface( |
90 base::Bind(&UtilityThreadImpl::BindServiceFactoryRequest, | 99 base::Bind(&UtilityThreadImpl::BindServiceFactoryRequest, |
91 base::Unretained(this)), | 100 base::Unretained(this)), |
92 base::ThreadTaskRunnerHandle::Get()); | 101 base::ThreadTaskRunnerHandle::Get()); |
93 ChildThread::Get()->GetServiceManagerConnection()->AddConnectionFilter( | 102 ChildThread::Get()->GetServiceManagerConnection()->AddConnectionFilter( |
(...skipping 29 matching lines...) Expand all Loading... |
123 } | 132 } |
124 | 133 |
125 void UtilityThreadImpl::BindServiceFactoryRequest( | 134 void UtilityThreadImpl::BindServiceFactoryRequest( |
126 service_manager::mojom::ServiceFactoryRequest request) { | 135 service_manager::mojom::ServiceFactoryRequest request) { |
127 DCHECK(service_factory_); | 136 DCHECK(service_factory_); |
128 service_factory_bindings_.AddBinding(service_factory_.get(), | 137 service_factory_bindings_.AddBinding(service_factory_.get(), |
129 std::move(request)); | 138 std::move(request)); |
130 } | 139 } |
131 | 140 |
132 } // namespace content | 141 } // namespace content |
OLD | NEW |