OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 17 matching lines...) Expand all Loading... |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #ifndef HTMLMediaSource_h | 31 #ifndef HTMLMediaSource_h |
32 #define HTMLMediaSource_h | 32 #define HTMLMediaSource_h |
33 | 33 |
34 #include "core/CoreExport.h" | 34 #include "core/CoreExport.h" |
35 #include "core/html/URLRegistry.h" | 35 #include "core/html/URLRegistry.h" |
36 #include "platform/heap/Handle.h" | 36 #include "platform/heap/Handle.h" |
37 #include "wtf/Forward.h" | 37 #include "wtf/Forward.h" |
| 38 #include <memory> |
38 | 39 |
39 namespace blink { | 40 namespace blink { |
40 | 41 |
41 class WebMediaSource; | 42 class WebMediaSource; |
42 class HTMLMediaElement; | 43 class HTMLMediaElement; |
43 class TimeRanges; | 44 class TimeRanges; |
44 | 45 |
45 class CORE_EXPORT HTMLMediaSource : public URLRegistrable, public GarbageCollect
edMixin { | 46 class CORE_EXPORT HTMLMediaSource : public URLRegistrable, public GarbageCollect
edMixin { |
46 public: | 47 public: |
47 static void setRegistry(URLRegistry*); | 48 static void setRegistry(URLRegistry*); |
48 static HTMLMediaSource* lookup(const String& url) { return s_registry ? stat
ic_cast<HTMLMediaSource*>(s_registry->lookup(url)) : 0; } | 49 static HTMLMediaSource* lookup(const String& url) { return s_registry ? stat
ic_cast<HTMLMediaSource*>(s_registry->lookup(url)) : 0; } |
49 | 50 |
50 // Called when an HTMLMediaElement is attempting to attach to this object, | 51 // Called when an HTMLMediaElement is attempting to attach to this object, |
51 // and helps enforce attachment to at most one element at a time. | 52 // and helps enforce attachment to at most one element at a time. |
52 // If already attached, returns false. Otherwise, must be in | 53 // If already attached, returns false. Otherwise, must be in |
53 // 'closed' state, and returns true to indicate attachment success. | 54 // 'closed' state, and returns true to indicate attachment success. |
54 // Reattachment allowed by first calling close() (even if already in 'closed
'). | 55 // Reattachment allowed by first calling close() (even if already in 'closed
'). |
55 // Once attached, the source uses the element to synchronously service some | 56 // Once attached, the source uses the element to synchronously service some |
56 // API operations like duration change that may need to initiate seek. | 57 // API operations like duration change that may need to initiate seek. |
57 virtual bool attachToElement(HTMLMediaElement*) = 0; | 58 virtual bool attachToElement(HTMLMediaElement*) = 0; |
58 virtual void setWebMediaSourceAndOpen(PassOwnPtr<WebMediaSource>) = 0; | 59 virtual void setWebMediaSourceAndOpen(std::unique_ptr<WebMediaSource>) = 0; |
59 virtual void close() = 0; | 60 virtual void close() = 0; |
60 virtual bool isClosed() const = 0; | 61 virtual bool isClosed() const = 0; |
61 virtual double duration() const = 0; | 62 virtual double duration() const = 0; |
62 virtual TimeRanges* buffered() const = 0; | 63 virtual TimeRanges* buffered() const = 0; |
63 virtual TimeRanges* seekable() const = 0; | 64 virtual TimeRanges* seekable() const = 0; |
64 | 65 |
65 // URLRegistrable | 66 // URLRegistrable |
66 URLRegistry& registry() const override { return *s_registry; } | 67 URLRegistry& registry() const override { return *s_registry; } |
67 | 68 |
68 private: | 69 private: |
69 static URLRegistry* s_registry; | 70 static URLRegistry* s_registry; |
70 }; | 71 }; |
71 | 72 |
72 } // namespace blink | 73 } // namespace blink |
73 | 74 |
74 #endif | 75 #endif |
OLD | NEW |