| 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 16 matching lines...) Expand all Loading... |
| 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 "bindings/v8/ScriptWrappable.h" | 34 #include "bindings/v8/ScriptWrappable.h" |
| 35 #include "modules/EventTargetModules.h" | 35 #include "modules/EventTargetModules.h" |
| 36 #include "platform/heap/Handle.h" | 36 #include "platform/heap/Handle.h" |
| 37 #include "wtf/RefCounted.h" | |
| 38 #include "wtf/Vector.h" | 37 #include "wtf/Vector.h" |
| 39 | 38 |
| 40 namespace WebCore { | 39 namespace WebCore { |
| 41 | 40 |
| 42 class SourceBuffer; | 41 class SourceBuffer; |
| 43 class GenericEventQueue; | 42 class GenericEventQueue; |
| 44 | 43 |
| 45 class SourceBufferList FINAL : public RefCountedWillBeRefCountedGarbageCollected
<SourceBufferList>, public ScriptWrappable, public EventTargetWithInlineData { | 44 class SourceBufferList FINAL : public RefCountedGarbageCollectedWillBeGarbageCol
lectedFinalized<SourceBufferList>, public ScriptWrappable, public EventTargetWit
hInlineData { |
| 46 REFCOUNTED_EVENT_TARGET(SourceBufferList); | 45 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<S
ourceBufferList>); |
| 47 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(SourceBufferList); | 46 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(SourceBufferList); |
| 48 public: | 47 public: |
| 49 static PassRefPtrWillBeRawPtr<SourceBufferList> create(ExecutionContext* con
text, GenericEventQueue* asyncEventQueue) | 48 static SourceBufferList* create(ExecutionContext* context, GenericEventQueue
* asyncEventQueue) |
| 50 { | 49 { |
| 51 return adoptRefWillBeRefCountedGarbageCollected(new SourceBufferList(con
text, asyncEventQueue)); | 50 return adoptRefCountedGarbageCollected(new SourceBufferList(context, asy
ncEventQueue)); |
| 52 } | 51 } |
| 53 virtual ~SourceBufferList(); | 52 virtual ~SourceBufferList(); |
| 54 | 53 |
| 55 unsigned long length() const { return m_list.size(); } | 54 unsigned long length() const { return m_list.size(); } |
| 56 SourceBuffer* item(unsigned long index) const { return (index < m_list.size(
)) ? m_list[index].get() : 0; } | 55 SourceBuffer* item(unsigned long index) const { return (index < m_list.size(
)) ? m_list[index].get() : 0; } |
| 57 | 56 |
| 58 void add(PassRefPtrWillBeRawPtr<SourceBuffer>); | 57 void add(SourceBuffer*); |
| 59 void remove(SourceBuffer*); | 58 void remove(SourceBuffer*); |
| 60 bool contains(SourceBuffer* buffer) { return m_list.find(buffer) != kNotFoun
d; } | 59 bool contains(SourceBuffer* buffer) { return m_list.find(buffer) != kNotFoun
d; } |
| 61 void clear(); | 60 void clear(); |
| 62 | 61 |
| 63 // EventTarget interface | 62 // EventTarget interface |
| 64 virtual const AtomicString& interfaceName() const OVERRIDE; | 63 virtual const AtomicString& interfaceName() const OVERRIDE; |
| 65 virtual ExecutionContext* executionContext() const OVERRIDE; | 64 virtual ExecutionContext* executionContext() const OVERRIDE; |
| 66 | 65 |
| 67 virtual void trace(Visitor*) OVERRIDE; | 66 virtual void trace(Visitor*) OVERRIDE; |
| 68 | 67 |
| 69 private: | 68 private: |
| 70 SourceBufferList(ExecutionContext*, GenericEventQueue*); | 69 SourceBufferList(ExecutionContext*, GenericEventQueue*); |
| 71 | 70 |
| 72 void scheduleEvent(const AtomicString&); | 71 void scheduleEvent(const AtomicString&); |
| 73 | 72 |
| 74 ExecutionContext* m_executionContext; | 73 ExecutionContext* m_executionContext; |
| 75 GenericEventQueue* m_asyncEventQueue; | 74 GenericEventQueue* m_asyncEventQueue; |
| 76 | 75 |
| 77 WillBeHeapVector<RefPtrWillBeMember<SourceBuffer> > m_list; | 76 HeapVector<Member<SourceBuffer> > m_list; |
| 78 }; | 77 }; |
| 79 | 78 |
| 80 } // namespace WebCore | 79 } // namespace WebCore |
| 81 | 80 |
| 82 #endif | 81 #endif |
| OLD | NEW |