| 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/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 manager_->Send(new GpuHostMsg_UpdateVSyncParameters(stub_->surface_id(), | 118 manager_->Send(new GpuHostMsg_UpdateVSyncParameters(stub_->surface_id(), |
| 119 timebase, | 119 timebase, |
| 120 interval)); | 120 interval)); |
| 121 } | 121 } |
| 122 | 122 |
| 123 void ImageTransportHelper::SwapBuffersCompleted( | 123 void ImageTransportHelper::SwapBuffersCompleted( |
| 124 const std::vector<ui::LatencyInfo>& latency_info) { | 124 const std::vector<ui::LatencyInfo>& latency_info) { |
| 125 stub_->SwapBuffersCompleted(latency_info); | 125 stub_->SwapBuffersCompleted(latency_info); |
| 126 } | 126 } |
| 127 | 127 |
| 128 void ImageTransportHelper::PageFlipCompleted() { |
| 129 stub_->PageFlipCompleted(); |
| 130 } |
| 131 |
| 128 void ImageTransportHelper::SetScheduled(bool is_scheduled) { | 132 void ImageTransportHelper::SetScheduled(bool is_scheduled) { |
| 129 gpu::GpuScheduler* scheduler = Scheduler(); | 133 gpu::GpuScheduler* scheduler = Scheduler(); |
| 130 if (!scheduler) | 134 if (!scheduler) |
| 131 return; | 135 return; |
| 132 | 136 |
| 133 scheduler->SetScheduled(is_scheduled); | 137 scheduler->SetScheduled(is_scheduled); |
| 134 } | 138 } |
| 135 | 139 |
| 136 void ImageTransportHelper::DeferToFence(base::Closure task) { | 140 void ImageTransportHelper::DeferToFence(base::Closure task) { |
| 137 gpu::GpuScheduler* scheduler = Scheduler(); | 141 gpu::GpuScheduler* scheduler = Scheduler(); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 PassThroughImageTransportSurface::PassThroughImageTransportSurface( | 211 PassThroughImageTransportSurface::PassThroughImageTransportSurface( |
| 208 GpuChannelManager* manager, | 212 GpuChannelManager* manager, |
| 209 GpuCommandBufferStub* stub, | 213 GpuCommandBufferStub* stub, |
| 210 gfx::GLSurface* surface) | 214 gfx::GLSurface* surface) |
| 211 : GLSurfaceAdapter(surface), | 215 : GLSurfaceAdapter(surface), |
| 212 did_set_swap_interval_(false) { | 216 did_set_swap_interval_(false) { |
| 213 helper_.reset(new ImageTransportHelper(this, | 217 helper_.reset(new ImageTransportHelper(this, |
| 214 manager, | 218 manager, |
| 215 stub, | 219 stub, |
| 216 gfx::kNullPluginWindow)); | 220 gfx::kNullPluginWindow)); |
| 221 GLSurfaceAdapter::SetPageFlipCompletionCallback( |
| 222 base::Bind(&ImageTransportHelper::PageFlipCompleted, |
| 223 helper_->AsWeakPtr())); |
| 217 } | 224 } |
| 218 | 225 |
| 219 bool PassThroughImageTransportSurface::Initialize() { | 226 bool PassThroughImageTransportSurface::Initialize() { |
| 220 // The surface is assumed to have already been initialized. | 227 // The surface is assumed to have already been initialized. |
| 221 return helper_->Initialize(); | 228 return helper_->Initialize(); |
| 222 } | 229 } |
| 223 | 230 |
| 224 void PassThroughImageTransportSurface::Destroy() { | 231 void PassThroughImageTransportSurface::Destroy() { |
| 225 GLSurfaceAdapter::Destroy(); | 232 GLSurfaceAdapter::Destroy(); |
| 226 } | 233 } |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 void PassThroughImageTransportSurface::SendVSyncUpdateIfAvailable() { | 300 void PassThroughImageTransportSurface::SendVSyncUpdateIfAvailable() { |
| 294 gfx::VSyncProvider* vsync_provider = GetVSyncProvider(); | 301 gfx::VSyncProvider* vsync_provider = GetVSyncProvider(); |
| 295 if (vsync_provider) { | 302 if (vsync_provider) { |
| 296 vsync_provider->GetVSyncParameters( | 303 vsync_provider->GetVSyncParameters( |
| 297 base::Bind(&ImageTransportHelper::SendUpdateVSyncParameters, | 304 base::Bind(&ImageTransportHelper::SendUpdateVSyncParameters, |
| 298 helper_->AsWeakPtr())); | 305 helper_->AsWeakPtr())); |
| 299 } | 306 } |
| 300 } | 307 } |
| 301 | 308 |
| 302 } // namespace content | 309 } // namespace content |
| OLD | NEW |