| 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 manager_->Send(new GpuHostMsg_AcceleratedSurfaceBuffersSwapped(params)); | 106 manager_->Send(new GpuHostMsg_AcceleratedSurfaceBuffersSwapped(params)); |
| 107 } | 107 } |
| 108 | 108 |
| 109 void ImageTransportHelper::SendUpdateVSyncParameters( | 109 void ImageTransportHelper::SendUpdateVSyncParameters( |
| 110 base::TimeTicks timebase, base::TimeDelta interval) { | 110 base::TimeTicks timebase, base::TimeDelta interval) { |
| 111 manager_->Send(new GpuHostMsg_UpdateVSyncParameters(stub_->surface_id(), | 111 manager_->Send(new GpuHostMsg_UpdateVSyncParameters(stub_->surface_id(), |
| 112 timebase, | 112 timebase, |
| 113 interval)); | 113 interval)); |
| 114 } | 114 } |
| 115 | 115 |
| 116 void ImageTransportHelper::SendLatencyInfo( | 116 void ImageTransportHelper::SwapBuffersCompleted( |
| 117 const std::vector<ui::LatencyInfo>& latency_info) { | 117 const std::vector<ui::LatencyInfo>& latency_info) { |
| 118 manager_->Send(new GpuHostMsg_FrameDrawn(latency_info)); | 118 stub_->SwapBuffersCompleted(latency_info); |
| 119 } | 119 } |
| 120 | 120 |
| 121 void ImageTransportHelper::SetScheduled(bool is_scheduled) { | 121 void ImageTransportHelper::SetScheduled(bool is_scheduled) { |
| 122 gpu::GpuScheduler* scheduler = Scheduler(); | 122 gpu::GpuScheduler* scheduler = Scheduler(); |
| 123 if (!scheduler) | 123 if (!scheduler) |
| 124 return; | 124 return; |
| 125 | 125 |
| 126 scheduler->SetScheduled(is_scheduled); | 126 scheduler->SetScheduled(is_scheduled); |
| 127 } | 127 } |
| 128 | 128 |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 for (size_t i = 0; i < latency_info_.size(); ++i) { | 229 for (size_t i = 0; i < latency_info_.size(); ++i) { |
| 230 latency_info_[i].AddLatencyNumber( | 230 latency_info_[i].AddLatencyNumber( |
| 231 ui::INPUT_EVENT_GPU_SWAP_BUFFER_COMPONENT, 0, 0); | 231 ui::INPUT_EVENT_GPU_SWAP_BUFFER_COMPONENT, 0, 0); |
| 232 } | 232 } |
| 233 bool result = gfx::GLSurfaceAdapter::SwapBuffers(); | 233 bool result = gfx::GLSurfaceAdapter::SwapBuffers(); |
| 234 for (size_t i = 0; i < latency_info_.size(); i++) { | 234 for (size_t i = 0; i < latency_info_.size(); i++) { |
| 235 latency_info_[i].AddLatencyNumber( | 235 latency_info_[i].AddLatencyNumber( |
| 236 ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 0); | 236 ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 0); |
| 237 } | 237 } |
| 238 | 238 |
| 239 helper_->SendLatencyInfo(latency_info_); | 239 helper_->SwapBuffersCompleted(latency_info_); |
| 240 latency_info_.clear(); | 240 latency_info_.clear(); |
| 241 return result; | 241 return result; |
| 242 } | 242 } |
| 243 | 243 |
| 244 bool PassThroughImageTransportSurface::PostSubBuffer( | 244 bool PassThroughImageTransportSurface::PostSubBuffer( |
| 245 int x, int y, int width, int height) { | 245 int x, int y, int width, int height) { |
| 246 SendVSyncUpdateIfAvailable(); | 246 SendVSyncUpdateIfAvailable(); |
| 247 bool result = gfx::GLSurfaceAdapter::PostSubBuffer(x, y, width, height); | 247 bool result = gfx::GLSurfaceAdapter::PostSubBuffer(x, y, width, height); |
| 248 for (size_t i = 0; i < latency_info_.size(); i++) { | 248 for (size_t i = 0; i < latency_info_.size(); i++) { |
| 249 latency_info_[i].AddLatencyNumber( | 249 latency_info_[i].AddLatencyNumber( |
| 250 ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 0); | 250 ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 0); |
| 251 } | 251 } |
| 252 | 252 |
| 253 helper_->SendLatencyInfo(latency_info_); | 253 helper_->SwapBuffersCompleted(latency_info_); |
| 254 latency_info_.clear(); | 254 latency_info_.clear(); |
| 255 return result; | 255 return result; |
| 256 } | 256 } |
| 257 | 257 |
| 258 bool PassThroughImageTransportSurface::OnMakeCurrent(gfx::GLContext* context) { | 258 bool PassThroughImageTransportSurface::OnMakeCurrent(gfx::GLContext* context) { |
| 259 if (!did_set_swap_interval_) { | 259 if (!did_set_swap_interval_) { |
| 260 ImageTransportHelper::SetSwapInterval(context); | 260 ImageTransportHelper::SetSwapInterval(context); |
| 261 did_set_swap_interval_ = true; | 261 did_set_swap_interval_ = true; |
| 262 } | 262 } |
| 263 return true; | 263 return true; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 286 void PassThroughImageTransportSurface::SendVSyncUpdateIfAvailable() { | 286 void PassThroughImageTransportSurface::SendVSyncUpdateIfAvailable() { |
| 287 gfx::VSyncProvider* vsync_provider = GetVSyncProvider(); | 287 gfx::VSyncProvider* vsync_provider = GetVSyncProvider(); |
| 288 if (vsync_provider) { | 288 if (vsync_provider) { |
| 289 vsync_provider->GetVSyncParameters( | 289 vsync_provider->GetVSyncParameters( |
| 290 base::Bind(&ImageTransportHelper::SendUpdateVSyncParameters, | 290 base::Bind(&ImageTransportHelper::SendUpdateVSyncParameters, |
| 291 helper_->AsWeakPtr())); | 291 helper_->AsWeakPtr())); |
| 292 } | 292 } |
| 293 } | 293 } |
| 294 | 294 |
| 295 } // namespace content | 295 } // namespace content |
| OLD | NEW |