OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // An extremely simple implementation of DataSource that downloads the entire | 5 // An extremely simple implementation of DataSource that downloads the entire |
6 // media resource into memory before signaling that initialization has finished. | 6 // media resource into memory before signaling that initialization has finished. |
7 // Primarily used to test <audio> and <video> with buffering/caching removed | 7 // Primarily used to test <audio> and <video> with buffering/caching removed |
8 // from the equation. | 8 // from the equation. |
9 | 9 |
10 #ifndef WEBKIT_GLUE_MEDIA_SIMPLE_DATA_SOURCE_H_ | 10 #ifndef WEBKIT_GLUE_MEDIA_SIMPLE_DATA_SOURCE_H_ |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 const char* data, int dataLength); | 81 const char* data, int dataLength); |
82 virtual void didFinishLoading( | 82 virtual void didFinishLoading( |
83 WebKit::WebURLLoader* loader, | 83 WebKit::WebURLLoader* loader, |
84 double finishTime); | 84 double finishTime); |
85 virtual void didFail( | 85 virtual void didFail( |
86 WebKit::WebURLLoader* loader, | 86 WebKit::WebURLLoader* loader, |
87 const WebKit::WebURLError&); | 87 const WebKit::WebURLError&); |
88 | 88 |
89 // webkit_glue::WebDataSource implementation. | 89 // webkit_glue::WebDataSource implementation. |
90 virtual void Initialize(const std::string& url, | 90 virtual void Initialize(const std::string& url, |
91 media::PipelineStatusCallback* callback); | 91 const media::PipelineStatusCB& callback); |
92 virtual void CancelInitialize(); | 92 virtual void CancelInitialize(); |
93 virtual bool HasSingleOrigin(); | 93 virtual bool HasSingleOrigin(); |
94 virtual void Abort(); | 94 virtual void Abort(); |
95 | 95 |
96 private: | 96 private: |
97 // Creates and starts the resource loading on the render thread. | 97 // Creates and starts the resource loading on the render thread. |
98 void StartTask(); | 98 void StartTask(); |
99 | 99 |
100 // Cancels and deletes the resource loading on the render thread. | 100 // Cancels and deletes the resource loading on the render thread. |
101 void CancelTask(); | 101 void CancelTask(); |
(...skipping 24 matching lines...) Expand all Loading... |
126 INITIALIZING, | 126 INITIALIZING, |
127 INITIALIZED, | 127 INITIALIZED, |
128 STOPPED, | 128 STOPPED, |
129 }; | 129 }; |
130 State state_; | 130 State state_; |
131 | 131 |
132 // Used for accessing |state_|. | 132 // Used for accessing |state_|. |
133 base::Lock lock_; | 133 base::Lock lock_; |
134 | 134 |
135 // Filter callbacks. | 135 // Filter callbacks. |
136 scoped_ptr<media::PipelineStatusCallback> initialize_callback_; | 136 media::PipelineStatusCB initialize_cb_; |
137 | 137 |
138 // Used to ensure mocks for unittests are used instead of reset in Start(). | 138 // Used to ensure mocks for unittests are used instead of reset in Start(). |
139 bool keep_test_loader_; | 139 bool keep_test_loader_; |
140 | 140 |
141 DISALLOW_COPY_AND_ASSIGN(SimpleDataSource); | 141 DISALLOW_COPY_AND_ASSIGN(SimpleDataSource); |
142 }; | 142 }; |
143 | 143 |
144 } // namespace webkit_glue | 144 } // namespace webkit_glue |
145 | 145 |
146 #endif // WEBKIT_GLUE_MEDIA_SIMPLE_DATA_SOURCE_H_ | 146 #endif // WEBKIT_GLUE_MEDIA_SIMPLE_DATA_SOURCE_H_ |
OLD | NEW |