Bug 702948 - Add telemetry to count how many ranges are detached; r=smaug
authorAryeh Gregor <ayg@aryeh.name>
Tue, 17 Apr 2012 17:36:22 +0300
changeset 91861 df9ea73ec1f4a437152e7a75c198f80803c4410b
parent 91860 f96f490bedabbcf1a171253d95d38affd1c04cca
child 91862 55f527f49d546342968ff99f5d4e14a15de557e5
push id22480
push useremorley@mozilla.com
push dateWed, 18 Apr 2012 00:48:48 +0000
treeherdermozilla-central@93dfd98900ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs702948
milestone14.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 702948 - Add telemetry to count how many ranges are detached; r=smaug
content/base/src/nsRange.cpp
toolkit/components/telemetry/TelemetryHistograms.h
--- a/content/base/src/nsRange.cpp
+++ b/content/base/src/nsRange.cpp
@@ -57,16 +57,19 @@
 #include "nsIDOMNodeList.h"
 #include "nsGkAtoms.h"
 #include "nsContentUtils.h"
 #include "nsGenericDOMDataNode.h"
 #include "nsClientRect.h"
 #include "nsLayoutUtils.h"
 #include "nsTextFrame.h"
 #include "nsFontFaceList.h"
+#include "mozilla/Telemetry.h"
+
+using namespace mozilla;
 
 nsresult NS_NewContentIterator(nsIContentIterator** aInstancePtrResult);
 nsresult NS_NewContentSubtreeIterator(nsIContentIterator** aInstancePtrResult);
 
 /******************************************************
  * stack based utilty class for managing monitor
  ******************************************************/
 
@@ -238,16 +241,19 @@ nsRange::IsNodeSelected(nsINode* aNode, 
 /******************************************************
  * constructor/destructor
  ******************************************************/
 
 nsRange::~nsRange() 
 {
   NS_ASSERTION(!IsInSelection(), "deleting nsRange that is in use");
 
+  // Maybe we can remove Detach() -- bug 702948.
+  Telemetry::Accumulate(Telemetry::DOM_RANGE_DETACHED, mIsDetached);
+
   // we want the side effects (releases and list removals)
   DoSetRange(nsnull, 0, nsnull, 0, nsnull);
 } 
 
 /* static */
 nsresult
 nsRange::CreateRange(nsIDOMNode* aStartParent, PRInt32 aStartOffset,
                      nsIDOMNode* aEndParent, PRInt32 aEndOffset,
--- a/toolkit/components/telemetry/TelemetryHistograms.h
+++ b/toolkit/components/telemetry/TelemetryHistograms.h
@@ -396,16 +396,17 @@ HISTOGRAM(XUL_INITIAL_FRAME_CONSTRUCTION
 HISTOGRAM_BOOLEAN(XMLHTTPREQUEST_ASYNC_OR_SYNC, "Type of XMLHttpRequest, async or sync")
 HISTOGRAM_BOOLEAN(MULTIPART_XHR_RESPONSE, "XMLHttpRequest response was of type multipart/x-mixed-replace.")
 
 /**
  * DOM telemetry.
  */
 HISTOGRAM(DOM_TIMERS_FIRED_PER_NATIVE_TIMEOUT, 1, 3000, 10, EXPONENTIAL, "DOM: Timer handlers called per native timer expiration")
 HISTOGRAM(DOM_TIMERS_RECENTLY_SET, 1, 3000, 10, EXPONENTIAL, "DOM: setTimeout/setInterval calls recently (last 30s or more)")
+HISTOGRAM_BOOLEAN(DOM_RANGE_DETACHED, "DOM: Ranges that are detached on destruction (bug 702948)")
 
 /**
  * DOM Storage telemetry.
  */
 #define DOMSTORAGE_HISTOGRAM(PREFIX, TYPE, TYPESTRING, DESCRIPTION) \
   HISTOGRAM(PREFIX ## DOMSTORAGE_ ## TYPE ## _SIZE_BYTES, \
             1024, 32768, 10, EXPONENTIAL, "DOM storage: size of " TYPESTRING "s stored in " DESCRIPTION "Storage")
 #define DOMSTORAGE_KEY_VAL_SIZE(PREFIX, DESCRIPTION) \