Chromium Code Reviews| 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" |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 28 #include "services/service_manager/public/cpp/binder_registry.h" | 28 #include "services/service_manager/public/cpp/binder_registry.h" |
| 29 #include "services/service_manager/public/cpp/connector.h" | 29 #include "services/service_manager/public/cpp/connector.h" |
| 30 #include "services/ui/gpu/interfaces/gpu_service.mojom.h" | 30 #include "services/ui/gpu/interfaces/gpu_service.mojom.h" |
| 31 | 31 |
| 32 #if defined(USE_OZONE) | 32 #if defined(USE_OZONE) |
| 33 #include "ui/ozone/public/ozone_platform.h" | 33 #include "ui/ozone/public/ozone_platform.h" |
| 34 #endif | 34 #endif |
| 35 | 35 |
| 36 #if defined(OS_ANDROID) | 36 #if defined(OS_ANDROID) |
| 37 #include "media/base/android/media_drm_bridge_client.h" | 37 #include "media/base/android/media_drm_bridge_client.h" |
| 38 #include "media/mojo/clients/mojo_android_overlay.h" | |
| 38 #endif | 39 #endif |
| 39 | 40 |
| 40 namespace content { | 41 namespace content { |
| 41 namespace { | 42 namespace { |
| 42 | 43 |
| 43 ChildThreadImpl::Options GetOptions() { | 44 ChildThreadImpl::Options GetOptions() { |
| 44 ChildThreadImpl::Options::Builder builder; | 45 ChildThreadImpl::Options::Builder builder; |
| 45 | 46 |
| 46 #if defined(USE_OZONE) | 47 #if defined(USE_OZONE) |
| 47 IPC::MessageFilter* message_filter = | 48 IPC::MessageFilter* message_filter = |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 276 gpu_service_->InitializeWithHost( | 277 gpu_service_->InitializeWithHost( |
| 277 std::move(gpu_host), | 278 std::move(gpu_host), |
| 278 gpu::GpuProcessActivityFlags(std::move(activity_flags)), | 279 gpu::GpuProcessActivityFlags(std::move(activity_flags)), |
| 279 sync_point_manager, ChildProcess::current()->GetShutDownEvent()); | 280 sync_point_manager, ChildProcess::current()->GetShutDownEvent()); |
| 280 CHECK(gpu_service_->media_gpu_channel_manager()); | 281 CHECK(gpu_service_->media_gpu_channel_manager()); |
| 281 | 282 |
| 282 // Only set once per process instance. | 283 // Only set once per process instance. |
| 283 service_factory_.reset(new GpuServiceFactory( | 284 service_factory_.reset(new GpuServiceFactory( |
| 284 gpu_service_->media_gpu_channel_manager()->AsWeakPtr())); | 285 gpu_service_->media_gpu_channel_manager()->AsWeakPtr())); |
| 285 | 286 |
| 287 #if defined(OS_ANDROID) | |
| 288 gpu_service_->media_gpu_channel_manager()->SetOverlayFactory( | |
| 289 base::Bind(&GpuChildThread::OverlayFactory, base::Unretained(this))); | |
| 290 #endif | |
| 291 | |
| 286 if (GetContentClient()->gpu()) // NULL in tests. | 292 if (GetContentClient()->gpu()) // NULL in tests. |
| 287 GetContentClient()->gpu()->GpuServiceInitialized(gpu_preferences); | 293 GetContentClient()->gpu()->GpuServiceInitialized(gpu_preferences); |
| 288 | 294 |
| 289 release_pending_requests_closure_.Run(); | 295 release_pending_requests_closure_.Run(); |
| 290 } | 296 } |
| 291 | 297 |
| 292 void GpuChildThread::CreateFrameSinkManager( | 298 void GpuChildThread::CreateFrameSinkManager( |
| 293 cc::mojom::FrameSinkManagerRequest request, | 299 cc::mojom::FrameSinkManagerRequest request, |
| 294 cc::mojom::FrameSinkManagerClientPtr client) { | 300 cc::mojom::FrameSinkManagerClientPtr client) { |
| 295 NOTREACHED(); | 301 NOTREACHED(); |
| 296 } | 302 } |
| 297 | 303 |
| 298 void GpuChildThread::BindServiceFactoryRequest( | 304 void GpuChildThread::BindServiceFactoryRequest( |
| 299 const service_manager::BindSourceInfo& source_info, | 305 const service_manager::BindSourceInfo& source_info, |
| 300 service_manager::mojom::ServiceFactoryRequest request) { | 306 service_manager::mojom::ServiceFactoryRequest request) { |
| 301 DVLOG(1) << "GPU: Binding service_manager::mojom::ServiceFactoryRequest"; | 307 DVLOG(1) << "GPU: Binding service_manager::mojom::ServiceFactoryRequest"; |
| 302 DCHECK(service_factory_); | 308 DCHECK(service_factory_); |
| 303 service_factory_bindings_.AddBinding(service_factory_.get(), | 309 service_factory_bindings_.AddBinding(service_factory_.get(), |
| 304 std::move(request)); | 310 std::move(request)); |
| 305 } | 311 } |
| 306 | 312 |
| 313 #if defined(OS_ANDROID) | |
| 314 std::unique_ptr<media::AndroidOverlay> GpuChildThread::OverlayFactory( | |
| 315 const base::UnguessableToken& routing_token, | |
|
jbauman
2017/05/12 20:57:39
Could you make this static (so we don't need base:
liberato (no reviews please)
2017/05/12 21:10:26
Done.
| |
| 316 media::AndroidOverlayConfig config) { | |
| 317 media::mojom::AndroidOverlayProviderPtr provider_ptr; | |
| 318 ChildThread::Get()->GetConnector()->BindInterface( | |
| 319 content::mojom::kBrowserServiceName, &provider_ptr); | |
| 320 return base::MakeUnique<media::MojoAndroidOverlay>( | |
| 321 std::move(provider_ptr), std::move(config), routing_token); | |
| 322 } | |
| 323 #endif | |
| 324 | |
| 307 } // namespace content | 325 } // namespace content |
| OLD | NEW |