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

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

Issue 27571005: Replace Timers used in ActiveDOMObject with AsyncMethodRunner (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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
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 18 matching lines...) Expand all
29 */ 29 */
30 30
31 #ifndef SourceBuffer_h 31 #ifndef SourceBuffer_h
32 #define SourceBuffer_h 32 #define SourceBuffer_h
33 33
34 #include "bindings/v8/ScriptWrappable.h" 34 #include "bindings/v8/ScriptWrappable.h"
35 #include "core/dom/ActiveDOMObject.h" 35 #include "core/dom/ActiveDOMObject.h"
36 #include "core/events/EventTarget.h" 36 #include "core/events/EventTarget.h"
37 #include "core/fileapi/FileReaderLoaderClient.h" 37 #include "core/fileapi/FileReaderLoaderClient.h"
38 #include "core/platform/graphics/SourceBufferPrivate.h" 38 #include "core/platform/graphics/SourceBufferPrivate.h"
39 #include "platform/Timer.h" 39 #include "platform/AsyncMethodRunner.h"
40 #include "weborigin/KURL.h" 40 #include "weborigin/KURL.h"
41 #include "wtf/OwnPtr.h" 41 #include "wtf/OwnPtr.h"
42 #include "wtf/PassOwnPtr.h" 42 #include "wtf/PassOwnPtr.h"
43 #include "wtf/PassRefPtr.h" 43 #include "wtf/PassRefPtr.h"
44 #include "wtf/RefCounted.h" 44 #include "wtf/RefCounted.h"
45 #include "wtf/RefPtr.h" 45 #include "wtf/RefPtr.h"
46 #include "wtf/text/WTFString.h" 46 #include "wtf/text/WTFString.h"
47 47
48 namespace WebCore { 48 namespace WebCore {
49 49
(...skipping 25 matching lines...) Expand all
75 double appendWindowStart() const; 75 double appendWindowStart() const;
76 void setAppendWindowStart(double, ExceptionState&); 76 void setAppendWindowStart(double, ExceptionState&);
77 double appendWindowEnd() const; 77 double appendWindowEnd() const;
78 void setAppendWindowEnd(double, ExceptionState&); 78 void setAppendWindowEnd(double, ExceptionState&);
79 79
80 void abortIfUpdating(); 80 void abortIfUpdating();
81 void removedFromMediaSource(); 81 void removedFromMediaSource();
82 82
83 // ActiveDOMObject interface 83 // ActiveDOMObject interface
84 virtual bool hasPendingActivity() const OVERRIDE; 84 virtual bool hasPendingActivity() const OVERRIDE;
85 virtual void suspend() OVERRIDE;
86 virtual void resume() OVERRIDE;
85 virtual void stop() OVERRIDE; 87 virtual void stop() OVERRIDE;
86 88
87 // EventTarget interface 89 // EventTarget interface
88 virtual ExecutionContext* executionContext() const OVERRIDE; 90 virtual ExecutionContext* executionContext() const OVERRIDE;
89 virtual const AtomicString& interfaceName() const OVERRIDE; 91 virtual const AtomicString& interfaceName() const OVERRIDE;
90 92
91 private: 93 private:
92 SourceBuffer(PassOwnPtr<SourceBufferPrivate>, MediaSource*, GenericEventQueu e*); 94 SourceBuffer(PassOwnPtr<SourceBufferPrivate>, MediaSource*, GenericEventQueu e*);
93 95
94 bool isRemoved() const; 96 bool isRemoved() const;
95 void scheduleEvent(const AtomicString& eventName); 97 void scheduleEvent(const AtomicString& eventName);
96 98
97 void appendBufferInternal(const unsigned char*, unsigned, ExceptionState&); 99 void appendBufferInternal(const unsigned char*, unsigned, ExceptionState&);
98 void appendBufferTimerFired(Timer<SourceBuffer>*); 100 void appendBufferAsyncPart();
99 101
100 void removeTimerFired(Timer<SourceBuffer>*); 102 void removeAsyncPart();
101 103
102 void appendStreamInternal(PassRefPtr<Stream>, ExceptionState&); 104 void appendStreamInternal(PassRefPtr<Stream>, ExceptionState&);
103 void appendStreamTimerFired(Timer<SourceBuffer>*); 105 void appendStreamAsyncPart();
104 void appendStreamDone(bool success); 106 void appendStreamDone(bool success);
105 void clearAppendStreamState(); 107 void clearAppendStreamState();
106 108
107 // FileReaderLoaderClient interface 109 // FileReaderLoaderClient interface
108 virtual void didStartLoading() OVERRIDE; 110 virtual void didStartLoading() OVERRIDE;
109 virtual void didReceiveDataForClient(const char* data, unsigned dataLength) OVERRIDE; 111 virtual void didReceiveDataForClient(const char* data, unsigned dataLength) OVERRIDE;
110 virtual void didFinishLoading() OVERRIDE; 112 virtual void didFinishLoading() OVERRIDE;
111 virtual void didFail(FileError::ErrorCode) OVERRIDE; 113 virtual void didFail(FileError::ErrorCode) OVERRIDE;
112 114
113 OwnPtr<SourceBufferPrivate> m_private; 115 OwnPtr<SourceBufferPrivate> m_private;
114 MediaSource* m_source; 116 MediaSource* m_source;
115 GenericEventQueue* m_asyncEventQueue; 117 GenericEventQueue* m_asyncEventQueue;
116 118
117 bool m_updating; 119 bool m_updating;
118 double m_timestampOffset; 120 double m_timestampOffset;
119 double m_appendWindowStart; 121 double m_appendWindowStart;
120 double m_appendWindowEnd; 122 double m_appendWindowEnd;
121 123
122 Vector<unsigned char> m_pendingAppendData; 124 Vector<unsigned char> m_pendingAppendData;
123 Timer<SourceBuffer> m_appendBufferTimer; 125 AsyncMethodRunner<SourceBuffer> m_appendBufferAsyncPartRunner;
124 126
125 double m_pendingRemoveStart; 127 double m_pendingRemoveStart;
126 double m_pendingRemoveEnd; 128 double m_pendingRemoveEnd;
127 Timer<SourceBuffer> m_removeTimer; 129 AsyncMethodRunner<SourceBuffer> m_removeAsyncPartRunner;
128 130
129 bool m_streamMaxSizeValid; 131 bool m_streamMaxSizeValid;
130 unsigned long long m_streamMaxSize; 132 unsigned long long m_streamMaxSize;
131 Timer<SourceBuffer> m_appendStreamTimer; 133 AsyncMethodRunner<SourceBuffer> m_appendStreamAsyncPartRunner;
132 RefPtr<Stream> m_stream; 134 RefPtr<Stream> m_stream;
133 OwnPtr<FileReaderLoader> m_loader; 135 OwnPtr<FileReaderLoader> m_loader;
134 }; 136 };
135 137
136 } // namespace WebCore 138 } // namespace WebCore
137 139
138 #endif 140 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698