Bug 1460753 - Remove TelemetryScrollProbe. r=smaug

The probe is expired and there's no clear owner here so let's remove this
for now.

--HG--
extra : rebase_source : 51c332a790ce5081ce4645633991c3b9213a5d21
extra : source : 98d141e6d651b804cf35040a5c20be74b6fb6c7a
This commit is contained in:
Ryan Hunt 2018-06-26 17:31:27 -05:00
Родитель 54c056cf0b
Коммит 6f29815288
10 изменённых файлов: 1 добавлений и 205 удалений

Просмотреть файл

@ -25,7 +25,6 @@
#include "mozilla/dom/MessageManagerBinding.h" #include "mozilla/dom/MessageManagerBinding.h"
#include "mozilla/dom/MouseEventBinding.h" #include "mozilla/dom/MouseEventBinding.h"
#include "mozilla/dom/PaymentRequestChild.h" #include "mozilla/dom/PaymentRequestChild.h"
#include "mozilla/dom/TelemetryScrollProbe.h"
#include "mozilla/IMEStateManager.h" #include "mozilla/IMEStateManager.h"
#include "mozilla/ipc/URIUtils.h" #include "mozilla/ipc/URIUtils.h"
#include "mozilla/layers/APZChild.h" #include "mozilla/layers/APZChild.h"
@ -2751,8 +2750,6 @@ TabChild::InitTabChildGlobal()
return false; return false;
} }
scope->Init();
nsCOMPtr<nsPIWindowRoot> root = do_QueryInterface(chromeHandler); nsCOMPtr<nsPIWindowRoot> root = do_QueryInterface(chromeHandler);
if (NS_WARN_IF(!root)) { if (NS_WARN_IF(!root)) {
mTabChildGlobal = nullptr; mTabChildGlobal = nullptr;
@ -3505,12 +3502,6 @@ TabChildGlobal::~TabChildGlobal()
{ {
} }
void
TabChildGlobal::Init()
{
TelemetryScrollProbe::Create(this);
}
NS_IMPL_CYCLE_COLLECTION_CLASS(TabChildGlobal) NS_IMPL_CYCLE_COLLECTION_CLASS(TabChildGlobal)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(TabChildGlobal, NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(TabChildGlobal,

Просмотреть файл

@ -87,7 +87,7 @@ class TabChildGlobal : public ContentFrameMessageManager,
{ {
public: public:
explicit TabChildGlobal(TabChild* aTabChild); explicit TabChildGlobal(TabChild* aTabChild);
void Init();
NS_DECL_ISUPPORTS_INHERITED NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(TabChildGlobal, DOMEventTargetHelper) NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(TabChildGlobal, DOMEventTargetHelper)

Просмотреть файл

@ -1,89 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "TelemetryScrollProbe.h"
#include "nsIURI.h" // for nsIURI
#include "TabChild.h" // for TabChildGlobal, TabChildBase
#include "mozilla/Telemetry.h" // for mozilla::Telemetry
#include "mozilla/dom/Event.h" // for Event
namespace mozilla {
namespace dom {
/* static */ void
TelemetryScrollProbe::Create(TabChildGlobal* aWebFrame)
{
nsWeakPtr webNav = do_GetWeakReference(aWebFrame->mTabChild->WebNavigation());
RefPtr<TelemetryScrollProbe> probe = new TelemetryScrollProbe(webNav);
aWebFrame->AddEventListener(NS_LITERAL_STRING("pagehide"), probe, true);
}
already_AddRefed<nsIWebNavigation>
TelemetryScrollProbe::GetWebNavigation() const
{
nsCOMPtr<nsIWebNavigation> webNav = do_QueryReferent(mWebNav);
return webNav.forget();
}
already_AddRefed<nsIDocument>
TelemetryScrollProbe::GetDocument() const
{
nsCOMPtr<nsIDocument> result;
if (nsCOMPtr<nsIWebNavigation> webNav = GetWebNavigation()) {
webNav->GetDocument(getter_AddRefs(result));
}
return result.forget();
}
already_AddRefed<nsIPresShell>
TelemetryScrollProbe::GetPresShell() const
{
nsCOMPtr<nsIPresShell> result;
if (nsCOMPtr<nsIDocument> doc = GetDocument()) {
result = doc->GetShell();
}
return result.forget();
}
bool
TelemetryScrollProbe::ShouldIgnore(Event* aEvent) const
{
RefPtr<nsIDocument> document = GetDocument();
return !document ||
aEvent->GetTarget() != document ||
nsContentUtils::IsSystemPrincipal(document->NodePrincipal());
}
NS_IMPL_ISUPPORTS(TelemetryScrollProbe, nsIDOMEventListener)
NS_IMETHODIMP
TelemetryScrollProbe::HandleEvent(Event* aEvent)
{
RefPtr<nsIPresShell> presShell = GetPresShell();
if (!presShell || ShouldIgnore(aEvent)) {
return NS_OK;
}
RefPtr<nsPresContext> presContext = presShell->GetPresContext();
nscoord maxAppUnits = presContext->TelemetryScrollMaxY();
nscoord totalAppUnits = presContext->TelemetryScrollTotalY();
float maxCSSPixels = nsPresContext::AppUnitsToFloatCSSPixels(maxAppUnits);
float totalCSSPixels = nsPresContext::AppUnitsToFloatCSSPixels(totalAppUnits);
mozilla::Telemetry::Accumulate(mozilla::Telemetry::TOTAL_SCROLL_Y, totalCSSPixels);
mozilla::Telemetry::Accumulate(mozilla::Telemetry::PAGE_MAX_SCROLL_Y, maxCSSPixels);
return NS_OK;
}
} // namespace dom
} // namespace mozilla

Просмотреть файл

@ -1,54 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_dom_TelemetryScrollProbe_h
#define mozilla_dom_TelemetryScrollProbe_h
#include "nsIDOMEventListener.h"
class nsIDocument;
class nsIPresShell;
class nsIWebNavigation;
namespace mozilla {
namespace dom {
class Event;
class TabChildGlobal;
/*
* A class for implementing a telemetry scroll probe, listens to
* pagehide events in a frame script context and records the
* max scroll y, and amount of vertical scrolling that ocurred.
* for more information see bug 1340904
*/
class TelemetryScrollProbe final : public nsIDOMEventListener
{
public:
static void Create(TabChildGlobal* aWebFrame);
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMEVENTLISTENER
private:
explicit TelemetryScrollProbe(nsWeakPtr aWebNav)
: mWebNav(aWebNav)
{ }
~TelemetryScrollProbe() {}
already_AddRefed<nsIWebNavigation> GetWebNavigation() const;
already_AddRefed<nsIDocument> GetDocument() const;
already_AddRefed<nsIPresShell> GetPresShell() const;
bool ShouldIgnore(Event* aEvent) const;
nsWeakPtr mWebNav;
};
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_TelemetryScrollProbe_h

Просмотреть файл

@ -39,7 +39,6 @@ EXPORTS.mozilla.dom += [
'TabContext.h', 'TabContext.h',
'TabMessageUtils.h', 'TabMessageUtils.h',
'TabParent.h', 'TabParent.h',
'TelemetryScrollProbe.h',
'URLClassifierChild.h', 'URLClassifierChild.h',
'URLClassifierParent.h', 'URLClassifierParent.h',
] ]
@ -73,7 +72,6 @@ UNIFIED_SOURCES += [
'TabContext.cpp', 'TabContext.cpp',
'TabMessageUtils.cpp', 'TabMessageUtils.cpp',
'TabParent.cpp', 'TabParent.cpp',
'TelemetryScrollProbe.cpp',
'URLClassifierParent.cpp', 'URLClassifierParent.cpp',
] ]

Просмотреть файл

@ -220,9 +220,6 @@ nsPresContext::nsPresContext(nsIDocument* aDocument, nsPresContextType aType)
mFramesConstructed(0), mFramesConstructed(0),
mFramesReflowed(0), mFramesReflowed(0),
mInteractionTimeEnabled(true), mInteractionTimeEnabled(true),
mTelemetryScrollLastY(0),
mTelemetryScrollMaxY(0),
mTelemetryScrollTotalY(0),
mHasPendingInterrupt(false), mHasPendingInterrupt(false),
mPendingInterruptFromTest(false), mPendingInterruptFromTest(false),
mInterruptsEnabled(false), mInterruptsEnabled(false),

Просмотреть файл

@ -936,29 +936,6 @@ public:
return mFramesReflowed; return mFramesReflowed;
} }
/*
* Helper functions for a telemetry scroll probe
* for more information see bug 1340904
*/
void SetTelemetryScrollY(nscoord aScrollY)
{
nscoord delta = abs(aScrollY - mTelemetryScrollLastY);
mTelemetryScrollLastY = aScrollY;
mTelemetryScrollTotalY += delta;
if (aScrollY > mTelemetryScrollMaxY) {
mTelemetryScrollMaxY = aScrollY;
}
}
nscoord TelemetryScrollMaxY() const
{
return mTelemetryScrollMaxY;
}
nscoord TelemetryScrollTotalY() const
{
return mTelemetryScrollTotalY;
}
static nscoord GetBorderWidthForKeyword(unsigned int aBorderWidthKeyword) static nscoord GetBorderWidthForKeyword(unsigned int aBorderWidthKeyword)
{ {
// This table maps border-width enums 'thin', 'medium', 'thick' // This table maps border-width enums 'thin', 'medium', 'thick'
@ -1426,10 +1403,6 @@ protected:
// last time we did a full style flush // last time we did a full style flush
mozilla::TimeStamp mLastStyleUpdateForAllAnimations; mozilla::TimeStamp mLastStyleUpdateForAllAnimations;
nscoord mTelemetryScrollLastY;
nscoord mTelemetryScrollMaxY;
nscoord mTelemetryScrollTotalY;
unsigned mHasPendingInterrupt : 1; unsigned mHasPendingInterrupt : 1;
unsigned mPendingInterruptFromTest : 1; unsigned mPendingInterruptFromTest : 1;
unsigned mInterruptsEnabled : 1; unsigned mInterruptsEnabled : 1;

Просмотреть файл

@ -4988,7 +4988,6 @@ ScrollFrameHelper::FireScrollEvent()
if (mIsRoot) { if (mIsRoot) {
nsIDocument* doc = content->GetUncomposedDoc(); nsIDocument* doc = content->GetUncomposedDoc();
if (doc) { if (doc) {
prescontext->SetTelemetryScrollY(GetScrollPosition().y);
EventDispatcher::Dispatch(doc, prescontext, &event, nullptr, &status); EventDispatcher::Dispatch(doc, prescontext, &event, nullptr, &status);
} }
} else { } else {

Просмотреть файл

@ -12205,24 +12205,6 @@
"releaseChannelCollection": "opt-out", "releaseChannelCollection": "opt-out",
"description": "Graphics Crash Reason (...)" "description": "Graphics Crash Reason (...)"
}, },
"TOTAL_SCROLL_Y": {
"record_in_processes": ["main", "content"],
"alert_emails": ["hkirschner@mozilla.com"],
"bug_numbers": [1297867],
"expires_in_version": "58",
"kind": "count",
"description": "Count of the total number of CSS pixels scrolled up or down in the vertical axis of the root frame of all the pages visited in a subsession. This doesn't include any scrolling of nested scroll frames such as inputs, iframes, or scrollable divs."
},
"PAGE_MAX_SCROLL_Y": {
"record_in_processes": ["main", "content"],
"alert_emails": ["hkirschner@mozilla.com"],
"bug_numbers": [1312881],
"expires_in_version": "58",
"kind": "exponential",
"high": 100000,
"n_buckets": 50,
"description": "Maximum distance in CSS pixels a user scrolls down the vertical axis of the root frame of a page. This doesn't include any scrolling of nested scroll frames such as inputs, iframes, or scrollable divs."
},
"WEB_NOTIFICATION_CLICKED": { "WEB_NOTIFICATION_CLICKED": {
"record_in_processes": ["main", "content"], "record_in_processes": ["main", "content"],
"releaseChannelCollection": "opt-out", "releaseChannelCollection": "opt-out",

Просмотреть файл

@ -1644,7 +1644,6 @@
"TELEMETRY_TEST_RELEASE_OPTOUT", "TELEMETRY_TEST_RELEASE_OPTOUT",
"TOP_LEVEL_CONTENT_DOCUMENTS_DESTROYED", "TOP_LEVEL_CONTENT_DOCUMENTS_DESTROYED",
"TOTAL_CONTAINERS_OPENED", "TOTAL_CONTAINERS_OPENED",
"TOTAL_SCROLL_Y",
"TRANSLATED_PAGES", "TRANSLATED_PAGES",
"TRANSLATED_PAGES_BY_LANGUAGE", "TRANSLATED_PAGES_BY_LANGUAGE",
"UNIQUE_CONTAINERS_OPENED", "UNIQUE_CONTAINERS_OPENED",