| 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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 | 262 |
| 263 return handled; | 263 return handled; |
| 264 } | 264 } |
| 265 | 265 |
| 266 bool GpuChildThread::OnMessageReceived(const IPC::Message& msg) { | 266 bool GpuChildThread::OnMessageReceived(const IPC::Message& msg) { |
| 267 if (ChildThreadImpl::OnMessageReceived(msg)) | 267 if (ChildThreadImpl::OnMessageReceived(msg)) |
| 268 return true; | 268 return true; |
| 269 | 269 |
| 270 bool handled = true; | 270 bool handled = true; |
| 271 IPC_BEGIN_MESSAGE_MAP(GpuChildThread, msg) | 271 IPC_BEGIN_MESSAGE_MAP(GpuChildThread, msg) |
| 272 IPC_MESSAGE_HANDLER(GpuMsg_EstablishChannel, OnEstablishChannel) |
| 272 IPC_MESSAGE_HANDLER(GpuMsg_CloseChannel, OnCloseChannel) | 273 IPC_MESSAGE_HANDLER(GpuMsg_CloseChannel, OnCloseChannel) |
| 273 IPC_MESSAGE_HANDLER(GpuMsg_DestroyGpuMemoryBuffer, OnDestroyGpuMemoryBuffer) | 274 IPC_MESSAGE_HANDLER(GpuMsg_DestroyGpuMemoryBuffer, OnDestroyGpuMemoryBuffer) |
| 274 IPC_MESSAGE_HANDLER(GpuMsg_LoadedShader, OnLoadedShader) | 275 IPC_MESSAGE_HANDLER(GpuMsg_LoadedShader, OnLoadedShader) |
| 275 #if defined(OS_ANDROID) | 276 #if defined(OS_ANDROID) |
| 276 IPC_MESSAGE_HANDLER(GpuMsg_WakeUpGpu, OnWakeUpGpu); | 277 IPC_MESSAGE_HANDLER(GpuMsg_WakeUpGpu, OnWakeUpGpu); |
| 277 IPC_MESSAGE_HANDLER(GpuMsg_DestroyingVideoSurface, | 278 IPC_MESSAGE_HANDLER(GpuMsg_DestroyingVideoSurface, |
| 278 OnDestroyingVideoSurface); | 279 OnDestroyingVideoSurface); |
| 279 #endif | 280 #endif |
| 280 IPC_MESSAGE_UNHANDLED(handled = false) | 281 IPC_MESSAGE_UNHANDLED(handled = false) |
| 281 IPC_END_MESSAGE_MAP() | 282 IPC_END_MESSAGE_MAP() |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 } | 449 } |
| 449 #endif | 450 #endif |
| 450 | 451 |
| 451 void GpuChildThread::OnGpuSwitched() { | 452 void GpuChildThread::OnGpuSwitched() { |
| 452 DVLOG(1) << "GPU: GPU has switched"; | 453 DVLOG(1) << "GPU: GPU has switched"; |
| 453 // Notify observers in the GPU process. | 454 // Notify observers in the GPU process. |
| 454 if (!in_browser_process_) | 455 if (!in_browser_process_) |
| 455 ui::GpuSwitchingManager::GetInstance()->NotifyGpuSwitched(); | 456 ui::GpuSwitchingManager::GetInstance()->NotifyGpuSwitched(); |
| 456 } | 457 } |
| 457 | 458 |
| 459 void GpuChildThread::OnEstablishChannel(const EstablishChannelParams& params) { |
| 460 if (!gpu_channel_manager()) |
| 461 return; |
| 462 |
| 463 IPC::ChannelHandle channel_handle = gpu_channel_manager()->EstablishChannel( |
| 464 params.client_id, params.client_tracing_id, params.preempts, |
| 465 params.allow_view_command_buffers, params.allow_real_time_streams); |
| 466 gpu_service_->media_gpu_channel_manager()->AddChannel(params.client_id); |
| 467 Send(new GpuHostMsg_ChannelEstablished(channel_handle)); |
| 468 } |
| 469 |
| 458 void GpuChildThread::OnCloseChannel(int32_t client_id) { | 470 void GpuChildThread::OnCloseChannel(int32_t client_id) { |
| 459 if (gpu_channel_manager()) | 471 if (gpu_channel_manager()) |
| 460 gpu_channel_manager()->RemoveChannel(client_id); | 472 gpu_channel_manager()->RemoveChannel(client_id); |
| 461 } | 473 } |
| 462 | 474 |
| 463 void GpuChildThread::OnLoadedShader(const std::string& shader) { | 475 void GpuChildThread::OnLoadedShader(const std::string& shader) { |
| 464 if (gpu_channel_manager()) | 476 if (gpu_channel_manager()) |
| 465 gpu_channel_manager()->PopulateShaderCache(shader); | 477 gpu_channel_manager()->PopulateShaderCache(shader); |
| 466 } | 478 } |
| 467 | 479 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 487 | 499 |
| 488 void GpuChildThread::BindServiceFactoryRequest( | 500 void GpuChildThread::BindServiceFactoryRequest( |
| 489 service_manager::mojom::ServiceFactoryRequest request) { | 501 service_manager::mojom::ServiceFactoryRequest request) { |
| 490 DVLOG(1) << "GPU: Binding service_manager::mojom::ServiceFactoryRequest"; | 502 DVLOG(1) << "GPU: Binding service_manager::mojom::ServiceFactoryRequest"; |
| 491 DCHECK(service_factory_); | 503 DCHECK(service_factory_); |
| 492 service_factory_bindings_.AddBinding(service_factory_.get(), | 504 service_factory_bindings_.AddBinding(service_factory_.get(), |
| 493 std::move(request)); | 505 std::move(request)); |
| 494 } | 506 } |
| 495 | 507 |
| 496 } // namespace content | 508 } // namespace content |
| OLD | NEW |