зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1652108 - part2 : modify `page_had_media_count` to `in_page_count` r=nika,bryce
We would like to remove `page_had_media_count` and use a new probe `in_page_count` to record the total number of top level content documents using media. Therefore, we would rename WindowContext's `DocTreeHadAudibleMedia` to `DocTreeHadMedia` in order to support the new usage. In the future, if we want to know something like "the percentage of media element is being used for MSE/EME?", then this scalar can be the base and used to calculate the answser. Differential Revision: https://phabricator.services.mozilla.com/D83225
This commit is contained in:
Родитель
ffa3de4adc
Коммит
37f127c8f3
|
@ -197,7 +197,7 @@ bool WindowContext::CanSet(FieldIndex<IDX_IsOriginalFrameSource>,
|
|||
return CheckOnlyOwningProcessCanSet(aSource);
|
||||
}
|
||||
|
||||
bool WindowContext::CanSet(FieldIndex<IDX_DocTreeHadAudibleMedia>,
|
||||
bool WindowContext::CanSet(FieldIndex<IDX_DocTreeHadMedia>,
|
||||
const bool& aValue, ContentParent* aSource) {
|
||||
return IsTop();
|
||||
}
|
||||
|
|
|
@ -63,9 +63,9 @@ class BrowsingContextGroup;
|
|||
* activated by a gesture */ \
|
||||
FIELD(UserActivationState, UserActivation::State) \
|
||||
FIELD(EmbedderPolicy, nsILoadInfo::CrossOriginEmbedderPolicy) \
|
||||
/* True if this document tree contained an HTMLMediaElement that \
|
||||
* played audibly. This should only be set on top level context. */ \
|
||||
FIELD(DocTreeHadAudibleMedia, bool) \
|
||||
/* True if this document tree contained at least a HTMLMediaElement. \
|
||||
* This should only be set on top level context. */ \
|
||||
FIELD(DocTreeHadMedia, bool) \
|
||||
FIELD(AutoplayPermission, uint32_t) \
|
||||
FIELD(ShortcutsPermission, uint32_t) \
|
||||
/* Store the Id of the browsing context where active media session \
|
||||
|
@ -218,7 +218,7 @@ class WindowContext : public nsISupports, public nsWrapperCache {
|
|||
ContentParent* aSource);
|
||||
bool CanSet(FieldIndex<IDX_IsOriginalFrameSource>,
|
||||
const bool& aIsOriginalFrameSource, ContentParent* aSource);
|
||||
bool CanSet(FieldIndex<IDX_DocTreeHadAudibleMedia>, const bool& aValue,
|
||||
bool CanSet(FieldIndex<IDX_DocTreeHadMedia>, const bool& aValue,
|
||||
ContentParent* aSource);
|
||||
bool CanSet(FieldIndex<IDX_AutoplayPermission>, const uint32_t& aValue,
|
||||
ContentParent* aSource);
|
||||
|
|
|
@ -15544,10 +15544,10 @@ bool Document::ConsumeTransientUserGestureActivation() {
|
|||
return wc && wc->ConsumeTransientUserGestureActivation();
|
||||
}
|
||||
|
||||
void Document::SetDocTreeHadAudibleMedia() {
|
||||
void Document::SetDocTreeHadMedia() {
|
||||
RefPtr<WindowContext> topWc = GetTopLevelWindowContext();
|
||||
if (topWc && !topWc->IsDiscarded() && !topWc->GetDocTreeHadAudibleMedia()) {
|
||||
MOZ_ALWAYS_SUCCEEDS(topWc->SetDocTreeHadAudibleMedia(true));
|
||||
if (topWc && !topWc->IsDiscarded() && !topWc->GetDocTreeHadMedia()) {
|
||||
MOZ_ALWAYS_SUCCEEDS(topWc->SetDocTreeHadMedia(true));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3895,8 +3895,8 @@ class Document : public nsINode,
|
|||
|
||||
void ReportShadowDOMUsage();
|
||||
|
||||
// Sets flags for media autoplay telemetry.
|
||||
void SetDocTreeHadAudibleMedia();
|
||||
// Sets flags for media telemetry.
|
||||
void SetDocTreeHadMedia();
|
||||
|
||||
dom::XPathEvaluator* XPathEvaluator();
|
||||
|
||||
|
|
|
@ -4168,6 +4168,7 @@ void HTMLMediaElement::Init() {
|
|||
OwnerDoc()->GetInnerWindow());
|
||||
#endif
|
||||
|
||||
OwnerDoc()->SetDocTreeHadMedia();
|
||||
mShutdownObserver->Subscribe(this);
|
||||
mInitialized = true;
|
||||
}
|
||||
|
@ -4261,7 +4262,6 @@ void HTMLMediaElement::UpdateHadAudibleAutoplayState() {
|
|||
// If we're audible, and autoplaying...
|
||||
if ((Volume() > 0.0 && !Muted()) &&
|
||||
(!OwnerDoc()->HasBeenUserGestureActivated() || Autoplay())) {
|
||||
OwnerDoc()->SetDocTreeHadAudibleMedia();
|
||||
if (AutoplayPolicyTelemetryUtils::WouldBeAllowedToPlayIfAutoplayDisabled(
|
||||
*this)) {
|
||||
ScalarAdd(Telemetry::ScalarID::MEDIA_AUTOPLAY_WOULD_BE_ALLOWED_COUNT, 1);
|
||||
|
|
|
@ -994,8 +994,8 @@ void WindowGlobalParent::ActorDestroy(ActorDestroyReason aWhy) {
|
|||
}
|
||||
Accumulate(Telemetry::MIXED_CONTENT_PAGE_LOAD, mixedContentLevel);
|
||||
|
||||
if (GetDocTreeHadAudibleMedia()) {
|
||||
ScalarAdd(Telemetry::ScalarID::MEDIA_PAGE_HAD_MEDIA_COUNT, 1);
|
||||
if (GetDocTreeHadMedia()) {
|
||||
ScalarAdd(Telemetry::ScalarID::MEDIA_ELEMENT_IN_PAGE_COUNT, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2119,24 +2119,24 @@ mediarecorder:
|
|||
- content
|
||||
|
||||
media:
|
||||
page_had_media_count:
|
||||
element_in_page_count:
|
||||
bug_numbers:
|
||||
- 1476456
|
||||
- 1499803
|
||||
- 1570634
|
||||
- 1652108
|
||||
description: >
|
||||
The number of times a document hierarchy contained at least one audible HTMLMediaElement that had play() called upon it.
|
||||
expires: "74"
|
||||
The number of times a document hierarchy contained at least one HTMLMediaElement. In addition, the telemetry probe 'MIXED_CONTENT_UNBLOCK_COUNTER' records the total number of loaded top level content documents, which can help us calculate the result of the percentage of documents using media.
|
||||
expires: never
|
||||
kind: uint
|
||||
notification_emails:
|
||||
- cpearce@mozilla.com
|
||||
- alwu@mozilla.com
|
||||
- nohlmeier@mozilla.com
|
||||
release_channel_collection: opt-out
|
||||
products:
|
||||
- 'firefox'
|
||||
record_in_processes:
|
||||
- content
|
||||
- main
|
||||
|
||||
autoplay_would_not_be_allowed_count:
|
||||
bug_numbers:
|
||||
|
|
Загрузка…
Ссылка в новой задаче