Title: [126201] trunk/Source/WebCore
Revision
126201
Author
[email protected]
Date
2012-08-21 15:51:54 -0700 (Tue, 21 Aug 2012)

Log Message

Track -webkit property usage.
https://bugs.webkit.org/show_bug.cgi?id=93420

Patch by Tab Atkins <[email protected]> on 2012-08-21
Reviewed by Ojan Vafai.

First draft of an attempt to track all usage of -webkit prefixed properties across the web.
This attempt is dumb, but should provide useful data as a first-pass.
I plan to optimize this for better data collection in the future.

No tests added, as this is untestable currently.
It should have zero effect besides histogramming.

* css/CSSParser.cpp:
(WebCore::cssPropertyID):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (126200 => 126201)


--- trunk/Source/WebCore/ChangeLog	2012-08-21 22:49:58 UTC (rev 126200)
+++ trunk/Source/WebCore/ChangeLog	2012-08-21 22:51:54 UTC (rev 126201)
@@ -1,3 +1,20 @@
+2012-08-21  Tab Atkins  <[email protected]>
+
+        Track -webkit property usage.
+        https://bugs.webkit.org/show_bug.cgi?id=93420
+
+        Reviewed by Ojan Vafai.
+
+        First draft of an attempt to track all usage of -webkit prefixed properties across the web.
+        This attempt is dumb, but should provide useful data as a first-pass.
+        I plan to optimize this for better data collection in the future.
+
+        No tests added, as this is untestable currently.
+        It should have zero effect besides histogramming.
+
+        * css/CSSParser.cpp:
+        (WebCore::cssPropertyID):
+
 2012-08-21  Alec Flett  <[email protected]>
 
         IndexedDB: remove old update/openCursor glue

Modified: trunk/Source/WebCore/css/CSSParser.cpp (126200 => 126201)


--- trunk/Source/WebCore/css/CSSParser.cpp	2012-08-21 22:49:58 UTC (rev 126200)
+++ trunk/Source/WebCore/css/CSSParser.cpp	2012-08-21 22:51:54 UTC (rev 126201)
@@ -62,6 +62,7 @@
 #include "FontValue.h"
 #include "HTMLParserIdioms.h"
 #include "HashTools.h"
+#include "HistogramSupport.h"
 #include "MediaList.h"
 #include "MediaQueryExp.h"
 #include "Page.h"
@@ -10124,7 +10125,16 @@
     }
 
     const Property* hashTableEntry = findProperty(name, length);
-    return hashTableEntry ? static_cast<CSSPropertyID>(hashTableEntry->id) : CSSPropertyInvalid;
+    const CSSPropertyID propertyID = hashTableEntry ? static_cast<CSSPropertyID>(hashTableEntry->id) : CSSPropertyInvalid;
+
+    // 600 is comfortably larger than numCSSProperties to allow for growth
+    static const int CSSPropertyHistogramSize = 600;
+    COMPILE_ASSERT(CSSPropertyHistogramSize > numCSSProperties, number_of_css_properties_exceed_CSSPropertyHistogramSize);
+
+    if (hasPrefix(buffer, length, "-webkit-") && propertyID != CSSPropertyInvalid)
+        HistogramSupport::histogramEnumeration("CSS.PrefixUsage", max(1, propertyID - firstCSSProperty), CSSPropertyHistogramSize);
+
+    return propertyID;
 }
 
 CSSPropertyID cssPropertyID(const String& string)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to