| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 }; | 115 }; |
| 116 | 116 |
| 117 // A data source capable of loading URLs and buffering the data using an | 117 // A data source capable of loading URLs and buffering the data using an |
| 118 // in-memory sliding window. | 118 // in-memory sliding window. |
| 119 // | 119 // |
| 120 // BufferedDataSource must be created and destroyed on the thread associated | 120 // BufferedDataSource must be created and destroyed on the thread associated |
| 121 // with the |task_runner| passed in the constructor. | 121 // with the |task_runner| passed in the constructor. |
| 122 class MEDIA_BLINK_EXPORT BufferedDataSource | 122 class MEDIA_BLINK_EXPORT BufferedDataSource |
| 123 : NON_EXPORTED_BASE(public BufferedDataSourceInterface) { | 123 : NON_EXPORTED_BASE(public BufferedDataSourceInterface) { |
| 124 public: | 124 public: |
| 125 // Number of cache misses or read failures we allow for a single Read() before |
| 126 // signaling an error. |
| 127 enum { kLoaderRetries = 30 }; |
| 125 typedef base::Callback<void(bool)> DownloadingCB; | 128 typedef base::Callback<void(bool)> DownloadingCB; |
| 126 | 129 |
| 127 // |url| and |cors_mode| are passed to the object. Buffered byte range changes | 130 // |url| and |cors_mode| are passed to the object. Buffered byte range changes |
| 128 // will be reported to |host|. |downloading_cb| will be called whenever the | 131 // will be reported to |host|. |downloading_cb| will be called whenever the |
| 129 // downloading/paused state of the source changes. | 132 // downloading/paused state of the source changes. |
| 130 BufferedDataSource( | 133 BufferedDataSource( |
| 131 const GURL& url, | 134 const GURL& url, |
| 132 BufferedResourceLoader::CORSMode cors_mode, | 135 BufferedResourceLoader::CORSMode cors_mode, |
| 133 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 136 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
| 134 blink::WebFrame* frame, | 137 blink::WebFrame* frame, |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 // reaching into this class from multiple threads to attain a WeakPtr. | 329 // reaching into this class from multiple threads to attain a WeakPtr. |
| 327 base::WeakPtr<BufferedDataSource> weak_ptr_; | 330 base::WeakPtr<BufferedDataSource> weak_ptr_; |
| 328 base::WeakPtrFactory<BufferedDataSource> weak_factory_; | 331 base::WeakPtrFactory<BufferedDataSource> weak_factory_; |
| 329 | 332 |
| 330 DISALLOW_COPY_AND_ASSIGN(BufferedDataSource); | 333 DISALLOW_COPY_AND_ASSIGN(BufferedDataSource); |
| 331 }; | 334 }; |
| 332 | 335 |
| 333 } // namespace media | 336 } // namespace media |
| 334 | 337 |
| 335 #endif // MEDIA_BLINK_BUFFERED_DATA_SOURCE_H_ | 338 #endif // MEDIA_BLINK_BUFFERED_DATA_SOURCE_H_ |
| OLD | NEW |