Bug 1299718 part 2 - implement the MarkAsContentSource() API; r=gerald,kamidphish
MozReview-Commit-ID: 1eAdcMAmXSB
This commit is contained in:
committed by
Dan Glastonbury
parent
f7eaba79c8
commit
3e4dcf7643
@@ -2925,7 +2925,8 @@ HTMLMediaElement::HTMLMediaElement(already_AddRefed<mozilla::dom::NodeInfo>& aNo
|
||||
mFirstFrameLoaded(false),
|
||||
mDefaultPlaybackStartPosition(0.0),
|
||||
mIsAudioTrackAudible(false),
|
||||
mAudible(IsAudible())
|
||||
mAudible(IsAudible()),
|
||||
mVisibilityState(Visibility::APPROXIMATELY_NONVISIBLE)
|
||||
{
|
||||
ErrorResult rv;
|
||||
|
||||
@@ -6039,6 +6040,8 @@ HTMLMediaElement::OnVisibilityChange(Visibility aNewVisibility)
|
||||
LOG(LogLevel::Debug, ("OnVisibilityChange(): %s\n",
|
||||
VisibilityString(aNewVisibility)));
|
||||
|
||||
mVisibilityState = aNewVisibility;
|
||||
|
||||
if (!mDecoder) {
|
||||
return;
|
||||
}
|
||||
@@ -6589,5 +6592,66 @@ HTMLMediaElement::NotifyCueDisplayStatesChanged()
|
||||
mTextTrackManager->DispatchUpdateCueDisplay();
|
||||
}
|
||||
|
||||
void
|
||||
HTMLMediaElement::MarkAsContentSource(CallerAPI aAPI)
|
||||
{
|
||||
const bool isVisible = mVisibilityState != Visibility::APPROXIMATELY_NONVISIBLE;
|
||||
|
||||
if (isVisible) {
|
||||
// 0 = ALL_VISIBLE
|
||||
Telemetry::Accumulate(Telemetry::VIDEO_AS_CONTENT_SOURCE, 0);
|
||||
} else {
|
||||
// 1 = ALL_INVISIBLE
|
||||
Telemetry::Accumulate(Telemetry::VIDEO_AS_CONTENT_SOURCE, 1);
|
||||
}
|
||||
|
||||
switch (aAPI) {
|
||||
case CallerAPI::DRAW_IMAGE: {
|
||||
if (isVisible) {
|
||||
// 2 = drawImage_VISIBLE
|
||||
Telemetry::Accumulate(Telemetry::VIDEO_AS_CONTENT_SOURCE, 2);
|
||||
} else {
|
||||
// 3 = drawImage_INVISIBLE
|
||||
Telemetry::Accumulate(Telemetry::VIDEO_AS_CONTENT_SOURCE, 3);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CallerAPI::CREATE_PATTERN: {
|
||||
if (isVisible) {
|
||||
// 4 = createPattern_VISIBLE
|
||||
Telemetry::Accumulate(Telemetry::VIDEO_AS_CONTENT_SOURCE, 4);
|
||||
} else {
|
||||
// 5 = createPattern_INVISIBLE
|
||||
Telemetry::Accumulate(Telemetry::VIDEO_AS_CONTENT_SOURCE, 5);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CallerAPI::CREATE_IMAGEBITMAP: {
|
||||
if (isVisible) {
|
||||
// 6 = createImageBitmap_VISIBLE
|
||||
Telemetry::Accumulate(Telemetry::VIDEO_AS_CONTENT_SOURCE, 6);
|
||||
} else {
|
||||
// 7 = createImageBitmap_INVISIBLE
|
||||
Telemetry::Accumulate(Telemetry::VIDEO_AS_CONTENT_SOURCE, 7);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CallerAPI::CAPTURE_STREAM: {
|
||||
if (isVisible) {
|
||||
// 8 = captureStream_VISIBLE
|
||||
Telemetry::Accumulate(Telemetry::VIDEO_AS_CONTENT_SOURCE, 8);
|
||||
} else {
|
||||
// 9 = captureStream_INVISIBLE
|
||||
Telemetry::Accumulate(Telemetry::VIDEO_AS_CONTENT_SOURCE, 9);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
LOG(LogLevel::Debug,
|
||||
("%p Log VIDEO_AS_CONTENT_SOURCE: visibility = %u, API: '%d' and 'All'",
|
||||
this, isVisible, aAPI));
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
Reference in New Issue
Block a user