Commit 0be1f30b authored by Matt Wolenetz's avatar Matt Wolenetz Committed by Commit Bot

MSE: Rename media and modules MediaSource classes

Renames HTMLMediaSource (in core/html/media) to be MediaSource, and
renames MediaSource (in modules/mediasource) to be MediaSourceImpl. This
follows more recent practice in core/html/media. See also related code
review comment [1].

[1] http://crrev.com/c/2003402/9/third_party/blink/renderer/core/html/media/html_media_source.h#50

BUG=878133

Change-Id: I143718c2b9bf8a2e32ad29e31c15094ae32da3fc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2065421Reviewed-by: default avatarMounir Lamouri <mlamouri@chromium.org>
Reviewed-by: default avatarPhilip Jägenstedt <foolip@chromium.org>
Commit-Queue: Matthew Wolenetz <wolenetz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#743201}
parent a1fa8097
......@@ -476,8 +476,6 @@ blink_core_sources("html") {
"media/html_media_element.h",
"media/html_media_element_controls_list.cc",
"media/html_media_element_controls_list.h",
"media/html_media_source.cc",
"media/html_media_source.h",
"media/html_video_element.cc",
"media/html_video_element.h",
"media/media_controls.cc",
......@@ -493,6 +491,8 @@ blink_core_sources("html") {
"media/media_fragment_uri_parser.h",
"media/media_remoting_interstitial.cc",
"media/media_remoting_interstitial.h",
"media/media_source.cc",
"media/media_source.h",
"media/picture_in_picture_interstitial.cc",
"media/picture_in_picture_interstitial.h",
"media/remote_playback_controller.cc",
......
......@@ -70,10 +70,10 @@
#include "third_party/blink/renderer/core/html/html_source_element.h"
#include "third_party/blink/renderer/core/html/media/autoplay_policy.h"
#include "third_party/blink/renderer/core/html/media/html_media_element_controls_list.h"
#include "third_party/blink/renderer/core/html/media/html_media_source.h"
#include "third_party/blink/renderer/core/html/media/media_controls.h"
#include "third_party/blink/renderer/core/html/media/media_error.h"
#include "third_party/blink/renderer/core/html/media/media_fragment_uri_parser.h"
#include "third_party/blink/renderer/core/html/media/media_source.h"
#include "third_party/blink/renderer/core/html/time_ranges.h"
#include "third_party/blink/renderer/core/html/track/audio_track.h"
#include "third_party/blink/renderer/core/html/track/audio_track_list.h"
......@@ -1190,7 +1190,7 @@ void HTMLMediaElement::LoadResource(const WebMediaPlayerSource& source,
bool attempt_load = true;
media_source_ = HTMLMediaSource::Lookup(url.GetString());
media_source_ = MediaSource::Lookup(url.GetString());
if (media_source_) {
if (media_source_->AttachToElement(this)) {
// If the associated feature is enabled, auto-revoke the MediaSource
......
......@@ -65,7 +65,7 @@ class Event;
class EventQueue;
class ExceptionState;
class HTMLMediaElementControlsList;
class HTMLMediaSource;
class MediaSource;
class HTMLSourceElement;
class HTMLTrackElement;
class MediaError;
......@@ -628,12 +628,12 @@ class CORE_EXPORT HTMLMediaElement
// If any portion of an attached HTMLMediaElement (HTMLME) and the MediaSource
// Extensions (MSE) API is alive (having pending activity or traceable from a
// GC root), the whole group is not GC'ed. Here, using Member,
// instead of Member, because |media_source_|'s wrapper needs to remain alive
// at least to successfully dispatch any events enqueued by behavior of the
// HTMLME+MSE API. It makes |media_source_|'s wrapper remain alive as long as
// this HTMLMediaElement's wrapper is alive.
Member<HTMLMediaSource> media_source_;
// GC root), the whole group is not GC'ed. Here, using Member, because
// |media_source_|'s wrapper needs to remain alive at least to successfully
// dispatch any events enqueued by behavior of the HTMLME+MSE API. It makes
// |media_source_|'s wrapper remain alive as long as this HTMLMediaElement's
// wrapper is alive.
Member<MediaSource> media_source_;
// Stores "official playback position", updated periodically from "current
// playback position". Official playback position should not change while
......
......@@ -28,13 +28,13 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "third_party/blink/renderer/core/html/media/html_media_source.h"
#include "third_party/blink/renderer/core/html/media/media_source.h"
namespace blink {
URLRegistry* HTMLMediaSource::registry_ = nullptr;
URLRegistry* MediaSource::registry_ = nullptr;
void HTMLMediaSource::SetRegistry(URLRegistry* registry) {
void MediaSource::SetRegistry(URLRegistry* registry) {
DCHECK(!registry_);
registry_ = registry;
}
......
......@@ -28,8 +28,8 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_HTML_MEDIA_HTML_MEDIA_SOURCE_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_HTML_MEDIA_HTML_MEDIA_SOURCE_H_
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_HTML_MEDIA_MEDIA_SOURCE_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_HTML_MEDIA_MEDIA_SOURCE_H_
#include <memory>
#include "third_party/blink/public/platform/web_time_range.h"
......@@ -45,12 +45,12 @@ class HTMLMediaElement;
class TimeRanges;
class TrackBase;
class CORE_EXPORT HTMLMediaSource : public URLRegistrable,
public GarbageCollectedMixin {
class CORE_EXPORT MediaSource : public URLRegistrable,
public GarbageCollectedMixin {
public:
static void SetRegistry(URLRegistry*);
static HTMLMediaSource* Lookup(const String& url) {
return registry_ ? static_cast<HTMLMediaSource*>(registry_->Lookup(url))
static MediaSource* Lookup(const String& url) {
return registry_ ? static_cast<MediaSource*>(registry_->Lookup(url))
: nullptr;
}
......@@ -87,4 +87,4 @@ class CORE_EXPORT HTMLMediaSource : public URLRegistrable,
} // namespace blink
#endif
#endif // THIRD_PARTY_BLINK_RENDERER_CORE_HTML_MEDIA_MEDIA_SOURCE_H_
......@@ -11,7 +11,6 @@
#include "third_party/blink/renderer/core/frame/settings.h"
#include "third_party/blink/renderer/core/html/media/html_media_element.h"
#include "third_party/blink/renderer/core/html/media/html_media_element_controls_list.h"
#include "third_party/blink/renderer/core/html/media/html_media_source.h"
#include "third_party/blink/renderer/core/input_type_names.h"
#include "third_party/blink/renderer/core/page/page.h"
#include "third_party/blink/renderer/modules/media_controls/media_controls_impl.h"
......
......@@ -8,7 +8,6 @@
#include "third_party/blink/public/strings/grit/blink_strings.h"
#include "third_party/blink/renderer/core/dom/events/event.h"
#include "third_party/blink/renderer/core/html/media/html_media_element.h"
#include "third_party/blink/renderer/core/html/media/html_media_source.h"
#include "third_party/blink/renderer/core/html/media/html_video_element.h"
#include "third_party/blink/renderer/core/input_type_names.h"
#include "third_party/blink/renderer/modules/media_controls/media_controls_impl.h"
......
......@@ -8,8 +8,8 @@ blink_modules_sources("mediasource") {
sources = [
"html_video_element_media_source.cc",
"html_video_element_media_source.h",
"media_source.cc",
"media_source.h",
"media_source_impl.cc",
"media_source_impl.h",
"media_source_registry.cc",
"media_source_registry.h",
"source_buffer.cc",
......
......@@ -36,6 +36,7 @@ enum EndOfStreamError {
};
[
ImplementedAs=MediaSourceImpl,
ActiveScriptWrappable,
Exposed(Window MediaSourceStable, DedicatedWorker MediaSourceInWorkers, SharedWorker MediaSourceInWorkers)
] interface MediaSource : EventTarget {
......
......@@ -28,8 +28,8 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_MEDIASOURCE_MEDIA_SOURCE_H_
#define THIRD_PARTY_BLINK_RENDERER_MODULES_MEDIASOURCE_MEDIA_SOURCE_H_
#ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_MEDIASOURCE_MEDIA_SOURCE_IMPL_H_
#define THIRD_PARTY_BLINK_RENDERER_MODULES_MEDIASOURCE_MEDIA_SOURCE_IMPL_H_
#include <memory>
......@@ -37,7 +37,7 @@
#include "third_party/blink/renderer/bindings/core/v8/active_script_wrappable.h"
#include "third_party/blink/renderer/core/execution_context/execution_context_lifecycle_observer.h"
#include "third_party/blink/renderer/core/fileapi/url_registry.h"
#include "third_party/blink/renderer/core/html/media/html_media_source.h"
#include "third_party/blink/renderer/core/html/media/media_source.h"
#include "third_party/blink/renderer/core/html/time_ranges.h"
#include "third_party/blink/renderer/modules/event_target_modules.h"
#include "third_party/blink/renderer/modules/mediasource/source_buffer.h"
......@@ -50,22 +50,22 @@ class EventQueue;
class ExceptionState;
class WebSourceBuffer;
class MediaSource final : public EventTargetWithInlineData,
public HTMLMediaSource,
public ActiveScriptWrappable<MediaSource>,
public ExecutionContextLifecycleObserver {
class MediaSourceImpl final : public EventTargetWithInlineData,
public MediaSource,
public ActiveScriptWrappable<MediaSourceImpl>,
public ExecutionContextLifecycleObserver {
DEFINE_WRAPPERTYPEINFO();
USING_GARBAGE_COLLECTED_MIXIN(MediaSource);
USING_GARBAGE_COLLECTED_MIXIN(MediaSourceImpl);
public:
static const AtomicString& OpenKeyword();
static const AtomicString& ClosedKeyword();
static const AtomicString& EndedKeyword();
static MediaSource* Create(ExecutionContext*);
static MediaSourceImpl* Create(ExecutionContext*);
explicit MediaSource(ExecutionContext*);
~MediaSource() override;
explicit MediaSourceImpl(ExecutionContext*);
~MediaSourceImpl() override;
static void LogAndThrowDOMException(ExceptionState&,
DOMExceptionCode error,
......@@ -93,7 +93,7 @@ class MediaSource final : public EventTargetWithInlineData,
static bool isTypeSupported(const String& type);
// HTMLMediaSource
// html/media/MediaSource interface implementation
bool AttachToElement(HTMLMediaElement*) override;
void SetWebMediaSourceAndOpen(std::unique_ptr<WebMediaSource>) override;
void Close() override;
......@@ -152,8 +152,8 @@ class MediaSource final : public EventTargetWithInlineData,
// Here, using Member, instead of Member, to keep
// |attached_element_|, |source_buffers_|, |active_source_buffers_|, and their
// wrappers from being collected if we are alive or traceable from a GC root.
// Activity by this MediaSource or on references to objects returned by
// exercising this MediaSource (such as an app manipulating a SourceBuffer
// Activity by this MediaSourceImpl or on references to objects returned by
// exercising this MediaSourceImpl (such as an app manipulating a SourceBuffer
// retrieved via activeSourceBuffers()) may cause events to be dispatched by
// these other objects.
Member<HTMLMediaElement> attached_element_;
......@@ -167,4 +167,4 @@ class MediaSource final : public EventTargetWithInlineData,
} // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_MODULES_MEDIASOURCE_MEDIA_SOURCE_H_
#endif // THIRD_PARTY_BLINK_RENDERER_MODULES_MEDIASOURCE_MEDIA_SOURCE_IMPL_H_
......@@ -30,7 +30,7 @@
#include "third_party/blink/renderer/modules/mediasource/media_source_registry.h"
#include "third_party/blink/renderer/modules/mediasource/media_source.h"
#include "third_party/blink/renderer/modules/mediasource/media_source_impl.h"
#include "third_party/blink/renderer/platform/weborigin/kurl.h"
namespace blink {
......@@ -47,19 +47,19 @@ void MediaSourceRegistry::RegisterURL(SecurityOrigin*,
DCHECK_EQ(&registrable->Registry(), this);
DCHECK(IsMainThread());
MediaSource* source = static_cast<MediaSource*>(registrable);
MediaSourceImpl* source = static_cast<MediaSourceImpl*>(registrable);
source->AddedToRegistry();
media_sources_->Set(url.GetString(), source);
}
void MediaSourceRegistry::UnregisterURL(const KURL& url) {
DCHECK(IsMainThread());
HeapHashMap<String, Member<MediaSource>>::iterator iter =
HeapHashMap<String, Member<MediaSourceImpl>>::iterator iter =
media_sources_->find(url.GetString());
if (iter == media_sources_->end())
return;
MediaSource* source = iter->value;
MediaSourceImpl* source = iter->value;
media_sources_->erase(iter);
source->RemovedFromRegistry();
}
......@@ -70,9 +70,9 @@ URLRegistrable* MediaSourceRegistry::Lookup(const String& url) {
}
MediaSourceRegistry::MediaSourceRegistry()
: media_sources_(
MakeGarbageCollected<HeapHashMap<String, Member<MediaSource>>>()) {
HTMLMediaSource::SetRegistry(this);
: media_sources_(MakeGarbageCollected<
HeapHashMap<String, Member<MediaSourceImpl>>>()) {
MediaSource::SetRegistry(this);
}
} // namespace blink
......@@ -41,7 +41,7 @@
namespace blink {
class KURL;
class MediaSource;
class MediaSourceImpl;
class MediaSourceRegistry final : public URLRegistry {
public:
......@@ -55,7 +55,7 @@ class MediaSourceRegistry final : public URLRegistry {
private:
MediaSourceRegistry();
Persistent<HeapHashMap<String, Member<MediaSource>>> media_sources_;
Persistent<HeapHashMap<String, Member<MediaSourceImpl>>> media_sources_;
};
} // namespace blink
......
......@@ -49,7 +49,7 @@ class DOMArrayBuffer;
class DOMArrayBufferView;
class EventQueue;
class ExceptionState;
class MediaSource;
class MediaSourceImpl;
class TimeRanges;
class VideoTrackList;
class WebSourceBuffer;
......@@ -66,7 +66,7 @@ class SourceBuffer final : public EventTargetWithInlineData,
static const AtomicString& SegmentsKeyword();
static const AtomicString& SequenceKeyword();
SourceBuffer(std::unique_ptr<WebSourceBuffer>, MediaSource*, EventQueue*);
SourceBuffer(std::unique_ptr<WebSourceBuffer>, MediaSourceImpl*, EventQueue*);
~SourceBuffer() override;
// SourceBuffer.idl methods
......@@ -161,7 +161,7 @@ class SourceBuffer final : public EventTargetWithInlineData,
// need to remain alive at least to successfully dispatch any events enqueued
// by the behavior of the HTMLME+MSE API. It makes those wrappers remain alive
// as long as this SourceBuffer's wrapper is alive.
Member<MediaSource> source_;
Member<MediaSourceImpl> source_;
Member<TrackDefaultList> track_defaults_;
Member<EventQueue> async_event_queue_;
......
......@@ -33,16 +33,18 @@
#include "third_party/blink/renderer/core/execution_context/execution_context.h"
#include "third_party/blink/renderer/core/frame/web_feature.h"
#include "third_party/blink/renderer/core/url/dom_url.h"
#include "third_party/blink/renderer/modules/mediasource/media_source.h"
#include "third_party/blink/renderer/modules/mediasource/media_source_impl.h"
#include "third_party/blink/renderer/platform/bindings/script_state.h"
#include "third_party/blink/renderer/platform/instrumentation/use_counter.h"
namespace blink {
// static
String URLMediaSource::createObjectURL(ScriptState* script_state,
MediaSource* source) {
// Since WebWorkers cannot obtain MediaSource objects, we should be on the
// main thread.
MediaSourceImpl* source) {
// Since WebWorkers cannot obtain MediaSource objects (yet), we should be on
// the main thread. TODO(wolenetz): Let DedicatedWorkers create MediaSource
// object URLs. See https://crbug.com/878133.
DCHECK(IsMainThread());
ExecutionContext* execution_context = ExecutionContext::From(script_state);
DCHECK(execution_context);
......
......@@ -36,14 +36,14 @@
namespace blink {
class MediaSource;
class MediaSourceImpl;
class ScriptState;
class URLMediaSource {
STATIC_ONLY(URLMediaSource);
public:
static String createObjectURL(ScriptState*, MediaSource*);
static String createObjectURL(ScriptState*, MediaSourceImpl*);
};
} // namespace blink
......
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