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

Unified Diff: content/common/gpu/image_transport_surface_calayer_mac.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/common/gpu/image_transport_surface_fbo_mac.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/gpu/image_transport_surface_calayer_mac.mm
diff --git a/content/common/gpu/image_transport_surface_calayer_mac.mm b/content/common/gpu/image_transport_surface_calayer_mac.mm
index 1aec294ce0ded5808170eac63d376a3c63638c39..1dddfbfbc0f7a692c35ee95de2b4825575767001 100644
--- a/content/common/gpu/image_transport_surface_calayer_mac.mm
+++ b/content/common/gpu/image_transport_surface_calayer_mac.mm
@@ -8,6 +8,7 @@
#include "base/command_line.h"
#include "base/mac/sdk_forward_declarations.h"
+#include "base/trace_event/trace_event.h"
#include "ui/accelerated_widget_mac/surface_handle_types.h"
#include "ui/base/cocoa/animation_utils.h"
#include "ui/gfx/geometry/size_conversions.h"
@@ -297,8 +298,13 @@ void CALayerStorageProvider::FrameSizeChanged(const gfx::Size& pixel_size,
}
void CALayerStorageProvider::SwapBuffers() {
+ TRACE_EVENT0("gpu", "CALayerStorageProvider::SwapBuffers");
DCHECK(!has_pending_draw_);
+ // A trace value of 2 indicates that there is a pending swap ack. See
+ // LayerCanDraw for other value meanings.
+ TRACE_COUNTER_ID1("gpu", "CALayerPendingSwap", this, 2);
+
// Recreate the CALayer on the new GPU if a GPU switch has occurred. Note
// that the CAContext will retain a reference to the old CALayer until the
// call to -[CAContext setLayer:] replaces the old CALayer with the new one.
@@ -416,6 +422,7 @@ void CALayerStorageProvider::DiscardBackbuffer() {
void CALayerStorageProvider::SwapBuffersAckedByBrowser(
bool disable_throttling) {
+ TRACE_EVENT0("gpu", "CALayerStorageProvider::SwapBuffersAckedByBrowser");
throttling_disabled_ = disable_throttling;
if (!previously_discarded_contexts_.empty())
previously_discarded_contexts_.pop_front();
@@ -430,6 +437,24 @@ base::Closure CALayerStorageProvider::LayerShareGroupContextDirtiedCallback() {
}
bool CALayerStorageProvider::LayerCanDraw() {
+ TRACE_EVENT0("gpu", "CALayerStorageProvider::LayerCanDraw");
+
+ // This tracing would be more natural to do with a pseudo-thread for each
+ // layer, rather than a counter.
+ // http://crbug.com/366300
+ if (has_pending_draw_) {
+ // If there is a draw pending then increase the signal from 2 to 3, to
+ // indicate that there is a swap pending, and CoreAnimation has asked to
+ // draw it.
+ TRACE_COUNTER_ID1("gpu", "CALayerPendingSwap", this, 3);
+ } else {
+ // If there is not a draw pending, then give an instantaneous blip up from
+ // 0 to 1, indicating that CoreAnimation was ready to draw a frame but we
+ // were not (or didn't have new content to draw).
+ TRACE_COUNTER_ID1("gpu", "CALayerPendingSwap", this, 1);
+ TRACE_COUNTER_ID1("gpu", "CALayerPendingSwap", this, 0);
+ }
+
if (has_pending_draw_) {
can_draw_returned_false_count_ = 0;
return true;
@@ -450,6 +475,7 @@ bool CALayerStorageProvider::LayerCanDraw() {
}
void CALayerStorageProvider::LayerDoDraw() {
+ TRACE_EVENT0("gpu", "CALayerStorageProvider::LayerDoDraw");
if (gfx::GetGLImplementation() ==
gfx::kGLImplementationDesktopGLCoreProfile) {
glClearColor(1, 0, 1, 1);
@@ -550,6 +576,9 @@ void CALayerStorageProvider::UnblockBrowserIfNeeded() {
ui::SurfaceHandleFromCAContextID([context_ contextId]),
fbo_pixel_size_,
fbo_scale_factor_);
+
+ // A trace value of 0 indicates that there is no longer a pending swap ack.
+ TRACE_COUNTER_ID1("gpu", "CALayerPendingSwap", this, 0);
}
} // namespace content
« no previous file with comments | « no previous file | content/common/gpu/image_transport_surface_fbo_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698