| 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 27 matching lines...) Expand all Loading... |
| 38 #include "ui/gl/gl_implementation.h" | 38 #include "ui/gl/gl_implementation.h" |
| 39 #include "ui/gl/gl_switches.h" | 39 #include "ui/gl/gl_switches.h" |
| 40 #include "ui/gl/gpu_switching_manager.h" | 40 #include "ui/gl/gpu_switching_manager.h" |
| 41 #include "url/gurl.h" | 41 #include "url/gurl.h" |
| 42 | 42 |
| 43 #if defined(USE_OZONE) | 43 #if defined(USE_OZONE) |
| 44 #include "ui/ozone/public/gpu_platform_support.h" | 44 #include "ui/ozone/public/gpu_platform_support.h" |
| 45 #include "ui/ozone/public/ozone_platform.h" | 45 #include "ui/ozone/public/ozone_platform.h" |
| 46 #endif | 46 #endif |
| 47 | 47 |
| 48 #if defined(OS_ANDROID) |
| 49 #include "content/common/gpu/media/avda_surface_tracker.h" |
| 50 #endif |
| 51 |
| 48 namespace content { | 52 namespace content { |
| 49 namespace { | 53 namespace { |
| 50 | 54 |
| 51 base::LazyInstance<base::ThreadLocalPointer<GpuChildThread>> g_lazy_tls = | 55 base::LazyInstance<base::ThreadLocalPointer<GpuChildThread>> g_lazy_tls = |
| 52 LAZY_INSTANCE_INITIALIZER; | 56 LAZY_INSTANCE_INITIALIZER; |
| 53 | 57 |
| 54 static base::LazyInstance<scoped_refptr<ThreadSafeSender> > | 58 static base::LazyInstance<scoped_refptr<ThreadSafeSender> > |
| 55 g_thread_safe_sender = LAZY_INSTANCE_INITIALIZER; | 59 g_thread_safe_sender = LAZY_INSTANCE_INITIALIZER; |
| 56 | 60 |
| 57 bool GpuProcessLogMessageHandler(int severity, | 61 bool GpuProcessLogMessageHandler(int severity, |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 #if defined(OS_MACOSX) | 278 #if defined(OS_MACOSX) |
| 275 IPC_MESSAGE_HANDLER(AcceleratedSurfaceMsg_BufferPresented, | 279 IPC_MESSAGE_HANDLER(AcceleratedSurfaceMsg_BufferPresented, |
| 276 OnBufferPresented) | 280 OnBufferPresented) |
| 277 #endif | 281 #endif |
| 278 IPC_MESSAGE_HANDLER(GpuMsg_EstablishChannel, OnEstablishChannel) | 282 IPC_MESSAGE_HANDLER(GpuMsg_EstablishChannel, OnEstablishChannel) |
| 279 IPC_MESSAGE_HANDLER(GpuMsg_CloseChannel, OnCloseChannel) | 283 IPC_MESSAGE_HANDLER(GpuMsg_CloseChannel, OnCloseChannel) |
| 280 IPC_MESSAGE_HANDLER(GpuMsg_DestroyGpuMemoryBuffer, OnDestroyGpuMemoryBuffer) | 284 IPC_MESSAGE_HANDLER(GpuMsg_DestroyGpuMemoryBuffer, OnDestroyGpuMemoryBuffer) |
| 281 IPC_MESSAGE_HANDLER(GpuMsg_LoadedShader, OnLoadedShader) | 285 IPC_MESSAGE_HANDLER(GpuMsg_LoadedShader, OnLoadedShader) |
| 282 #if defined(OS_ANDROID) | 286 #if defined(OS_ANDROID) |
| 283 IPC_MESSAGE_HANDLER(GpuMsg_WakeUpGpu, OnWakeUpGpu); | 287 IPC_MESSAGE_HANDLER(GpuMsg_WakeUpGpu, OnWakeUpGpu); |
| 288 IPC_MESSAGE_HANDLER(GpuMsg_DestroyingVideoSurface, |
| 289 OnDestroyingVideoSurface); |
| 284 #endif | 290 #endif |
| 285 IPC_MESSAGE_UNHANDLED(handled = false) | 291 IPC_MESSAGE_UNHANDLED(handled = false) |
| 286 IPC_END_MESSAGE_MAP() | 292 IPC_END_MESSAGE_MAP() |
| 287 if (handled) | 293 if (handled) |
| 288 return true; | 294 return true; |
| 289 | 295 |
| 290 return false; | 296 return false; |
| 291 } | 297 } |
| 292 | 298 |
| 293 void GpuChildThread::SetActiveURL(const GURL& url) { | 299 void GpuChildThread::SetActiveURL(const GURL& url) { |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 const gpu::SyncToken& sync_token) { | 558 const gpu::SyncToken& sync_token) { |
| 553 if (gpu_channel_manager_) | 559 if (gpu_channel_manager_) |
| 554 gpu_channel_manager_->DestroyGpuMemoryBuffer(id, client_id, sync_token); | 560 gpu_channel_manager_->DestroyGpuMemoryBuffer(id, client_id, sync_token); |
| 555 } | 561 } |
| 556 | 562 |
| 557 #if defined(OS_ANDROID) | 563 #if defined(OS_ANDROID) |
| 558 void GpuChildThread::OnWakeUpGpu() { | 564 void GpuChildThread::OnWakeUpGpu() { |
| 559 if (gpu_channel_manager_) | 565 if (gpu_channel_manager_) |
| 560 gpu_channel_manager_->WakeUpGpu(); | 566 gpu_channel_manager_->WakeUpGpu(); |
| 561 } | 567 } |
| 568 |
| 569 void GpuChildThread::OnDestroyingVideoSurface(int surface_id) { |
| 570 AVDASurfaceTracker::GetInstance()->NotifyDestroyingSurface(surface_id); |
| 571 Send(new GpuHostMsg_DestroyingVideoSurfaceAck(surface_id)); |
| 572 } |
| 562 #endif | 573 #endif |
| 563 | 574 |
| 564 void GpuChildThread::OnLoseAllContexts() { | 575 void GpuChildThread::OnLoseAllContexts() { |
| 565 if (gpu_channel_manager_) { | 576 if (gpu_channel_manager_) { |
| 566 gpu_channel_manager_->DestroyAllChannels(); | 577 gpu_channel_manager_->DestroyAllChannels(); |
| 567 media_service_->DestroyAllChannels(); | 578 media_service_->DestroyAllChannels(); |
| 568 } | 579 } |
| 569 } | 580 } |
| 570 | 581 |
| 571 void GpuChildThread::BindProcessControlRequest( | 582 void GpuChildThread::BindProcessControlRequest( |
| 572 mojo::InterfaceRequest<mojom::ProcessControl> request) { | 583 mojo::InterfaceRequest<mojom::ProcessControl> request) { |
| 573 DVLOG(1) << "GPU: Binding ProcessControl request"; | 584 DVLOG(1) << "GPU: Binding ProcessControl request"; |
| 574 DCHECK(process_control_); | 585 DCHECK(process_control_); |
| 575 process_control_bindings_.AddBinding(process_control_.get(), | 586 process_control_bindings_.AddBinding(process_control_.get(), |
| 576 std::move(request)); | 587 std::move(request)); |
| 577 } | 588 } |
| 578 | 589 |
| 579 } // namespace content | 590 } // namespace content |
| OLD | NEW |