bug 679786 - telemetry reporting use of ISimpleDOM* interfaces r=surkov

This commit is contained in:
Trevor Saunders 2011-08-17 10:43:20 -07:00
parent 1c1fda0ffc
commit 2b5a1b6727
5 changed files with 31 additions and 11 deletions

View File

@ -49,6 +49,12 @@ namespace statistics {
inline void A11yInitialized()
{ Telemetry::Accumulate(Telemetry::A11Y_INSTANTIATED, true); }
/**
* Report that ISimpleDOM* has been used.
*/
inline void ISimpleDOMUsed()
{ Telemetry::Accumulate(Telemetry::ISIMPLE_DOM_USAGE, 1); }
} // namespace statistics
} // namespace a11y
} // namespace mozilla

View File

@ -46,6 +46,7 @@
#include "nsCoreUtils.h"
#include "nsRootAccessible.h"
#include "nsWinUtils.h"
#include "Statistics.h"
#include "nsAttrName.h"
#include "nsIDocument.h"
@ -59,6 +60,7 @@
#include "mozilla/Preferences.h"
using namespace mozilla;
using namespace mozilla::a11y;
/// the accessible library and cached methods
HINSTANCE nsAccessNodeWrap::gmAccLib = nsnull;
@ -120,11 +122,14 @@ STDMETHODIMP nsAccessNodeWrap::QueryInterface(REFIID iid, void** ppv)
{
*ppv = nsnull;
if (IID_IUnknown == iid || IID_ISimpleDOMNode == iid)
if (IID_IUnknown == iid) {
*ppv = static_cast<ISimpleDOMNode*>(this);
if (nsnull == *ppv)
} else if (IID_ISimpleDOMNode == iid) {
statistics::ISimpleDOMUsed();
*ppv = static_cast<ISimpleDOMNode*>(this);
} else {
return E_NOINTERFACE; //iid not supported.
}
(reinterpret_cast<IUnknown*>(*ppv))->AddRef();
return S_OK;

View File

@ -43,6 +43,7 @@
#include "nsIAccessibilityService.h"
#include "nsRootAccessible.h"
#include "nsWinUtils.h"
#include "Statistics.h"
#include "nsIDocShell.h"
#include "nsIDocShellTreeNode.h"
@ -54,6 +55,8 @@
#include "nsIViewManager.h"
#include "nsIWebNavigation.h"
using namespace mozilla::a11y;
/* For documentation of the accessibility architecture,
* see http://lxr.mozilla.org/seamonkey/source/accessible/accessible-docs.html
*/
@ -91,12 +94,11 @@ STDMETHODIMP nsDocAccessibleWrap::QueryInterface(REFIID iid, void** ppv)
{
*ppv = NULL;
if (IID_ISimpleDOMDocument == iid)
*ppv = static_cast<ISimpleDOMDocument*>(this);
if (NULL == *ppv)
if (IID_ISimpleDOMDocument != iid)
return nsHyperTextAccessibleWrap::QueryInterface(iid, ppv);
statistics::ISimpleDOMUsed();
*ppv = static_cast<ISimpleDOMDocument*>(this);
(reinterpret_cast<IUnknown*>(*ppv))->AddRef();
return S_OK;
}

View File

@ -41,6 +41,7 @@
#include "nsCoreUtils.h"
#include "nsDocAccessible.h"
#include "Statistics.h"
#include "nsIFrame.h"
#include "nsFontMetrics.h"
#include "nsPresContext.h"
@ -48,6 +49,8 @@
#include "gfxFont.h"
using namespace mozilla::a11y;
////////////////////////////////////////////////////////////////////////////////
// nsTextAccessibleWrap Accessible
////////////////////////////////////////////////////////////////////////////////
@ -72,11 +75,14 @@ STDMETHODIMP nsTextAccessibleWrap::QueryInterface(REFIID iid, void** ppv)
{
*ppv = nsnull;
if (IID_IUnknown == iid || IID_ISimpleDOMText == iid)
if (IID_IUnknown == iid) {
*ppv = static_cast<ISimpleDOMText*>(this);
if (nsnull == *ppv)
} else if (IID_ISimpleDOMText == iid) {
statistics::ISimpleDOMUsed();
*ppv = static_cast<ISimpleDOMText*>(this);
} else {
return nsAccessibleWrap::QueryInterface(iid, ppv);
}
(reinterpret_cast<IUnknown*>(*ppv))->AddRef();
return S_OK;

View File

@ -53,6 +53,7 @@
* a11y telemetry
*/
HISTOGRAM(A11Y_INSTANTIATED, 0, 1, 2, BOOLEAN, "has accessibility support been instantiated")
HISTOGRAM(ISIMPLE_DOM_USAGE, 0, 1, 2, BOOLEAN, "have the ISimpleDOM* accessibility interfaces been used")
HISTOGRAM(CYCLE_COLLECTOR, 1, 10000, 50, EXPONENTIAL, "Time spent on one cycle collection (ms)")
HISTOGRAM(CYCLE_COLLECTOR_VISITED_REF_COUNTED, 1, 300000, 50, EXPONENTIAL, "Number of ref counted objects visited by the cycle collector")