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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 class SourceBufferList final : public EventTargetWithInlineData { | 42 class SourceBufferList final : public EventTargetWithInlineData { |
43 DEFINE_WRAPPERTYPEINFO(); | 43 DEFINE_WRAPPERTYPEINFO(); |
44 public: | 44 public: |
45 static SourceBufferList* create(ExecutionContext* context, GenericEventQueue
* asyncEventQueue) | 45 static SourceBufferList* create(ExecutionContext* context, GenericEventQueue
* asyncEventQueue) |
46 { | 46 { |
47 return new SourceBufferList(context, asyncEventQueue); | 47 return new SourceBufferList(context, asyncEventQueue); |
48 } | 48 } |
49 ~SourceBufferList() override; | 49 ~SourceBufferList() override; |
50 | 50 |
51 unsigned length() const { return m_list.size(); } | 51 unsigned length() const { return m_list.size(); } |
| 52 |
| 53 DEFINE_ATTRIBUTE_EVENT_LISTENER(addsourcebuffer); |
| 54 DEFINE_ATTRIBUTE_EVENT_LISTENER(removesourcebuffer); |
| 55 |
52 SourceBuffer* item(unsigned index) const { return (index < m_list.size()) ?
m_list[index].get() : 0; } | 56 SourceBuffer* item(unsigned index) const { return (index < m_list.size()) ?
m_list[index].get() : 0; } |
53 | 57 |
54 void add(SourceBuffer*); | 58 void add(SourceBuffer*); |
55 void insert(size_t position, SourceBuffer*); | 59 void insert(size_t position, SourceBuffer*); |
56 void remove(SourceBuffer*); | 60 void remove(SourceBuffer*); |
57 size_t find(SourceBuffer* buffer) { return m_list.find(buffer); } | 61 size_t find(SourceBuffer* buffer) { return m_list.find(buffer); } |
58 bool contains(SourceBuffer* buffer) { return m_list.find(buffer) != kNotFoun
d; } | 62 bool contains(SourceBuffer* buffer) { return m_list.find(buffer) != kNotFoun
d; } |
59 void clear(); | 63 void clear(); |
60 | 64 |
61 // EventTarget interface | 65 // EventTarget interface |
62 const AtomicString& interfaceName() const override; | 66 const AtomicString& interfaceName() const override; |
63 ExecutionContext* getExecutionContext() const override; | 67 ExecutionContext* getExecutionContext() const override; |
64 | 68 |
65 DECLARE_VIRTUAL_TRACE(); | 69 DECLARE_VIRTUAL_TRACE(); |
66 | 70 |
67 private: | 71 private: |
68 SourceBufferList(ExecutionContext*, GenericEventQueue*); | 72 SourceBufferList(ExecutionContext*, GenericEventQueue*); |
69 | 73 |
70 void scheduleEvent(const AtomicString&); | 74 void scheduleEvent(const AtomicString&); |
71 | 75 |
72 Member<ExecutionContext> m_executionContext; | 76 Member<ExecutionContext> m_executionContext; |
73 Member<GenericEventQueue> m_asyncEventQueue; | 77 Member<GenericEventQueue> m_asyncEventQueue; |
74 | 78 |
75 HeapVector<Member<SourceBuffer>> m_list; | 79 HeapVector<Member<SourceBuffer>> m_list; |
76 }; | 80 }; |
77 | 81 |
78 } // namespace blink | 82 } // namespace blink |
79 | 83 |
80 #endif // SourceBufferList_h | 84 #endif // SourceBufferList_h |
OLD | NEW |