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

Side by Side Diff: Source/modules/mediasource/SourceBuffer.h

Issue 26878003: Reduce repetitive EventTarget subclassing (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix nit Created 7 years, 2 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 | Annotate | Revision Log
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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 47
48 namespace WebCore { 48 namespace WebCore {
49 49
50 class ExceptionState; 50 class ExceptionState;
51 class FileReaderLoader; 51 class FileReaderLoader;
52 class GenericEventQueue; 52 class GenericEventQueue;
53 class MediaSource; 53 class MediaSource;
54 class Stream; 54 class Stream;
55 class TimeRanges; 55 class TimeRanges;
56 56
57 class SourceBuffer : public RefCounted<SourceBuffer>, public ActiveDOMObject, pu blic EventTarget, public ScriptWrappable, public FileReaderLoaderClient { 57 class SourceBuffer : public RefCounted<SourceBuffer>, public ActiveDOMObject, pu blic EventTargetWithInlineData, public ScriptWrappable, public FileReaderLoaderC lient {
58 public: 58 public:
59 static PassRefPtr<SourceBuffer> create(PassOwnPtr<SourceBufferPrivate>, Medi aSource*, GenericEventQueue*); 59 static PassRefPtr<SourceBuffer> create(PassOwnPtr<SourceBufferPrivate>, Medi aSource*, GenericEventQueue*);
60 60
61 virtual ~SourceBuffer(); 61 virtual ~SourceBuffer();
62 62
63 // SourceBuffer.idl methods 63 // SourceBuffer.idl methods
64 bool updating() const { return m_updating; } 64 bool updating() const { return m_updating; }
65 PassRefPtr<TimeRanges> buffered(ExceptionState&) const; 65 PassRefPtr<TimeRanges> buffered(ExceptionState&) const;
66 double timestampOffset() const; 66 double timestampOffset() const;
67 void setTimestampOffset(double, ExceptionState&); 67 void setTimestampOffset(double, ExceptionState&);
(...skipping 17 matching lines...) Expand all
85 85
86 // EventTarget interface 86 // EventTarget interface
87 virtual ScriptExecutionContext* scriptExecutionContext() const OVERRIDE; 87 virtual ScriptExecutionContext* scriptExecutionContext() const OVERRIDE;
88 virtual const AtomicString& interfaceName() const OVERRIDE; 88 virtual const AtomicString& interfaceName() const OVERRIDE;
89 89
90 using RefCounted<SourceBuffer>::ref; 90 using RefCounted<SourceBuffer>::ref;
91 using RefCounted<SourceBuffer>::deref; 91 using RefCounted<SourceBuffer>::deref;
92 92
93 protected: 93 protected:
94 // EventTarget interface 94 // EventTarget interface
95 virtual EventTargetData* eventTargetData() OVERRIDE;
96 virtual EventTargetData* ensureEventTargetData() OVERRIDE;
97 virtual void refEventTarget() OVERRIDE { ref(); } 95 virtual void refEventTarget() OVERRIDE { ref(); }
98 virtual void derefEventTarget() OVERRIDE { deref(); } 96 virtual void derefEventTarget() OVERRIDE { deref(); }
99 97
100 private: 98 private:
101 SourceBuffer(PassOwnPtr<SourceBufferPrivate>, MediaSource*, GenericEventQueu e*); 99 SourceBuffer(PassOwnPtr<SourceBufferPrivate>, MediaSource*, GenericEventQueu e*);
102 100
103 bool isRemoved() const; 101 bool isRemoved() const;
104 void scheduleEvent(const AtomicString& eventName); 102 void scheduleEvent(const AtomicString& eventName);
105 103
106 void appendBufferInternal(const unsigned char*, unsigned, ExceptionState&); 104 void appendBufferInternal(const unsigned char*, unsigned, ExceptionState&);
107 void appendBufferTimerFired(Timer<SourceBuffer>*); 105 void appendBufferTimerFired(Timer<SourceBuffer>*);
108 106
109 void removeTimerFired(Timer<SourceBuffer>*); 107 void removeTimerFired(Timer<SourceBuffer>*);
110 108
111 void appendStreamInternal(PassRefPtr<Stream>, ExceptionState&); 109 void appendStreamInternal(PassRefPtr<Stream>, ExceptionState&);
112 void appendStreamTimerFired(Timer<SourceBuffer>*); 110 void appendStreamTimerFired(Timer<SourceBuffer>*);
113 void appendStreamDone(bool success); 111 void appendStreamDone(bool success);
114 void clearAppendStreamState(); 112 void clearAppendStreamState();
115 113
116 // FileReaderLoaderClient interface 114 // FileReaderLoaderClient interface
117 virtual void didStartLoading() OVERRIDE; 115 virtual void didStartLoading() OVERRIDE;
118 virtual void didReceiveDataForClient(const char* data, unsigned dataLength) OVERRIDE; 116 virtual void didReceiveDataForClient(const char* data, unsigned dataLength) OVERRIDE;
119 virtual void didFinishLoading() OVERRIDE; 117 virtual void didFinishLoading() OVERRIDE;
120 virtual void didFail(FileError::ErrorCode) OVERRIDE; 118 virtual void didFail(FileError::ErrorCode) OVERRIDE;
121 119
122 OwnPtr<SourceBufferPrivate> m_private; 120 OwnPtr<SourceBufferPrivate> m_private;
123 MediaSource* m_source; 121 MediaSource* m_source;
124 GenericEventQueue* m_asyncEventQueue; 122 GenericEventQueue* m_asyncEventQueue;
125 EventTargetData m_eventTargetData;
126 123
127 bool m_updating; 124 bool m_updating;
128 double m_timestampOffset; 125 double m_timestampOffset;
129 double m_appendWindowStart; 126 double m_appendWindowStart;
130 double m_appendWindowEnd; 127 double m_appendWindowEnd;
131 128
132 Vector<unsigned char> m_pendingAppendData; 129 Vector<unsigned char> m_pendingAppendData;
133 Timer<SourceBuffer> m_appendBufferTimer; 130 Timer<SourceBuffer> m_appendBufferTimer;
134 131
135 double m_pendingRemoveStart; 132 double m_pendingRemoveStart;
136 double m_pendingRemoveEnd; 133 double m_pendingRemoveEnd;
137 Timer<SourceBuffer> m_removeTimer; 134 Timer<SourceBuffer> m_removeTimer;
138 135
139 bool m_streamMaxSizeValid; 136 bool m_streamMaxSizeValid;
140 unsigned long long m_streamMaxSize; 137 unsigned long long m_streamMaxSize;
141 Timer<SourceBuffer> m_appendStreamTimer; 138 Timer<SourceBuffer> m_appendStreamTimer;
142 RefPtr<Stream> m_stream; 139 RefPtr<Stream> m_stream;
143 OwnPtr<FileReaderLoader> m_loader; 140 OwnPtr<FileReaderLoader> m_loader;
144 }; 141 };
145 142
146 } // namespace WebCore 143 } // namespace WebCore
147 144
148 #endif 145 #endif
OLDNEW
« no previous file with comments | « Source/modules/mediasource/MediaSourceBase.cpp ('k') | Source/modules/mediasource/SourceBuffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698