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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 107 | 107 |
| 108 // Cancels any open network connections once reaching the deferred state. If | 108 // Cancels any open network connections once reaching the deferred state. If |
| 109 // |always_cancel| is false this is done only for preload=metadata, non- | 109 // |always_cancel| is false this is done only for preload=metadata, non- |
| 110 // streaming resources that have not started playback. If |always_cancel| is | 110 // streaming resources that have not started playback. If |always_cancel| is |
| 111 // true, all resource types will have their connections canceled. If already | 111 // true, all resource types will have their connections canceled. If already |
| 112 // deferred, connections will be immediately closed. | 112 // deferred, connections will be immediately closed. |
| 113 virtual void OnBufferingHaveEnough(bool always_cancel) = 0; | 113 virtual void OnBufferingHaveEnough(bool always_cancel) = 0; |
| 114 | 114 |
| 115 // Returns an estimate of the number of bytes held by the data source. | 115 // Returns an estimate of the number of bytes held by the data source. |
| 116 virtual int64_t GetMemoryUsage() const = 0; | 116 virtual int64_t GetMemoryUsage() const = 0; |
| 117 | |
| 118 // Returns the post-Initialize() URL after redirects have been followed. | |
|
hubbe
2016/06/15 21:07:56
Please document if it's ok for this to change if a
DaleCurtis
2016/06/15 23:11:30
Done.
| |
| 119 virtual GURL GetResponseOriginURL() const = 0; | |
|
hubbe
2016/06/15 21:07:56
GetResponseOriginalURL only makes sense if you kno
DaleCurtis
2016/06/15 23:11:30
Done.
| |
| 117 }; | 120 }; |
| 118 | 121 |
| 119 // A data source capable of loading URLs and buffering the data using an | 122 // A data source capable of loading URLs and buffering the data using an |
| 120 // in-memory sliding window. | 123 // in-memory sliding window. |
| 121 // | 124 // |
| 122 // BufferedDataSource must be created and destroyed on the thread associated | 125 // BufferedDataSource must be created and destroyed on the thread associated |
| 123 // with the |task_runner| passed in the constructor. | 126 // with the |task_runner| passed in the constructor. |
| 124 class MEDIA_BLINK_EXPORT BufferedDataSource | 127 class MEDIA_BLINK_EXPORT BufferedDataSource |
| 125 : NON_EXPORTED_BASE(public BufferedDataSourceInterface) { | 128 : NON_EXPORTED_BASE(public BufferedDataSourceInterface) { |
| 126 public: | 129 public: |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 183 // Cancels any open network connections once reaching the deferred state. If | 186 // Cancels any open network connections once reaching the deferred state. If |
| 184 // |always_cancel| is false this is done only for preload=metadata, non- | 187 // |always_cancel| is false this is done only for preload=metadata, non- |
| 185 // streaming resources that have not started playback. If |always_cancel| is | 188 // streaming resources that have not started playback. If |always_cancel| is |
| 186 // true, all resource types will have their connections canceled. If already | 189 // true, all resource types will have their connections canceled. If already |
| 187 // deferred, connections will be immediately closed. | 190 // deferred, connections will be immediately closed. |
| 188 void OnBufferingHaveEnough(bool always_cancel) override; | 191 void OnBufferingHaveEnough(bool always_cancel) override; |
| 189 | 192 |
| 190 // Returns an estimate of the number of bytes held by the data source. | 193 // Returns an estimate of the number of bytes held by the data source. |
| 191 int64_t GetMemoryUsage() const override; | 194 int64_t GetMemoryUsage() const override; |
| 192 | 195 |
| 196 GURL GetResponseOriginURL() const override; | |
| 197 | |
| 193 // DataSource implementation. | 198 // DataSource implementation. |
| 194 // Called from demuxer thread. | 199 // Called from demuxer thread. |
| 195 void Stop() override; | 200 void Stop() override; |
| 196 | 201 |
| 197 void Read(int64_t position, | 202 void Read(int64_t position, |
| 198 int size, | 203 int size, |
| 199 uint8_t* data, | 204 uint8_t* data, |
| 200 const DataSource::ReadCB& read_cb) override; | 205 const DataSource::ReadCB& read_cb) override; |
| 201 bool GetSize(int64_t* size_out) override; | 206 bool GetSize(int64_t* size_out) override; |
| 202 bool IsStreaming() override; | 207 bool IsStreaming() override; |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 333 // reaching into this class from multiple threads to attain a WeakPtr. | 338 // reaching into this class from multiple threads to attain a WeakPtr. |
| 334 base::WeakPtr<BufferedDataSource> weak_ptr_; | 339 base::WeakPtr<BufferedDataSource> weak_ptr_; |
| 335 base::WeakPtrFactory<BufferedDataSource> weak_factory_; | 340 base::WeakPtrFactory<BufferedDataSource> weak_factory_; |
| 336 | 341 |
| 337 DISALLOW_COPY_AND_ASSIGN(BufferedDataSource); | 342 DISALLOW_COPY_AND_ASSIGN(BufferedDataSource); |
| 338 }; | 343 }; |
| 339 | 344 |
| 340 } // namespace media | 345 } // namespace media |
| 341 | 346 |
| 342 #endif // MEDIA_BLINK_BUFFERED_DATA_SOURCE_H_ | 347 #endif // MEDIA_BLINK_BUFFERED_DATA_SOURCE_H_ |
| OLD | NEW |