Title: [127846] trunk/Source/Platform
Revision
127846
Author
nd...@chromium.org
Date
2012-09-07 01:58:36 -0700 (Fri, 07 Sep 2012)

Log Message

[chromium] Allow enumeration of WebRenderingStats structure
https://bugs.webkit.org/show_bug.cgi?id=94565

Reviewed by James Robinson.

* chromium/public/WebRenderingStats.h:
(WebRenderingStats):
(Enumerator):
(WebKit::WebRenderingStats::Enumerator::~Enumerator):
(WebKit::WebRenderingStats::enumerateFields):

Modified Paths

Diff

Modified: trunk/Source/Platform/ChangeLog (127845 => 127846)


--- trunk/Source/Platform/ChangeLog	2012-09-07 08:52:26 UTC (rev 127845)
+++ trunk/Source/Platform/ChangeLog	2012-09-07 08:58:36 UTC (rev 127846)
@@ -1,3 +1,15 @@
+2012-09-07  Nat Duca  <nd...@chromium.org>
+        [chromium] Allow enumeration of WebRenderingStats structure
+        https://bugs.webkit.org/show_bug.cgi?id=94565
+
+        Reviewed by James Robinson.
+
+        * chromium/public/WebRenderingStats.h:
+        (WebRenderingStats):
+        (Enumerator):
+        (WebKit::WebRenderingStats::Enumerator::~Enumerator):
+        (WebKit::WebRenderingStats::enumerateFields):
+
 2012-09-07  Yoshifumi Inoue  <yo...@chromium.org>
 
         We should have a localized string of empty for date time field

Modified: trunk/Source/Platform/chromium/public/WebRenderingStats.h (127845 => 127846)


--- trunk/Source/Platform/chromium/public/WebRenderingStats.h	2012-09-07 08:52:26 UTC (rev 127845)
+++ trunk/Source/Platform/chromium/public/WebRenderingStats.h	2012-09-07 08:58:36 UTC (rev 127846)
@@ -43,6 +43,28 @@
         , totalRasterizeTimeInSeconds(0)
     {
     }
+
+    // In conjunction with enumerateFields, this allows the embedder to
+    // enumerate the values in this structure without
+    // having to embed references to its specific member variables. This
+    // simplifies the addition of new fields to this type.
+    class Enumerator {
+    public:
+        virtual void addInt(const char* name, int value) = 0;
+        virtual void addDouble(const char* name, double value) = 0;
+    protected:
+        virtual ~Enumerator() { }
+    };
+
+    // Outputs the fields in this structure to the provided enumerator.
+    void enumerateFields(Enumerator* enumerator) const
+    {
+        enumerator->addInt("numAnimationFrames", numAnimationFrames);
+        enumerator->addInt("numFramesSentToScreen", numFramesSentToScreen);
+        enumerator->addInt("droppedFrameCount", droppedFrameCount);
+        enumerator->addDouble("totalPaintTimeInSeconds", totalPaintTimeInSeconds);
+        enumerator->addDouble("totalRasterizeTimeInSeconds", totalRasterizeTimeInSeconds);
+    }
 };
 
 } // namespace WebKit
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to