Commit bbe6013d authored by Matt Wolenetz's avatar Matt Wolenetz Committed by Commit Bot

MSE-in-Workers: Drop dependency on HTMLME for recording counters

Upcoming worker-context-hosted MSE code paths will need to be distanced
from relying directly upon the main-thread-hosted HTMLMediaElement.

This change breaks one such strong dependency in MSE implementation by
using the already-known execution context in MediaSource and
SourceBuffer directly to record deprecation and usecounters, instead of
consulting to use the UseCounter context of the attached media element.

Also includes a necessary set of braces to fix a pre-existing style
error flagged this time by presubmit.

BUG=878133

Change-Id: I74b3ba0e9e11f866ffc1ec08376e045cee31efbd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2382678
Commit-Queue: Matthew Wolenetz <wolenetz@chromium.org>
Reviewed-by: default avatarWill Cassella <cassew@google.com>
Cr-Commit-Position: refs/heads/master@{#803621}
parent aa8379cd
...@@ -606,7 +606,7 @@ void MediaSource::DurationChangeAlgorithm(double new_duration, ...@@ -606,7 +606,7 @@ void MediaSource::DurationChangeAlgorithm(double new_duration,
} }
Deprecation::CountDeprecation( Deprecation::CountDeprecation(
attached_element_->GetExecutionContext(), GetExecutionContext(),
WebFeature::kMediaSourceDurationTruncatingBuffered); WebFeature::kMediaSourceDurationTruncatingBuffered);
// See also deprecated remove(new duration, old duration) behavior below. // See also deprecated remove(new duration, old duration) behavior below.
} }
...@@ -625,9 +625,10 @@ void MediaSource::DurationChangeAlgorithm(double new_duration, ...@@ -625,9 +625,10 @@ void MediaSource::DurationChangeAlgorithm(double new_duration,
// Deprecated behavior: if the new duration is less than old duration, // Deprecated behavior: if the new duration is less than old duration,
// then call remove(new duration, old duration) on all all objects in // then call remove(new duration, old duration) on all all objects in
// sourceBuffers. // sourceBuffers.
for (unsigned i = 0; i < source_buffers_->length(); ++i) for (unsigned i = 0; i < source_buffers_->length(); ++i) {
source_buffers_->item(i)->remove(new_duration, old_duration, source_buffers_->item(i)->remove(new_duration, old_duration,
ASSERT_NO_EXCEPTION); ASSERT_NO_EXCEPTION);
}
} }
// 5. If a user agent is unable to partially render audio frames or text cues // 5. If a user agent is unable to partially render audio frames or text cues
......
...@@ -416,9 +416,8 @@ void SourceBuffer::abort(ExceptionState& exception_state) { ...@@ -416,9 +416,8 @@ void SourceBuffer::abort(ExceptionState& exception_state) {
return; return;
} }
Deprecation::CountDeprecation( Deprecation::CountDeprecation(GetExecutionContext(),
source_->MediaElement()->GetExecutionContext(), WebFeature::kMediaSourceAbortRemove);
WebFeature::kMediaSourceAbortRemove);
CancelRemove(); CancelRemove();
} }
...@@ -1131,7 +1130,7 @@ void SourceBuffer::NotifyParseWarning(const ParseWarning warning) { ...@@ -1131,7 +1130,7 @@ void SourceBuffer::NotifyParseWarning(const ParseWarning warning) {
// TODO(wolenetz): Use the data to scope additional work. See // TODO(wolenetz): Use the data to scope additional work. See
// https://crbug.com/739931. // https://crbug.com/739931.
UseCounter::Count( UseCounter::Count(
source_->MediaElement()->GetDocument(), GetExecutionContext(),
WebFeature::kMediaSourceKeyframeTimeGreaterThanDependant); WebFeature::kMediaSourceKeyframeTimeGreaterThanDependant);
break; break;
case WebSourceBufferClient::kMuxedSequenceMode: case WebSourceBufferClient::kMuxedSequenceMode:
...@@ -1140,7 +1139,7 @@ void SourceBuffer::NotifyParseWarning(const ParseWarning warning) { ...@@ -1140,7 +1139,7 @@ void SourceBuffer::NotifyParseWarning(const ParseWarning warning) {
// SourceBuffer, at Media.OriginUrl.MSE.MuxedSequenceModeSourceBuffer. // SourceBuffer, at Media.OriginUrl.MSE.MuxedSequenceModeSourceBuffer.
// TODO(wolenetz): Use the data to scope additional work. See // TODO(wolenetz): Use the data to scope additional work. See
// https://crbug.com/737757. // https://crbug.com/737757.
UseCounter::Count(source_->MediaElement()->GetDocument(), UseCounter::Count(GetExecutionContext(),
WebFeature::kMediaSourceMuxedSequenceMode); WebFeature::kMediaSourceMuxedSequenceMode);
break; break;
case WebSourceBufferClient::kGroupEndTimestampDecreaseWithinMediaSegment: case WebSourceBufferClient::kGroupEndTimestampDecreaseWithinMediaSegment:
...@@ -1150,7 +1149,7 @@ void SourceBuffer::NotifyParseWarning(const ParseWarning warning) { ...@@ -1150,7 +1149,7 @@ void SourceBuffer::NotifyParseWarning(const ParseWarning warning) {
// https://crbug.com/920853 and // https://crbug.com/920853 and
// https://github.com/w3c/media-source/issues/203. // https://github.com/w3c/media-source/issues/203.
UseCounter::Count( UseCounter::Count(
source_->MediaElement()->GetDocument(), GetExecutionContext(),
WebFeature::kMediaSourceGroupEndTimestampDecreaseWithinMediaSegment); WebFeature::kMediaSourceGroupEndTimestampDecreaseWithinMediaSegment);
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment