| 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/common/gpu/image_transport_surface.h" | 5 #include "content/common/gpu/image_transport_surface.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 #if defined(OS_MACOSX) | 89 #if defined(OS_MACOSX) |
| 90 IPC_MESSAGE_HANDLER(AcceleratedSurfaceMsg_BufferPresented, | 90 IPC_MESSAGE_HANDLER(AcceleratedSurfaceMsg_BufferPresented, |
| 91 OnBufferPresented) | 91 OnBufferPresented) |
| 92 #endif | 92 #endif |
| 93 IPC_MESSAGE_HANDLER(AcceleratedSurfaceMsg_WakeUpGpu, OnWakeUpGpu); | 93 IPC_MESSAGE_HANDLER(AcceleratedSurfaceMsg_WakeUpGpu, OnWakeUpGpu); |
| 94 IPC_MESSAGE_UNHANDLED(handled = false) | 94 IPC_MESSAGE_UNHANDLED(handled = false) |
| 95 IPC_END_MESSAGE_MAP() | 95 IPC_END_MESSAGE_MAP() |
| 96 return handled; | 96 return handled; |
| 97 } | 97 } |
| 98 | 98 |
| 99 #if defined(OS_MACOSX) |
| 99 void ImageTransportHelper::SendAcceleratedSurfaceBuffersSwapped( | 100 void ImageTransportHelper::SendAcceleratedSurfaceBuffersSwapped( |
| 100 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params) { | 101 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params) { |
| 101 // TRACE_EVENT for gpu tests: | 102 // TRACE_EVENT for gpu tests: |
| 102 TRACE_EVENT_INSTANT2("test_gpu", "SwapBuffers", | 103 TRACE_EVENT_INSTANT2("test_gpu", "SwapBuffers", |
| 103 TRACE_EVENT_SCOPE_THREAD, | 104 TRACE_EVENT_SCOPE_THREAD, |
| 104 "GLImpl", static_cast<int>(gfx::GetGLImplementation()), | 105 "GLImpl", static_cast<int>(gfx::GetGLImplementation()), |
| 105 "width", params.size.width()); | 106 "width", params.size.width()); |
| 106 params.surface_id = stub_->surface_id(); | 107 params.surface_id = stub_->surface_id(); |
| 107 params.route_id = route_id_; | 108 params.route_id = route_id_; |
| 108 manager_->Send(new GpuHostMsg_AcceleratedSurfaceBuffersSwapped(params)); | 109 manager_->Send(new GpuHostMsg_AcceleratedSurfaceBuffersSwapped(params)); |
| 109 } | 110 } |
| 111 #endif |
| 110 | 112 |
| 111 void ImageTransportHelper::SetPreemptByFlag( | 113 void ImageTransportHelper::SetPreemptByFlag( |
| 112 scoped_refptr<gpu::PreemptionFlag> preemption_flag) { | 114 scoped_refptr<gpu::PreemptionFlag> preemption_flag) { |
| 113 stub_->channel()->SetPreemptByFlag(preemption_flag); | 115 stub_->channel()->SetPreemptByFlag(preemption_flag); |
| 114 } | 116 } |
| 115 | 117 |
| 116 bool ImageTransportHelper::MakeCurrent() { | 118 bool ImageTransportHelper::MakeCurrent() { |
| 117 gpu::gles2::GLES2Decoder* decoder = Decoder(); | 119 gpu::gles2::GLES2Decoder* decoder = Decoder(); |
| 118 if (!decoder) | 120 if (!decoder) |
| 119 return false; | 121 return false; |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 void PassThroughImageTransportSurface::SendVSyncUpdateIfAvailable() { | 288 void PassThroughImageTransportSurface::SendVSyncUpdateIfAvailable() { |
| 287 gfx::VSyncProvider* vsync_provider = GetVSyncProvider(); | 289 gfx::VSyncProvider* vsync_provider = GetVSyncProvider(); |
| 288 if (vsync_provider) { | 290 if (vsync_provider) { |
| 289 vsync_provider->GetVSyncParameters( | 291 vsync_provider->GetVSyncParameters( |
| 290 base::Bind(&GpuCommandBufferStub::SendUpdateVSyncParameters, | 292 base::Bind(&GpuCommandBufferStub::SendUpdateVSyncParameters, |
| 291 helper_->stub()->AsWeakPtr())); | 293 helper_->stub()->AsWeakPtr())); |
| 292 } | 294 } |
| 293 } | 295 } |
| 294 | 296 |
| 295 } // namespace content | 297 } // namespace content |
| OLD | NEW |