| 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 30 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 #if defined(USE_OZONE) | 42 #if defined(USE_OZONE) |
| 43 #include "ui/ozone/public/gpu_platform_support.h" | 43 #include "ui/ozone/public/gpu_platform_support.h" |
| 44 #include "ui/ozone/public/ozone_platform.h" | 44 #include "ui/ozone/public/ozone_platform.h" |
| 45 #endif | 45 #endif |
| 46 | 46 |
| 47 #if defined(ENABLE_VULKAN) | 47 #if defined(ENABLE_VULKAN) |
| 48 #include "gpu/vulkan/vulkan_surface.h" | 48 #include "gpu/vulkan/vulkan_surface.h" |
| 49 #endif | 49 #endif |
| 50 | 50 |
| 51 #if defined(OS_ANDROID) |
| 52 #include "content/common/gpu/media/avda_surface_tracker.h" |
| 53 #endif |
| 54 |
| 51 namespace content { | 55 namespace content { |
| 52 namespace { | 56 namespace { |
| 53 | 57 |
| 54 base::LazyInstance<base::ThreadLocalPointer<GpuChildThread>> g_lazy_tls = | 58 base::LazyInstance<base::ThreadLocalPointer<GpuChildThread>> g_lazy_tls = |
| 55 LAZY_INSTANCE_INITIALIZER; | 59 LAZY_INSTANCE_INITIALIZER; |
| 56 | 60 |
| 57 static base::LazyInstance<scoped_refptr<ThreadSafeSender> > | 61 static base::LazyInstance<scoped_refptr<ThreadSafeSender> > |
| 58 g_thread_safe_sender = LAZY_INSTANCE_INITIALIZER; | 62 g_thread_safe_sender = LAZY_INSTANCE_INITIALIZER; |
| 59 | 63 |
| 60 bool GpuProcessLogMessageHandler(int severity, | 64 bool GpuProcessLogMessageHandler(int severity, |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 IPC_MESSAGE_HANDLER(AcceleratedSurfaceMsg_BufferPresented, | 291 IPC_MESSAGE_HANDLER(AcceleratedSurfaceMsg_BufferPresented, |
| 288 OnBufferPresented) | 292 OnBufferPresented) |
| 289 #endif | 293 #endif |
| 290 IPC_MESSAGE_HANDLER(GpuMsg_EstablishChannel, OnEstablishChannel) | 294 IPC_MESSAGE_HANDLER(GpuMsg_EstablishChannel, OnEstablishChannel) |
| 291 IPC_MESSAGE_HANDLER(GpuMsg_CloseChannel, OnCloseChannel) | 295 IPC_MESSAGE_HANDLER(GpuMsg_CloseChannel, OnCloseChannel) |
| 292 IPC_MESSAGE_HANDLER(GpuMsg_DestroyGpuMemoryBuffer, OnDestroyGpuMemoryBuffer) | 296 IPC_MESSAGE_HANDLER(GpuMsg_DestroyGpuMemoryBuffer, OnDestroyGpuMemoryBuffer) |
| 293 IPC_MESSAGE_HANDLER(GpuMsg_LoadedShader, OnLoadedShader) | 297 IPC_MESSAGE_HANDLER(GpuMsg_LoadedShader, OnLoadedShader) |
| 294 IPC_MESSAGE_HANDLER(GpuMsg_UpdateValueState, OnUpdateValueState) | 298 IPC_MESSAGE_HANDLER(GpuMsg_UpdateValueState, OnUpdateValueState) |
| 295 #if defined(OS_ANDROID) | 299 #if defined(OS_ANDROID) |
| 296 IPC_MESSAGE_HANDLER(GpuMsg_WakeUpGpu, OnWakeUpGpu); | 300 IPC_MESSAGE_HANDLER(GpuMsg_WakeUpGpu, OnWakeUpGpu); |
| 301 IPC_MESSAGE_HANDLER(GpuMsg_DestroyingVideoSurface, |
| 302 OnDestroyingVideoSurface); |
| 297 #endif | 303 #endif |
| 298 IPC_MESSAGE_UNHANDLED(handled = false) | 304 IPC_MESSAGE_UNHANDLED(handled = false) |
| 299 IPC_END_MESSAGE_MAP() | 305 IPC_END_MESSAGE_MAP() |
| 300 if (handled) | 306 if (handled) |
| 301 return true; | 307 return true; |
| 302 | 308 |
| 303 return false; | 309 return false; |
| 304 } | 310 } |
| 305 | 311 |
| 306 void GpuChildThread::SetActiveURL(const GURL& url) { | 312 void GpuChildThread::SetActiveURL(const GURL& url) { |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 570 const gpu::ValueState& state) { | 576 const gpu::ValueState& state) { |
| 571 if (gpu_channel_manager_) | 577 if (gpu_channel_manager_) |
| 572 gpu_channel_manager_->UpdateValueState(client_id, target, state); | 578 gpu_channel_manager_->UpdateValueState(client_id, target, state); |
| 573 } | 579 } |
| 574 | 580 |
| 575 #if defined(OS_ANDROID) | 581 #if defined(OS_ANDROID) |
| 576 void GpuChildThread::OnWakeUpGpu() { | 582 void GpuChildThread::OnWakeUpGpu() { |
| 577 if (gpu_channel_manager_) | 583 if (gpu_channel_manager_) |
| 578 gpu_channel_manager_->WakeUpGpu(); | 584 gpu_channel_manager_->WakeUpGpu(); |
| 579 } | 585 } |
| 586 |
| 587 void GpuChildThread::OnDestroyingVideoSurface(int surface_id) { |
| 588 AVDASurfaceTracker::GetInstance()->NotifyDestroyingSurface(surface_id); |
| 589 Send(new GpuHostMsg_DestroyingVideoSurfaceHandled(surface_id)); |
| 590 } |
| 580 #endif | 591 #endif |
| 581 | 592 |
| 582 void GpuChildThread::OnLoseAllContexts() { | 593 void GpuChildThread::OnLoseAllContexts() { |
| 583 if (gpu_channel_manager_) { | 594 if (gpu_channel_manager_) { |
| 584 gpu_channel_manager_->DestroyAllChannels(); | 595 gpu_channel_manager_->DestroyAllChannels(); |
| 585 media_service_->DestroyAllChannels(); | 596 media_service_->DestroyAllChannels(); |
| 586 } | 597 } |
| 587 } | 598 } |
| 588 | 599 |
| 589 void GpuChildThread::BindProcessControlRequest( | 600 void GpuChildThread::BindProcessControlRequest( |
| 590 mojo::InterfaceRequest<mojom::ProcessControl> request) { | 601 mojo::InterfaceRequest<mojom::ProcessControl> request) { |
| 591 DVLOG(1) << "GPU: Binding ProcessControl request"; | 602 DVLOG(1) << "GPU: Binding ProcessControl request"; |
| 592 DCHECK(process_control_); | 603 DCHECK(process_control_); |
| 593 process_control_bindings_.AddBinding(process_control_.get(), | 604 process_control_bindings_.AddBinding(process_control_.get(), |
| 594 std::move(request)); | 605 std::move(request)); |
| 595 } | 606 } |
| 596 | 607 |
| 597 } // namespace content | 608 } // namespace content |
| OLD | NEW |