chromium/third_party/blink/renderer/core/html/media/media_source_attachment.h

// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_HTML_MEDIA_MEDIA_SOURCE_ATTACHMENT_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_HTML_MEDIA_MEDIA_SOURCE_ATTACHMENT_H_

#include <memory>
#include "third_party/blink/public/platform/web_time_range.h"
#include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/core/fileapi/url_registry.h"
#include "third_party/blink/renderer/core/html/media/media_source_tracer.h"
#include "third_party/blink/renderer/platform/wtf/forward.h"
#include "third_party/blink/renderer/platform/wtf/thread_safe_ref_counted.h"

namespace blink {

class HTMLMediaElement;
class MediaSourceRegistry;
class TrackBase;
class WebMediaSource;

// Interface for concrete non-oilpan types to coordinate potentially
// cross-context registration, deregistration, lookup of a MediaSource via the
// MediaSourceRegistry, and for proxying operations on an attached MediaSource.
// Upon successful lookup, enables the extension of an HTMLMediaElement by the
// MSE API, aka attachment. This type is not managed by oilpan due to the
// potentially varying context lifetimes. Concrete implementations of this
// handle same-thread (main thread) attachments distinctly from cross-context
// (MSE-in-Worker, HTMLMediaElement in main thread) attachments due to the
// increased complexity for handling the latter. Concrete implementations of
// this interface are reference counted to ensure they are available potentially
// cross-thread and from the registry.
class CORE_EXPORT MediaSourceAttachment
    : public URLRegistrable,
      public WTF::ThreadSafeRefCounted<MediaSourceAttachment> {};

}  // namespace blink

#endif  // THIRD_PARTY_BLINK_RENDERER_CORE_HTML_MEDIA_MEDIA_SOURCE_ATTACHMENT_H_