Chromium Code Reviews| 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 25 matching lines...) Expand all Loading... | |
| 36 virtual void AddBufferedByteRange(int64 start, int64 end) = 0; | 36 virtual void AddBufferedByteRange(int64 start, int64 end) = 0; |
| 37 | 37 |
| 38 protected: | 38 protected: |
| 39 virtual ~BufferedDataSourceHost() {} | 39 virtual ~BufferedDataSourceHost() {} |
| 40 }; | 40 }; |
| 41 | 41 |
| 42 // A data source capable of loading URLs and buffering the data using an | 42 // A data source capable of loading URLs and buffering the data using an |
| 43 // in-memory sliding window. | 43 // in-memory sliding window. |
| 44 // | 44 // |
| 45 // BufferedDataSource must be created and initialized on the render thread | 45 // BufferedDataSource must be created and initialized on the render thread |
| 46 // before being passed to other threads. It may be deleted on any thread. | 46 // before being passed to other threads. It may be deleted on any thread. |
|
Wez
2014/11/18 23:28:10
This means you can't use thread-bound resources li
no sievers
2014/11/18 23:32:19
I missed that. That'd be bad. I thought this objec
DaleCurtis
2014/11/18 23:47:46
I don't think these docs are true anymore, see:
h
| |
| 47 class MEDIA_EXPORT BufferedDataSource : public DataSource { | 47 class MEDIA_EXPORT BufferedDataSource : public DataSource { |
| 48 public: | 48 public: |
| 49 // Used to specify video preload states. They are "hints" to the browser about | 49 // Used to specify video preload states. They are "hints" to the browser about |
| 50 // how aggressively the browser should load and buffer data. | 50 // how aggressively the browser should load and buffer data. |
| 51 // Please see the HTML5 spec for the descriptions of these values: | 51 // Please see the HTML5 spec for the descriptions of these values: |
| 52 // http://www.w3.org/TR/html5/video.html#attr-media-preload | 52 // http://www.w3.org/TR/html5/video.html#attr-media-preload |
| 53 // | 53 // |
| 54 // Enum values must match the values in blink::WebMediaPlayer::Preload and | 54 // Enum values must match the values in blink::WebMediaPlayer::Preload and |
| 55 // there will be assertions at compile time if they do not match. | 55 // there will be assertions at compile time if they do not match. |
| 56 enum Preload { | 56 enum Preload { |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 228 scoped_refptr<MediaLog> media_log_; | 228 scoped_refptr<MediaLog> media_log_; |
| 229 | 229 |
| 230 // Host object to report buffered byte range changes to. | 230 // Host object to report buffered byte range changes to. |
| 231 BufferedDataSourceHost* host_; | 231 BufferedDataSourceHost* host_; |
| 232 | 232 |
| 233 DownloadingCB downloading_cb_; | 233 DownloadingCB downloading_cb_; |
| 234 | 234 |
| 235 // NOTE: Weak pointers must be invalidated before all other member variables. | 235 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 236 base::WeakPtrFactory<BufferedDataSource> weak_factory_; | 236 base::WeakPtrFactory<BufferedDataSource> weak_factory_; |
| 237 | 237 |
| 238 // Disallow rebinding WeakReference ownership to a different thread by keeping | |
| 239 // a persistent reference. This avoids problems with the thread-safety of | |
| 240 // reaching into this class from multiple threads to attain a WeakPtr. | |
| 241 const base::WeakPtr<BufferedDataSource> weak_ptr_; | |
| 242 | |
| 238 DISALLOW_COPY_AND_ASSIGN(BufferedDataSource); | 243 DISALLOW_COPY_AND_ASSIGN(BufferedDataSource); |
| 239 }; | 244 }; |
| 240 | 245 |
| 241 } // namespace media | 246 } // namespace media |
| 242 | 247 |
| 243 #endif // MEDIA_BLINK_BUFFERED_DATA_SOURCE_H_ | 248 #endif // MEDIA_BLINK_BUFFERED_DATA_SOURCE_H_ |
| OLD | NEW |