Revert "Issue #21 - Remove use counters telemetry"

This reverts commit 8ca9db6b65.
This commit is contained in:
roytam1 2022-04-27 16:25:00 +08:00
commit 92a1cc3139
45 changed files with 1128 additions and 36 deletions

View file

@ -24,6 +24,7 @@
#include "nsTHashtable.h" // for member
#include "mozilla/net/ReferrerPolicy.h" // for member
#include "nsWeakReference.h"
#include "mozilla/UseCounter.h"
#include "mozilla/WeakPtr.h"
#include "Units.h"
#include "nsContentListDeclarations.h"
@ -2781,6 +2782,23 @@ public:
bool DidFireDOMContentLoaded() const { return mDidFireDOMContentLoaded; }
void SetDocumentUseCounter(mozilla::UseCounter aUseCounter)
{
if (!mUseCounters[aUseCounter]) {
mUseCounters[aUseCounter] = true;
}
}
void SetPageUseCounter(mozilla::UseCounter aUseCounter);
void SetDocumentAndPageUseCounter(mozilla::UseCounter aUseCounter)
{
SetDocumentUseCounter(aUseCounter);
SetPageUseCounter(aUseCounter);
}
void PropagateUseCounters(nsIDocument* aParentDocument);
void SetUserHasInteracted(bool aUserHasInteracted)
{
mUserHasInteracted = aUserHasInteracted;
@ -2839,6 +2857,24 @@ public:
virtual void ScheduleResizeObserversNotification() const = 0;
protected:
bool GetUseCounter(mozilla::UseCounter aUseCounter)
{
return mUseCounters[aUseCounter];
}
void SetChildDocumentUseCounter(mozilla::UseCounter aUseCounter)
{
if (!mChildDocumentUseCounters[aUseCounter]) {
mChildDocumentUseCounters[aUseCounter] = true;
}
}
bool GetChildDocumentUseCounter(mozilla::UseCounter aUseCounter)
{
return mChildDocumentUseCounters[aUseCounter];
}
private:
mutable std::bitset<eDeprecatedOperationCount> mDeprecationWarnedAbout;
mutable std::bitset<eDocumentWarningCount> mDocWarningWarnedAbout;
@ -3279,7 +3315,15 @@ protected:
// Our live MediaQueryLists
PRCList mDOMMediaQueryLists;
// Whether the user has interacted with the document or not:
// Flags for use counters used directly by this document.
std::bitset<mozilla::eUseCounter_Count> mUseCounters;
// Flags for use counters used by any child documents of this document.
std::bitset<mozilla::eUseCounter_Count> mChildDocumentUseCounters;
// Flags for whether we've notified our top-level "page" of a use counter
// for this child document.
std::bitset<mozilla::eUseCounter_Count> mNotifiedPageForUseCounter;
// Whether the user has interacted with the document or not:
bool mUserHasInteracted;
mozilla::TimeStamp mPageUnloadingEventTimeStamp;