| 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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 | 268 |
| 269 return false; | 269 return false; |
| 270 } | 270 } |
| 271 | 271 |
| 272 bool GpuChildThread::OnMessageReceived(const IPC::Message& msg) { | 272 bool GpuChildThread::OnMessageReceived(const IPC::Message& msg) { |
| 273 if (ChildThreadImpl::OnMessageReceived(msg)) | 273 if (ChildThreadImpl::OnMessageReceived(msg)) |
| 274 return true; | 274 return true; |
| 275 | 275 |
| 276 bool handled = true; | 276 bool handled = true; |
| 277 IPC_BEGIN_MESSAGE_MAP(GpuChildThread, msg) | 277 IPC_BEGIN_MESSAGE_MAP(GpuChildThread, msg) |
| 278 #if defined(OS_MACOSX) | |
| 279 IPC_MESSAGE_HANDLER(AcceleratedSurfaceMsg_BufferPresented, | |
| 280 OnBufferPresented) | |
| 281 #endif | |
| 282 IPC_MESSAGE_HANDLER(GpuMsg_EstablishChannel, OnEstablishChannel) | 278 IPC_MESSAGE_HANDLER(GpuMsg_EstablishChannel, OnEstablishChannel) |
| 283 IPC_MESSAGE_HANDLER(GpuMsg_CloseChannel, OnCloseChannel) | 279 IPC_MESSAGE_HANDLER(GpuMsg_CloseChannel, OnCloseChannel) |
| 284 IPC_MESSAGE_HANDLER(GpuMsg_DestroyGpuMemoryBuffer, OnDestroyGpuMemoryBuffer) | 280 IPC_MESSAGE_HANDLER(GpuMsg_DestroyGpuMemoryBuffer, OnDestroyGpuMemoryBuffer) |
| 285 IPC_MESSAGE_HANDLER(GpuMsg_LoadedShader, OnLoadedShader) | 281 IPC_MESSAGE_HANDLER(GpuMsg_LoadedShader, OnLoadedShader) |
| 286 #if defined(OS_ANDROID) | 282 #if defined(OS_ANDROID) |
| 287 IPC_MESSAGE_HANDLER(GpuMsg_WakeUpGpu, OnWakeUpGpu); | 283 IPC_MESSAGE_HANDLER(GpuMsg_WakeUpGpu, OnWakeUpGpu); |
| 288 IPC_MESSAGE_HANDLER(GpuMsg_DestroyingVideoSurface, | 284 IPC_MESSAGE_HANDLER(GpuMsg_DestroyingVideoSurface, |
| 289 OnDestroyingVideoSurface); | 285 OnDestroyingVideoSurface); |
| 290 #endif | 286 #endif |
| 291 IPC_MESSAGE_UNHANDLED(handled = false) | 287 IPC_MESSAGE_UNHANDLED(handled = false) |
| (...skipping 24 matching lines...) Expand all Loading... |
| 316 void GpuChildThread::DidLoseContext(bool offscreen, | 312 void GpuChildThread::DidLoseContext(bool offscreen, |
| 317 gpu::error::ContextLostReason reason, | 313 gpu::error::ContextLostReason reason, |
| 318 const GURL& active_url) { | 314 const GURL& active_url) { |
| 319 Send(new GpuHostMsg_DidLoseContext(offscreen, reason, active_url)); | 315 Send(new GpuHostMsg_DidLoseContext(offscreen, reason, active_url)); |
| 320 } | 316 } |
| 321 | 317 |
| 322 void GpuChildThread::GpuMemoryUmaStats(const gpu::GPUMemoryUmaStats& params) { | 318 void GpuChildThread::GpuMemoryUmaStats(const gpu::GPUMemoryUmaStats& params) { |
| 323 Send(new GpuHostMsg_GpuMemoryUmaStats(params)); | 319 Send(new GpuHostMsg_GpuMemoryUmaStats(params)); |
| 324 } | 320 } |
| 325 | 321 |
| 326 #if defined(OS_MACOSX) | |
| 327 void GpuChildThread::SendAcceleratedSurfaceBuffersSwapped( | |
| 328 gpu::SurfaceHandle surface_handle, | |
| 329 CAContextID ca_context_id, | |
| 330 bool fullscreen_low_power_ca_context_valid, | |
| 331 CAContextID fullscreen_low_power_ca_context_id, | |
| 332 const gfx::ScopedRefCountedIOSurfaceMachPort& io_surface, | |
| 333 const gfx::Size& size, | |
| 334 float scale_factor, | |
| 335 std::vector<ui::LatencyInfo> latency_info) { | |
| 336 AcceleratedSurfaceBuffersSwappedParams params; | |
| 337 params.surface_handle = surface_handle; | |
| 338 params.ca_context_id = ca_context_id; | |
| 339 params.fullscreen_low_power_ca_context_valid = | |
| 340 fullscreen_low_power_ca_context_valid; | |
| 341 params.fullscreen_low_power_ca_context_id = | |
| 342 fullscreen_low_power_ca_context_id; | |
| 343 params.io_surface = io_surface; | |
| 344 params.size = size; | |
| 345 params.scale_factor = scale_factor; | |
| 346 params.latency_info = std::move(latency_info); | |
| 347 Send(new GpuHostMsg_AcceleratedSurfaceBuffersSwapped(params)); | |
| 348 } | |
| 349 #endif | |
| 350 | |
| 351 #if defined(OS_WIN) | 322 #if defined(OS_WIN) |
| 352 void GpuChildThread::SendAcceleratedSurfaceCreatedChildWindow( | 323 void GpuChildThread::SendAcceleratedSurfaceCreatedChildWindow( |
| 353 gpu::SurfaceHandle parent_window, | 324 gpu::SurfaceHandle parent_window, |
| 354 gpu::SurfaceHandle child_window) { | 325 gpu::SurfaceHandle child_window) { |
| 355 Send(new GpuHostMsg_AcceleratedSurfaceCreatedChildWindow(parent_window, | 326 Send(new GpuHostMsg_AcceleratedSurfaceCreatedChildWindow(parent_window, |
| 356 child_window)); | 327 child_window)); |
| 357 } | 328 } |
| 358 #endif | 329 #endif |
| 359 | 330 |
| 360 void GpuChildThread::StoreShaderToDisk(int32_t client_id, | 331 void GpuChildThread::StoreShaderToDisk(int32_t client_id, |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 watchdog_thread_->Stop(); | 492 watchdog_thread_->Stop(); |
| 522 } | 493 } |
| 523 } | 494 } |
| 524 | 495 |
| 525 void GpuChildThread::OnGpuSwitched() { | 496 void GpuChildThread::OnGpuSwitched() { |
| 526 DVLOG(1) << "GPU: GPU has switched"; | 497 DVLOG(1) << "GPU: GPU has switched"; |
| 527 // Notify observers in the GPU process. | 498 // Notify observers in the GPU process. |
| 528 ui::GpuSwitchingManager::GetInstance()->NotifyGpuSwitched(); | 499 ui::GpuSwitchingManager::GetInstance()->NotifyGpuSwitched(); |
| 529 } | 500 } |
| 530 | 501 |
| 531 #if defined(OS_MACOSX) | |
| 532 void GpuChildThread::OnBufferPresented(const BufferPresentedParams& params) { | |
| 533 if (gpu_channel_manager_) { | |
| 534 gpu_channel_manager_->BufferPresented( | |
| 535 params.surface_handle, params.vsync_timebase, params.vsync_interval); | |
| 536 } | |
| 537 } | |
| 538 #endif | |
| 539 | |
| 540 void GpuChildThread::OnEstablishChannel(const EstablishChannelParams& params) { | 502 void GpuChildThread::OnEstablishChannel(const EstablishChannelParams& params) { |
| 541 if (!gpu_channel_manager_) | 503 if (!gpu_channel_manager_) |
| 542 return; | 504 return; |
| 543 | 505 |
| 544 IPC::ChannelHandle channel_handle = gpu_channel_manager_->EstablishChannel( | 506 IPC::ChannelHandle channel_handle = gpu_channel_manager_->EstablishChannel( |
| 545 params.client_id, params.client_tracing_id, params.preempts, | 507 params.client_id, params.client_tracing_id, params.preempts, |
| 546 params.allow_view_command_buffers, params.allow_real_time_streams); | 508 params.allow_view_command_buffers, params.allow_real_time_streams); |
| 547 media_service_->AddChannel(params.client_id); | 509 media_service_->AddChannel(params.client_id); |
| 548 Send(new GpuHostMsg_ChannelEstablished(channel_handle)); | 510 Send(new GpuHostMsg_ChannelEstablished(channel_handle)); |
| 549 } | 511 } |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 587 | 549 |
| 588 void GpuChildThread::BindProcessControlRequest( | 550 void GpuChildThread::BindProcessControlRequest( |
| 589 mojo::InterfaceRequest<mojom::ProcessControl> request) { | 551 mojo::InterfaceRequest<mojom::ProcessControl> request) { |
| 590 DVLOG(1) << "GPU: Binding ProcessControl request"; | 552 DVLOG(1) << "GPU: Binding ProcessControl request"; |
| 591 DCHECK(process_control_); | 553 DCHECK(process_control_); |
| 592 process_control_bindings_.AddBinding(process_control_.get(), | 554 process_control_bindings_.AddBinding(process_control_.get(), |
| 593 std::move(request)); | 555 std::move(request)); |
| 594 } | 556 } |
| 595 | 557 |
| 596 } // namespace content | 558 } // namespace content |
| OLD | NEW |