Skip to content
This repository was archived by the owner on Jun 24, 2022. It is now read-only.

Commit 2206b55

Browse files
[MutationObservers] Add histogram collection for usage of DOM Mutation Events
https://bugs.webkit.org/show_bug.cgi?id=72316 Patch by Rafael Weinstein <[email protected]> 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): git-svn-id: http://svn.webkit.org/repository/webkit/trunk@100222 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 6b2e797 commit 2206b55

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

Source/WebCore/ChangeLog

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
2011-11-14 Rafael Weinstein <[email protected]>
2+
3+
[MutationObservers] Add histogram collection for usage of DOM Mutation Events
4+
https://bugs.webkit.org/show_bug.cgi?id=72316
5+
6+
Reviewed by Ryosuke Niwa.
7+
8+
This patch adds six calls in ~Document() which simply pipe-out to the embedder
9+
the (already-collected) bits of whether varous DOM Mutation Events were registered
10+
on the document.
11+
12+
No tests needed. No functional changes.
13+
14+
* dom/Document.cpp:
15+
(WebCore::histogramMutationEventUsage):
16+
(WebCore::Document::~Document):
17+
118
2011-11-14 Simon Fraser <[email protected]>
219

320
div with webkit-transform + webkit-box-reflect disappears when switching tabs

Source/WebCore/dom/Document.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,10 @@
157157
#include <wtf/StdLibExtras.h>
158158
#include <wtf/text/StringBuffer.h>
159159

160+
#if PLATFORM(CHROMIUM)
161+
#include "PlatformSupport.h"
162+
#endif
163+
160164
#if ENABLE(SHARED_WORKERS)
161165
#include "SharedWorkerRepository.h"
162166
#endif
@@ -493,6 +497,18 @@ Document::Document(Frame* frame, const KURL& url, bool isXHTML, bool isHTML)
493497
m_docID = docID++;
494498
}
495499

500+
#if PLATFORM(CHROMIUM)
501+
static void histogramMutationEventUsage(const unsigned short& listenerTypes)
502+
{
503+
PlatformSupport::histogramEnumeration("DOMAPI.PerDocumentMutationEventUsage.DOMSubtreeModified", static_cast<bool>(listenerTypes & Document::DOMSUBTREEMODIFIED_LISTENER), 2);
504+
PlatformSupport::histogramEnumeration("DOMAPI.PerDocumentMutationEventUsage.DOMNodeInserted", static_cast<bool>(listenerTypes & Document::DOMNODEINSERTED_LISTENER), 2);
505+
PlatformSupport::histogramEnumeration("DOMAPI.PerDocumentMutationEventUsage.DOMNodeRemoved", static_cast<bool>(listenerTypes & Document::DOMNODEREMOVED_LISTENER), 2);
506+
PlatformSupport::histogramEnumeration("DOMAPI.PerDocumentMutationEventUsage.DOMNodeRemovedFromDocument", static_cast<bool>(listenerTypes & Document::DOMNODEREMOVEDFROMDOCUMENT_LISTENER), 2);
507+
PlatformSupport::histogramEnumeration("DOMAPI.PerDocumentMutationEventUsage.DOMNodeInsertedIntoDocument", static_cast<bool>(listenerTypes & Document::DOMNODEINSERTEDINTODOCUMENT_LISTENER), 2);
508+
PlatformSupport::histogramEnumeration("DOMAPI.PerDocumentMutationEventUsage.DOMCharacterDataModified", static_cast<bool>(listenerTypes & Document::DOMCHARACTERDATAMODIFIED_LISTENER), 2);
509+
}
510+
#endif
511+
496512
Document::~Document()
497513
{
498514
ASSERT(!renderer());
@@ -505,6 +521,10 @@ Document::~Document()
505521

506522
m_scriptRunner.clear();
507523

524+
#if PLATFORM(CHROMIUM)
525+
histogramMutationEventUsage(m_listenerTypes);
526+
#endif
527+
508528
removeAllEventListeners();
509529

510530
// Currently we believe that Document can never outlive the parser.

0 commit comments

Comments
 (0)