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

Side by Side Diff: ui/accelerated_widget_mac/io_surface_layer.mm

Issue 1137093003: Mac: Add more trace events for CAOpenGLLayers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix grammar Created 5 years, 7 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
« no previous file with comments | « content/common/gpu/image_transport_surface_fbo_mac.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "ui/accelerated_widget_mac/io_surface_layer.h" 5 #include "ui/accelerated_widget_mac/io_surface_layer.h"
6 6
7 #include <CoreFoundation/CoreFoundation.h> 7 #include <CoreFoundation/CoreFoundation.h>
8 #include <OpenGL/CGLIOSurface.h> 8 #include <OpenGL/CGLIOSurface.h>
9 #include <OpenGL/CGLRenderers.h> 9 #include <OpenGL/CGLRenderers.h>
10 #include <OpenGL/gl.h> 10 #include <OpenGL/gl.h>
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 // If we return NO 30 times in a row, switch to being synchronous to avoid 73 // If we return NO 30 times in a row, switch to being synchronous to avoid
74 // burning CPU cycles on this callback. 74 // burning CPU cycles on this callback.
75 if (needs_display_) { 75 if (needs_display_) {
76 did_not_draw_counter_ = 0; 76 did_not_draw_counter_ = 0;
77 } else { 77 } else {
78 did_not_draw_counter_ += 1; 78 did_not_draw_counter_ += 1;
79 if (did_not_draw_counter_ == 30) 79 if (did_not_draw_counter_ == 30)
80 [layer_ setAsynchronous:NO]; 80 [layer_ setAsynchronous:NO];
81 } 81 }
82 82
83 // Add an instantaneous blip to the PendingSwapAck state to indicate 83 if (needs_display_) {
84 // that CoreAnimation asked if a frame is ready. A blip up to to 3 (usually 84 // If there is a draw pending then increase the signal from 2 to 3, to
85 // from 2, indicating that a swap ack is pending) indicates that we 85 // indicate that we are in the state where there is a swap pending and
86 // requested a draw. A blip up to 1 (usually from 0, indicating there is no 86 // CoreAnimation has been committed to draw it.
87 // pending swap ack) indicates that we did not request a draw. This would 87 TRACE_COUNTER_ID1("browser", "PendingSwapAck", this, 3);
88 // be more natural to do with a tracing pseudo-thread 88 } else {
89 // http://crbug.com/366300 89 // If there is not a draw pending, then give an instantaneous blip up from
90 TRACE_COUNTER_ID1("browser", "PendingSwapAck", this, needs_display_ ? 3 : 1); 90 // 0 to 1, indicating that CoreAnimation was ready to draw a frame but we
91 TRACE_COUNTER_ID1("browser", "PendingSwapAck", this, 91 // were not (or didn't have new content to draw).
92 has_pending_frame_ ? 2 : 0); 92 TRACE_COUNTER_ID1("browser", "PendingSwapAck", this, 1);
93 TRACE_COUNTER_ID1("browser", "PendingSwapAck", this, 0);
94 }
93 95
94 return needs_display_; 96 return needs_display_;
95 } 97 }
96 98
97 void IOSurfaceLayerHelper::DidDraw(bool success) { 99 void IOSurfaceLayerHelper::DidDraw(bool success) {
98 needs_display_ = false; 100 needs_display_ = false;
99 AckPendingFrame(success); 101 AckPendingFrame(success);
100 } 102 }
101 103
102 void IOSurfaceLayerHelper::AckPendingFrame(bool success) { 104 void IOSurfaceLayerHelper::AckPendingFrame(bool success) {
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 if (helper_) 293 if (helper_)
292 helper_->DidDraw(draw_succeeded); 294 helper_->DidDraw(draw_succeeded);
293 295
294 [super drawInCGLContext:glContext 296 [super drawInCGLContext:glContext
295 pixelFormat:pixelFormat 297 pixelFormat:pixelFormat
296 forLayerTime:timeInterval 298 forLayerTime:timeInterval
297 displayTime:timeStamp]; 299 displayTime:timeStamp];
298 } 300 }
299 301
300 @end 302 @end
OLDNEW
« no previous file with comments | « content/common/gpu/image_transport_surface_fbo_mac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698