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/gpu/gpu_child_thread.h" | 5 #include "content/gpu/gpu_child_thread.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/callback_helpers.h" | 11 #include "base/callback_helpers.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
14 #include "base/sequenced_task_runner.h" | 14 #include "base/sequenced_task_runner.h" |
15 #include "base/threading/thread_checker.h" | 15 #include "base/threading/thread_checker.h" |
16 #include "build/build_config.h" | 16 #include "build/build_config.h" |
17 #include "content/child/child_process.h" | 17 #include "content/child/child_process.h" |
18 #include "content/common/field_trial_recorder.mojom.h" | 18 #include "content/common/field_trial_recorder.mojom.h" |
19 #include "content/gpu/gpu_service_factory.h" | 19 #include "content/gpu/gpu_service_factory.h" |
20 #include "content/public/common/connection_filter.h" | 20 #include "content/public/common/connection_filter.h" |
21 #include "content/public/common/content_client.h" | 21 #include "content/public/common/content_client.h" |
22 #include "content/public/common/content_switches.h" | 22 #include "content/public/common/content_switches.h" |
23 #include "content/public/common/service_manager_connection.h" | 23 #include "content/public/common/service_manager_connection.h" |
24 #include "content/public/common/service_names.mojom.h" | 24 #include "content/public/common/service_names.mojom.h" |
25 #include "content/public/gpu/content_gpu_client.h" | 25 #include "content/public/gpu/content_gpu_client.h" |
26 #include "gpu/command_buffer/common/activity_flags.h" | 26 #include "gpu/command_buffer/common/activity_flags.h" |
27 #include "gpu/ipc/service/gpu_watchdog_thread.h" | 27 #include "gpu/ipc/service/gpu_watchdog_thread.h" |
28 #include "ipc/ipc_sync_message_filter.h" | 28 #include "ipc/ipc_sync_message_filter.h" |
29 #include "media/gpu/ipc/service/media_gpu_channel_manager.h" | 29 #include "media/gpu/ipc/service/media_gpu_channel_manager.h" |
| 30 #include "media/gpu/mojo/service/gpu_jpeg_decode_accelerator.h" |
30 #include "services/service_manager/public/cpp/binder_registry.h" | 31 #include "services/service_manager/public/cpp/binder_registry.h" |
31 #include "services/service_manager/public/cpp/connector.h" | 32 #include "services/service_manager/public/cpp/connector.h" |
32 #include "services/ui/gpu/interfaces/gpu_service.mojom.h" | 33 #include "services/ui/gpu/interfaces/gpu_service.mojom.h" |
33 | 34 |
34 #if defined(USE_OZONE) | 35 #if defined(USE_OZONE) |
35 #include "ui/ozone/public/ozone_platform.h" | 36 #include "ui/ozone/public/ozone_platform.h" |
36 #endif | 37 #endif |
37 | 38 |
38 #if defined(OS_ANDROID) | 39 #if defined(OS_ANDROID) |
39 #include "media/base/android/media_drm_bridge_client.h" | 40 #include "media/base/android/media_drm_bridge_client.h" |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 GetContentClient()->GetMediaDrmBridgeClient()); | 202 GetContentClient()->GetMediaDrmBridgeClient()); |
202 #endif | 203 #endif |
203 AssociatedInterfaceRegistry* associated_registry = &associated_interfaces_; | 204 AssociatedInterfaceRegistry* associated_registry = &associated_interfaces_; |
204 associated_registry->AddInterface(base::Bind( | 205 associated_registry->AddInterface(base::Bind( |
205 &GpuChildThread::CreateGpuMainService, base::Unretained(this))); | 206 &GpuChildThread::CreateGpuMainService, base::Unretained(this))); |
206 | 207 |
207 auto registry = base::MakeUnique<service_manager::BinderRegistry>(); | 208 auto registry = base::MakeUnique<service_manager::BinderRegistry>(); |
208 registry->AddInterface(base::Bind(&GpuChildThread::BindServiceFactoryRequest, | 209 registry->AddInterface(base::Bind(&GpuChildThread::BindServiceFactoryRequest, |
209 weak_factory_.GetWeakPtr()), | 210 weak_factory_.GetWeakPtr()), |
210 base::ThreadTaskRunnerHandle::Get()); | 211 base::ThreadTaskRunnerHandle::Get()); |
| 212 |
| 213 registry->AddInterface( |
| 214 base::Bind(&media::GpuJpegDecodeAccelerator::Create, |
| 215 make_scoped_refptr(ChildProcess::current()->io_task_runner())), |
| 216 base::ThreadTaskRunnerHandle::Get()); |
| 217 |
211 if (GetContentClient()->gpu()) // NULL in tests. | 218 if (GetContentClient()->gpu()) // NULL in tests. |
212 GetContentClient()->gpu()->Initialize(this, registry.get()); | 219 GetContentClient()->gpu()->Initialize(this, registry.get()); |
213 | 220 |
214 std::unique_ptr<QueueingConnectionFilter> filter = | 221 std::unique_ptr<QueueingConnectionFilter> filter = |
215 base::MakeUnique<QueueingConnectionFilter>(GetIOTaskRunner(), | 222 base::MakeUnique<QueueingConnectionFilter>(GetIOTaskRunner(), |
216 std::move(registry)); | 223 std::move(registry)); |
217 release_pending_requests_closure_ = filter->GetReleaseCallback(); | 224 release_pending_requests_closure_ = filter->GetReleaseCallback(); |
218 GetServiceManagerConnection()->AddConnectionFilter(std::move(filter)); | 225 GetServiceManagerConnection()->AddConnectionFilter(std::move(filter)); |
219 | 226 |
220 StartServiceManagerConnection(); | 227 StartServiceManagerConnection(); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 media::AndroidOverlayConfig config) { | 326 media::AndroidOverlayConfig config) { |
320 media::mojom::AndroidOverlayProviderPtr provider_ptr; | 327 media::mojom::AndroidOverlayProviderPtr provider_ptr; |
321 ChildThread::Get()->GetConnector()->BindInterface( | 328 ChildThread::Get()->GetConnector()->BindInterface( |
322 content::mojom::kBrowserServiceName, &provider_ptr); | 329 content::mojom::kBrowserServiceName, &provider_ptr); |
323 return base::MakeUnique<media::MojoAndroidOverlay>( | 330 return base::MakeUnique<media::MojoAndroidOverlay>( |
324 std::move(provider_ptr), std::move(config), routing_token); | 331 std::move(provider_ptr), std::move(config), routing_token); |
325 } | 332 } |
326 #endif | 333 #endif |
327 | 334 |
328 } // namespace content | 335 } // namespace content |
OLD | NEW |