[Chromium] Add profiling trace for deferred canvas rendering
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 24 Feb 2012 03:03:52 +0000 (03:03 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 24 Feb 2012 03:03:52 +0000 (03:03 +0000)
https://bugs.webkit.org/show_bug.cgi?id=79376

Patch by Justin Novosad <junov@chromium.org> on 2012-02-23
Reviewed by Stephen White.

No new tests.

* platform/graphics/chromium/Canvas2DLayerChromium.cpp:
(WebCore::Canvas2DLayerChromium::paintContentsIfDirty):
Profiling trace for the entire method, as well as for
calls to canvas flush and context flush, both of which may
cause deferred operation to be executed.
* platform/graphics/skia/PlatformContextSkia.cpp:
(WebCore::PlatformContextSkia::bitmap):
Inserting a profiling trace in this method because it may cause
deferred draw commands to be executed.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@108714 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/chromium/Canvas2DLayerChromium.cpp
Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp

index 98c6512..ce5bc0e 100644 (file)
@@ -1,3 +1,22 @@
+2012-02-23  Justin Novosad  <junov@chromium.org>
+
+        [Chromium] Add profiling trace for deferred canvas rendering
+        https://bugs.webkit.org/show_bug.cgi?id=79376
+
+        Reviewed by Stephen White.
+
+        No new tests.
+
+        * platform/graphics/chromium/Canvas2DLayerChromium.cpp:
+        (WebCore::Canvas2DLayerChromium::paintContentsIfDirty):
+        Profiling trace for the entire method, as well as for
+        calls to canvas flush and context flush, both of which may
+        cause deferred operation to be executed.
+        * platform/graphics/skia/PlatformContextSkia.cpp:
+        (WebCore::PlatformContextSkia::bitmap):
+        Inserting a profiling trace in this method because it may cause
+        deferred draw commands to be executed.
+
 2012-02-23  Shinya Kawanaka  <shinyak@chromium.org>
 
         ShadowRootList should have recalculation flag instead of ShadowRoot.
index 14fe35a..d8b4bbe 100644 (file)
@@ -97,6 +97,7 @@ void Canvas2DLayerChromium::setCanvas(SkCanvas* canvas)
 
 void Canvas2DLayerChromium::paintContentsIfDirty(const Region& /* occludedScreenSpace */)
 {
+    TRACE_EVENT("Canvas2DLayerChromium::paintContentsIfDirty", this, 0);
     if (!drawsContent())
         return;
 
@@ -111,9 +112,12 @@ void Canvas2DLayerChromium::paintContentsIfDirty(const Region& /* occludedScreen
     bool success = m_context->makeContextCurrent();
     ASSERT_UNUSED(success, success);
 
-    if (m_canvas)
+    if (m_canvas) {
+        TRACE_EVENT("SkDeferredCanvas::flush", m_canvas, 0);
         m_canvas->flush();
+    }
 
+    TRACE_EVENT("GrContext::flush", m_context, 0);
     m_context->flush();
 }
 
index c323a0d..3a677e2 100644 (file)
 #include <wtf/MathExtras.h>
 #include <wtf/Vector.h>
 
+#if PLATFORM(CHROMIUM)
+#include "TraceEvent.h"
+#endif
+
 namespace WebCore {
 
 // State -----------------------------------------------------------------------
@@ -551,6 +555,9 @@ void PlatformContextSkia::paintSkPaint(const SkRect& rect,
 
 const SkBitmap* PlatformContextSkia::bitmap() const
 {
+#if PLATFORM(CHROMIUM)
+    TRACE_EVENT("PlatformContextSkia::bitmap", this, 0);
+#endif
     return &m_canvas->getDevice()->accessBitmap(false);
 }