Title: [100222] trunk/Source/WebCore
Revision
100222
Author
commit-qu...@webkit.org
Date
2011-11-14 17:23:35 -0800 (Mon, 14 Nov 2011)

Log Message

[MutationObservers] Add histogram collection for usage of DOM Mutation Events
https://bugs.webkit.org/show_bug.cgi?id=72316

Patch by Rafael Weinstein <rafa...@chromium.org> on 2011-11-14
Reviewed by Ryosuke Niwa.

This patch adds six calls in ~Document() which simply pipe-out to the embedder
the (already-collected) bits of whether varous DOM Mutation Events were registered
on the document.

No tests needed. No functional changes.

* dom/Document.cpp:
(WebCore::histogramMutationEventUsage):
(WebCore::Document::~Document):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (100221 => 100222)


--- trunk/Source/WebCore/ChangeLog	2011-11-15 01:22:52 UTC (rev 100221)
+++ trunk/Source/WebCore/ChangeLog	2011-11-15 01:23:35 UTC (rev 100222)
@@ -1,3 +1,20 @@
+2011-11-14  Rafael Weinstein  <rafa...@chromium.org>
+
+        [MutationObservers] Add histogram collection for usage of DOM Mutation Events
+        https://bugs.webkit.org/show_bug.cgi?id=72316
+
+        Reviewed by Ryosuke Niwa.
+
+        This patch adds six calls in ~Document() which simply pipe-out to the embedder
+        the (already-collected) bits of whether varous DOM Mutation Events were registered
+        on the document.
+
+        No tests needed. No functional changes.
+
+        * dom/Document.cpp:
+        (WebCore::histogramMutationEventUsage):
+        (WebCore::Document::~Document):
+
 2011-11-14  Simon Fraser  <simon.fra...@apple.com>
 
         div with webkit-transform + webkit-box-reflect disappears when switching tabs

Modified: trunk/Source/WebCore/dom/Document.cpp (100221 => 100222)


--- trunk/Source/WebCore/dom/Document.cpp	2011-11-15 01:22:52 UTC (rev 100221)
+++ trunk/Source/WebCore/dom/Document.cpp	2011-11-15 01:23:35 UTC (rev 100222)
@@ -157,6 +157,10 @@
 #include <wtf/StdLibExtras.h>
 #include <wtf/text/StringBuffer.h>
 
+#if PLATFORM(CHROMIUM)
+#include "PlatformSupport.h"
+#endif
+
 #if ENABLE(SHARED_WORKERS)
 #include "SharedWorkerRepository.h"
 #endif
@@ -493,6 +497,18 @@
     m_docID = docID++;
 }
 
+#if PLATFORM(CHROMIUM)
+static void histogramMutationEventUsage(const unsigned short& listenerTypes)
+{
+    PlatformSupport::histogramEnumeration("DOMAPI.PerDocumentMutationEventUsage.DOMSubtreeModified", static_cast<bool>(listenerTypes & Document::DOMSUBTREEMODIFIED_LISTENER), 2);
+    PlatformSupport::histogramEnumeration("DOMAPI.PerDocumentMutationEventUsage.DOMNodeInserted", static_cast<bool>(listenerTypes & Document::DOMNODEINSERTED_LISTENER), 2);
+    PlatformSupport::histogramEnumeration("DOMAPI.PerDocumentMutationEventUsage.DOMNodeRemoved", static_cast<bool>(listenerTypes & Document::DOMNODEREMOVED_LISTENER), 2);
+    PlatformSupport::histogramEnumeration("DOMAPI.PerDocumentMutationEventUsage.DOMNodeRemovedFromDocument", static_cast<bool>(listenerTypes & Document::DOMNODEREMOVEDFROMDOCUMENT_LISTENER), 2);
+    PlatformSupport::histogramEnumeration("DOMAPI.PerDocumentMutationEventUsage.DOMNodeInsertedIntoDocument", static_cast<bool>(listenerTypes & Document::DOMNODEINSERTEDINTODOCUMENT_LISTENER), 2);
+    PlatformSupport::histogramEnumeration("DOMAPI.PerDocumentMutationEventUsage.DOMCharacterDataModified", static_cast<bool>(listenerTypes & Document::DOMCHARACTERDATAMODIFIED_LISTENER), 2);
+}
+#endif
+
 Document::~Document()
 {
     ASSERT(!renderer());
@@ -505,6 +521,10 @@
 
     m_scriptRunner.clear();
 
+#if PLATFORM(CHROMIUM)
+    histogramMutationEventUsage(m_listenerTypes);
+#endif
+
     removeAllEventListeners();
 
     // Currently we believe that Document can never outlive the parser.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to