Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(236)

Side by Side Diff: third_party/WebKit/Source/modules/mediasource/SourceBufferList.h

Issue 2622533002: Prefer ContextClient mixin over manual ExecutionContext handling. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/mediasource/SourceBufferList.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 13 matching lines...) Expand all
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
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 SourceBufferList_h 31 #ifndef SourceBufferList_h
32 #define SourceBufferList_h 32 #define SourceBufferList_h
33 33
34 #include "core/dom/ExecutionContext.h"
34 #include "modules/EventTargetModules.h" 35 #include "modules/EventTargetModules.h"
35 #include "platform/heap/Handle.h" 36 #include "platform/heap/Handle.h"
36 37
37 namespace blink { 38 namespace blink {
38 39
39 class SourceBuffer; 40 class SourceBuffer;
40 class GenericEventQueue; 41 class GenericEventQueue;
41 42
42 class SourceBufferList final : public EventTargetWithInlineData { 43 class SourceBufferList final : public EventTargetWithInlineData,
44 public ContextClient {
43 DEFINE_WRAPPERTYPEINFO(); 45 DEFINE_WRAPPERTYPEINFO();
46 USING_GARBAGE_COLLECTED_MIXIN(SourceBufferList);
44 47
45 public: 48 public:
46 static SourceBufferList* create(ExecutionContext* context, 49 static SourceBufferList* create(ExecutionContext* context,
47 GenericEventQueue* asyncEventQueue) { 50 GenericEventQueue* asyncEventQueue) {
48 return new SourceBufferList(context, asyncEventQueue); 51 return new SourceBufferList(context, asyncEventQueue);
49 } 52 }
50 ~SourceBufferList() override; 53 ~SourceBufferList() override;
51 54
52 unsigned length() const { return m_list.size(); } 55 unsigned length() const { return m_list.size(); }
53 56
54 DEFINE_ATTRIBUTE_EVENT_LISTENER(addsourcebuffer); 57 DEFINE_ATTRIBUTE_EVENT_LISTENER(addsourcebuffer);
55 DEFINE_ATTRIBUTE_EVENT_LISTENER(removesourcebuffer); 58 DEFINE_ATTRIBUTE_EVENT_LISTENER(removesourcebuffer);
56 59
57 SourceBuffer* item(unsigned index) const { 60 SourceBuffer* item(unsigned index) const {
58 return (index < m_list.size()) ? m_list[index].get() : 0; 61 return (index < m_list.size()) ? m_list[index].get() : 0;
59 } 62 }
60 63
61 void add(SourceBuffer*); 64 void add(SourceBuffer*);
62 void insert(size_t position, SourceBuffer*); 65 void insert(size_t position, SourceBuffer*);
63 void remove(SourceBuffer*); 66 void remove(SourceBuffer*);
64 size_t find(SourceBuffer* buffer) { return m_list.find(buffer); } 67 size_t find(SourceBuffer* buffer) { return m_list.find(buffer); }
65 bool contains(SourceBuffer* buffer) { 68 bool contains(SourceBuffer* buffer) {
66 return m_list.find(buffer) != kNotFound; 69 return m_list.find(buffer) != kNotFound;
67 } 70 }
68 void clear(); 71 void clear();
69 72
70 // EventTarget interface 73 // EventTarget interface
71 const AtomicString& interfaceName() const override; 74 const AtomicString& interfaceName() const override;
72 ExecutionContext* getExecutionContext() const override; 75 ExecutionContext* getExecutionContext() const override {
76 return ContextClient::getExecutionContext();
77 }
73 78
74 DECLARE_VIRTUAL_TRACE(); 79 DECLARE_VIRTUAL_TRACE();
75 80
76 private: 81 private:
77 SourceBufferList(ExecutionContext*, GenericEventQueue*); 82 SourceBufferList(ExecutionContext*, GenericEventQueue*);
78 83
79 void scheduleEvent(const AtomicString&); 84 void scheduleEvent(const AtomicString&);
80 85
81 Member<ExecutionContext> m_executionContext;
82 Member<GenericEventQueue> m_asyncEventQueue; 86 Member<GenericEventQueue> m_asyncEventQueue;
83 87
84 HeapVector<Member<SourceBuffer>> m_list; 88 HeapVector<Member<SourceBuffer>> m_list;
85 }; 89 };
86 90
87 } // namespace blink 91 } // namespace blink
88 92
89 #endif // SourceBufferList_h 93 #endif // SourceBufferList_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/mediasource/SourceBufferList.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698