| 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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 bool handled = true; | 284 bool handled = true; |
| 285 IPC_BEGIN_MESSAGE_MAP(GpuChildThread, msg) | 285 IPC_BEGIN_MESSAGE_MAP(GpuChildThread, msg) |
| 286 #if defined(OS_MACOSX) | 286 #if defined(OS_MACOSX) |
| 287 IPC_MESSAGE_HANDLER(AcceleratedSurfaceMsg_BufferPresented, | 287 IPC_MESSAGE_HANDLER(AcceleratedSurfaceMsg_BufferPresented, |
| 288 OnBufferPresented) | 288 OnBufferPresented) |
| 289 #endif | 289 #endif |
| 290 IPC_MESSAGE_HANDLER(GpuMsg_EstablishChannel, OnEstablishChannel) | 290 IPC_MESSAGE_HANDLER(GpuMsg_EstablishChannel, OnEstablishChannel) |
| 291 IPC_MESSAGE_HANDLER(GpuMsg_CloseChannel, OnCloseChannel) | 291 IPC_MESSAGE_HANDLER(GpuMsg_CloseChannel, OnCloseChannel) |
| 292 IPC_MESSAGE_HANDLER(GpuMsg_DestroyGpuMemoryBuffer, OnDestroyGpuMemoryBuffer) | 292 IPC_MESSAGE_HANDLER(GpuMsg_DestroyGpuMemoryBuffer, OnDestroyGpuMemoryBuffer) |
| 293 IPC_MESSAGE_HANDLER(GpuMsg_LoadedShader, OnLoadedShader) | 293 IPC_MESSAGE_HANDLER(GpuMsg_LoadedShader, OnLoadedShader) |
| 294 IPC_MESSAGE_HANDLER(GpuMsg_UpdateValueState, OnUpdateValueState) | |
| 295 #if defined(OS_ANDROID) | 294 #if defined(OS_ANDROID) |
| 296 IPC_MESSAGE_HANDLER(GpuMsg_WakeUpGpu, OnWakeUpGpu); | 295 IPC_MESSAGE_HANDLER(GpuMsg_WakeUpGpu, OnWakeUpGpu); |
| 297 #endif | 296 #endif |
| 298 IPC_MESSAGE_UNHANDLED(handled = false) | 297 IPC_MESSAGE_UNHANDLED(handled = false) |
| 299 IPC_END_MESSAGE_MAP() | 298 IPC_END_MESSAGE_MAP() |
| 300 if (handled) | 299 if (handled) |
| 301 return true; | 300 return true; |
| 302 | 301 |
| 303 return false; | 302 return false; |
| 304 } | 303 } |
| 305 | 304 |
| 306 void GpuChildThread::SetActiveURL(const GURL& url) { | 305 void GpuChildThread::SetActiveURL(const GURL& url) { |
| 307 GetContentClient()->SetActiveURL(url); | 306 GetContentClient()->SetActiveURL(url); |
| 308 } | 307 } |
| 309 | 308 |
| 310 void GpuChildThread::AddSubscription(int32_t client_id, unsigned int target) { | |
| 311 Send(new GpuHostMsg_AddSubscription(client_id, target)); | |
| 312 } | |
| 313 | |
| 314 void GpuChildThread::DidCreateOffscreenContext(const GURL& active_url) { | 309 void GpuChildThread::DidCreateOffscreenContext(const GURL& active_url) { |
| 315 Send(new GpuHostMsg_DidCreateOffscreenContext(active_url)); | 310 Send(new GpuHostMsg_DidCreateOffscreenContext(active_url)); |
| 316 } | 311 } |
| 317 | 312 |
| 318 void GpuChildThread::DidDestroyChannel(int client_id) { | 313 void GpuChildThread::DidDestroyChannel(int client_id) { |
| 319 media_service_->RemoveChannel(client_id); | 314 media_service_->RemoveChannel(client_id); |
| 320 Send(new GpuHostMsg_DestroyChannel(client_id)); | 315 Send(new GpuHostMsg_DestroyChannel(client_id)); |
| 321 } | 316 } |
| 322 | 317 |
| 323 void GpuChildThread::DidDestroyOffscreenContext(const GURL& active_url) { | 318 void GpuChildThread::DidDestroyOffscreenContext(const GURL& active_url) { |
| 324 Send(new GpuHostMsg_DidDestroyOffscreenContext(active_url)); | 319 Send(new GpuHostMsg_DidDestroyOffscreenContext(active_url)); |
| 325 } | 320 } |
| 326 | 321 |
| 327 void GpuChildThread::DidLoseContext(bool offscreen, | 322 void GpuChildThread::DidLoseContext(bool offscreen, |
| 328 gpu::error::ContextLostReason reason, | 323 gpu::error::ContextLostReason reason, |
| 329 const GURL& active_url) { | 324 const GURL& active_url) { |
| 330 Send(new GpuHostMsg_DidLoseContext(offscreen, reason, active_url)); | 325 Send(new GpuHostMsg_DidLoseContext(offscreen, reason, active_url)); |
| 331 } | 326 } |
| 332 | 327 |
| 333 void GpuChildThread::GpuMemoryUmaStats(const gpu::GPUMemoryUmaStats& params) { | 328 void GpuChildThread::GpuMemoryUmaStats(const gpu::GPUMemoryUmaStats& params) { |
| 334 Send(new GpuHostMsg_GpuMemoryUmaStats(params)); | 329 Send(new GpuHostMsg_GpuMemoryUmaStats(params)); |
| 335 } | 330 } |
| 336 | 331 |
| 337 void GpuChildThread::RemoveSubscription(int32_t client_id, | |
| 338 unsigned int target) { | |
| 339 Send(new GpuHostMsg_RemoveSubscription(client_id, target)); | |
| 340 } | |
| 341 | |
| 342 #if defined(OS_MACOSX) | 332 #if defined(OS_MACOSX) |
| 343 void GpuChildThread::SendAcceleratedSurfaceBuffersSwapped( | 333 void GpuChildThread::SendAcceleratedSurfaceBuffersSwapped( |
| 344 int32_t surface_id, | 334 int32_t surface_id, |
| 345 CAContextID ca_context_id, | 335 CAContextID ca_context_id, |
| 346 const gfx::ScopedRefCountedIOSurfaceMachPort& io_surface, | 336 const gfx::ScopedRefCountedIOSurfaceMachPort& io_surface, |
| 347 const gfx::Size& size, | 337 const gfx::Size& size, |
| 348 float scale_factor, | 338 float scale_factor, |
| 349 std::vector<ui::LatencyInfo> latency_info) { | 339 std::vector<ui::LatencyInfo> latency_info) { |
| 350 AcceleratedSurfaceBuffersSwappedParams params; | 340 AcceleratedSurfaceBuffersSwappedParams params; |
| 351 params.surface_id = surface_id; | 341 params.surface_id = surface_id; |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 } | 548 } |
| 559 | 549 |
| 560 void GpuChildThread::OnDestroyGpuMemoryBuffer( | 550 void GpuChildThread::OnDestroyGpuMemoryBuffer( |
| 561 gfx::GpuMemoryBufferId id, | 551 gfx::GpuMemoryBufferId id, |
| 562 int client_id, | 552 int client_id, |
| 563 const gpu::SyncToken& sync_token) { | 553 const gpu::SyncToken& sync_token) { |
| 564 if (gpu_channel_manager_) | 554 if (gpu_channel_manager_) |
| 565 gpu_channel_manager_->DestroyGpuMemoryBuffer(id, client_id, sync_token); | 555 gpu_channel_manager_->DestroyGpuMemoryBuffer(id, client_id, sync_token); |
| 566 } | 556 } |
| 567 | 557 |
| 568 void GpuChildThread::OnUpdateValueState(int client_id, | |
| 569 unsigned int target, | |
| 570 const gpu::ValueState& state) { | |
| 571 if (gpu_channel_manager_) | |
| 572 gpu_channel_manager_->UpdateValueState(client_id, target, state); | |
| 573 } | |
| 574 | |
| 575 #if defined(OS_ANDROID) | 558 #if defined(OS_ANDROID) |
| 576 void GpuChildThread::OnWakeUpGpu() { | 559 void GpuChildThread::OnWakeUpGpu() { |
| 577 if (gpu_channel_manager_) | 560 if (gpu_channel_manager_) |
| 578 gpu_channel_manager_->WakeUpGpu(); | 561 gpu_channel_manager_->WakeUpGpu(); |
| 579 } | 562 } |
| 580 #endif | 563 #endif |
| 581 | 564 |
| 582 void GpuChildThread::OnLoseAllContexts() { | 565 void GpuChildThread::OnLoseAllContexts() { |
| 583 if (gpu_channel_manager_) { | 566 if (gpu_channel_manager_) { |
| 584 gpu_channel_manager_->DestroyAllChannels(); | 567 gpu_channel_manager_->DestroyAllChannels(); |
| 585 media_service_->DestroyAllChannels(); | 568 media_service_->DestroyAllChannels(); |
| 586 } | 569 } |
| 587 } | 570 } |
| 588 | 571 |
| 589 void GpuChildThread::BindProcessControlRequest( | 572 void GpuChildThread::BindProcessControlRequest( |
| 590 mojo::InterfaceRequest<mojom::ProcessControl> request) { | 573 mojo::InterfaceRequest<mojom::ProcessControl> request) { |
| 591 DVLOG(1) << "GPU: Binding ProcessControl request"; | 574 DVLOG(1) << "GPU: Binding ProcessControl request"; |
| 592 DCHECK(process_control_); | 575 DCHECK(process_control_); |
| 593 process_control_bindings_.AddBinding(process_control_.get(), | 576 process_control_bindings_.AddBinding(process_control_.get(), |
| 594 std::move(request)); | 577 std::move(request)); |
| 595 } | 578 } |
| 596 | 579 |
| 597 } // namespace content | 580 } // namespace content |
| OLD | NEW |