OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef MEDIA_BLINK_BUFFERED_DATA_SOURCE_H_ | 5 #ifndef MEDIA_BLINK_BUFFERED_DATA_SOURCE_H_ |
6 #define MEDIA_BLINK_BUFFERED_DATA_SOURCE_H_ | 6 #define MEDIA_BLINK_BUFFERED_DATA_SOURCE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 // the render thread. | 152 // the render thread. |
153 void ReadInternal(); | 153 void ReadInternal(); |
154 | 154 |
155 // BufferedResourceLoader::Start() callback for initial load. | 155 // BufferedResourceLoader::Start() callback for initial load. |
156 void StartCallback(BufferedResourceLoader::Status status); | 156 void StartCallback(BufferedResourceLoader::Status status); |
157 | 157 |
158 // BufferedResourceLoader::Start() callback for subsequent loads (i.e., | 158 // BufferedResourceLoader::Start() callback for subsequent loads (i.e., |
159 // when accessing ranges that are outside initial buffered region). | 159 // when accessing ranges that are outside initial buffered region). |
160 void PartialReadStartCallback(BufferedResourceLoader::Status status); | 160 void PartialReadStartCallback(BufferedResourceLoader::Status status); |
161 | 161 |
| 162 // Returns true if we can accept the new partial response. |
| 163 bool CheckPartialResponseURL(const GURL& partial_response_original_url) const; |
| 164 |
162 // BufferedResourceLoader callbacks. | 165 // BufferedResourceLoader callbacks. |
163 void ReadCallback(BufferedResourceLoader::Status status, int bytes_read); | 166 void ReadCallback(BufferedResourceLoader::Status status, int bytes_read); |
164 void LoadingStateChangedCallback(BufferedResourceLoader::LoadingState state); | 167 void LoadingStateChangedCallback(BufferedResourceLoader::LoadingState state); |
165 void ProgressCallback(int64 position); | 168 void ProgressCallback(int64 position); |
166 | 169 |
167 // Update |loader_|'s deferring strategy in response to a play/pause, or | 170 // Update |loader_|'s deferring strategy in response to a play/pause, or |
168 // change in playback rate. | 171 // change in playback rate. |
169 void UpdateDeferStrategy(bool paused); | 172 void UpdateDeferStrategy(bool paused); |
170 | 173 |
171 // URL of the resource requested. | 174 // URL of the resource requested. |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 // Current playback rate. | 234 // Current playback rate. |
232 double playback_rate_; | 235 double playback_rate_; |
233 | 236 |
234 scoped_refptr<MediaLog> media_log_; | 237 scoped_refptr<MediaLog> media_log_; |
235 | 238 |
236 // Host object to report buffered byte range changes to. | 239 // Host object to report buffered byte range changes to. |
237 BufferedDataSourceHost* host_; | 240 BufferedDataSourceHost* host_; |
238 | 241 |
239 DownloadingCB downloading_cb_; | 242 DownloadingCB downloading_cb_; |
240 | 243 |
| 244 // The original URL of the first response. If the request is redirected to |
| 245 // another URL it is the URL after redirected. If the response is generated in |
| 246 // a Service Worker this URL is empty. BufferedDataSource checks the original |
| 247 // URL of each successive response. If the origin URL of it is different from |
| 248 // the original URL of the first response, it is treated as an error. |
| 249 GURL response_original_url_; |
| 250 |
241 // Disallow rebinding WeakReference ownership to a different thread by keeping | 251 // Disallow rebinding WeakReference ownership to a different thread by keeping |
242 // a persistent reference. This avoids problems with the thread-safety of | 252 // a persistent reference. This avoids problems with the thread-safety of |
243 // reaching into this class from multiple threads to attain a WeakPtr. | 253 // reaching into this class from multiple threads to attain a WeakPtr. |
244 base::WeakPtr<BufferedDataSource> weak_ptr_; | 254 base::WeakPtr<BufferedDataSource> weak_ptr_; |
245 base::WeakPtrFactory<BufferedDataSource> weak_factory_; | 255 base::WeakPtrFactory<BufferedDataSource> weak_factory_; |
246 | 256 |
247 DISALLOW_COPY_AND_ASSIGN(BufferedDataSource); | 257 DISALLOW_COPY_AND_ASSIGN(BufferedDataSource); |
248 }; | 258 }; |
249 | 259 |
250 } // namespace media | 260 } // namespace media |
251 | 261 |
252 #endif // MEDIA_BLINK_BUFFERED_DATA_SOURCE_H_ | 262 #endif // MEDIA_BLINK_BUFFERED_DATA_SOURCE_H_ |
OLD | NEW |