Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Side by Side Diff: content/common/gpu/image_transport_surface.cc

Issue 25022003: Report LatencyInfo through trace buffer (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: fix compile error Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 void PassThroughImageTransportSurface::SetLatencyInfo( 244 void PassThroughImageTransportSurface::SetLatencyInfo(
245 const ui::LatencyInfo& latency_info) { 245 const ui::LatencyInfo& latency_info) {
246 latency_info_ = latency_info; 246 latency_info_ = latency_info;
247 } 247 }
248 248
249 bool PassThroughImageTransportSurface::SwapBuffers() { 249 bool PassThroughImageTransportSurface::SwapBuffers() {
250 // GetVsyncValues before SwapBuffers to work around Mali driver bug: 250 // GetVsyncValues before SwapBuffers to work around Mali driver bug:
251 // crbug.com/223558. 251 // crbug.com/223558.
252 SendVSyncUpdateIfAvailable(); 252 SendVSyncUpdateIfAvailable();
253 bool result = gfx::GLSurfaceAdapter::SwapBuffers(); 253 bool result = gfx::GLSurfaceAdapter::SwapBuffers();
254 latency_info_.swap_timestamp = base::TimeTicks::HighResNow(); 254 latency_info_.AddLatencyNumber(
255 ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 0);
255 256
256 if (transport_) { 257 if (transport_) {
257 DCHECK(!is_swap_buffers_pending_); 258 DCHECK(!is_swap_buffers_pending_);
258 is_swap_buffers_pending_ = true; 259 is_swap_buffers_pending_ = true;
259 260
260 // Round trip to the browser UI thread, for throttling, by sending a dummy 261 // Round trip to the browser UI thread, for throttling, by sending a dummy
261 // SwapBuffers message. 262 // SwapBuffers message.
262 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params; 263 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params;
263 params.surface_handle = 0; 264 params.surface_handle = 0;
264 params.latency_info = latency_info_; 265 params.latency_info = latency_info_;
265 params.size = surface()->GetSize(); 266 params.size = surface()->GetSize();
266 helper_->SendAcceleratedSurfaceBuffersSwapped(params); 267 helper_->SendAcceleratedSurfaceBuffersSwapped(params);
267 } else { 268 } else {
268 helper_->SendLatencyInfo(latency_info_); 269 helper_->SendLatencyInfo(latency_info_);
269 } 270 }
270 return result; 271 return result;
271 } 272 }
272 273
273 bool PassThroughImageTransportSurface::PostSubBuffer( 274 bool PassThroughImageTransportSurface::PostSubBuffer(
274 int x, int y, int width, int height) { 275 int x, int y, int width, int height) {
275 SendVSyncUpdateIfAvailable(); 276 SendVSyncUpdateIfAvailable();
276 bool result = gfx::GLSurfaceAdapter::PostSubBuffer(x, y, width, height); 277 bool result = gfx::GLSurfaceAdapter::PostSubBuffer(x, y, width, height);
277 latency_info_.swap_timestamp = base::TimeTicks::HighResNow(); 278 latency_info_.AddLatencyNumber(
279 ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 0);
278 280
279 if (transport_) { 281 if (transport_) {
280 DCHECK(!is_swap_buffers_pending_); 282 DCHECK(!is_swap_buffers_pending_);
281 is_swap_buffers_pending_ = true; 283 is_swap_buffers_pending_ = true;
282 284
283 // Round trip to the browser UI thread, for throttling, by sending a dummy 285 // Round trip to the browser UI thread, for throttling, by sending a dummy
284 // PostSubBuffer message. 286 // PostSubBuffer message.
285 GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params params; 287 GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params params;
286 params.surface_handle = 0; 288 params.surface_handle = 0;
287 params.latency_info = latency_info_; 289 params.latency_info = latency_info_;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 void PassThroughImageTransportSurface::SendVSyncUpdateIfAvailable() { 351 void PassThroughImageTransportSurface::SendVSyncUpdateIfAvailable() {
350 gfx::VSyncProvider* vsync_provider = GetVSyncProvider(); 352 gfx::VSyncProvider* vsync_provider = GetVSyncProvider();
351 if (vsync_provider) { 353 if (vsync_provider) {
352 vsync_provider->GetVSyncParameters( 354 vsync_provider->GetVSyncParameters(
353 base::Bind(&ImageTransportHelper::SendUpdateVSyncParameters, 355 base::Bind(&ImageTransportHelper::SendUpdateVSyncParameters,
354 helper_->AsWeakPtr())); 356 helper_->AsWeakPtr()));
355 } 357 }
356 } 358 }
357 359
358 } // namespace content 360 } // namespace content
OLDNEW
« no previous file with comments | « content/common/content_param_traits_macros.h ('k') | content/common/input/input_param_traits_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698