| 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; this |
| 119 // value may change at a later time. |
| 120 virtual GURL GetUrlAfterRedirects() const = 0; |
| 117 }; | 121 }; |
| 118 | 122 |
| 119 // A data source capable of loading URLs and buffering the data using an | 123 // A data source capable of loading URLs and buffering the data using an |
| 120 // in-memory sliding window. | 124 // in-memory sliding window. |
| 121 // | 125 // |
| 122 // BufferedDataSource must be created and destroyed on the thread associated | 126 // BufferedDataSource must be created and destroyed on the thread associated |
| 123 // with the |task_runner| passed in the constructor. | 127 // with the |task_runner| passed in the constructor. |
| 124 class MEDIA_BLINK_EXPORT BufferedDataSource | 128 class MEDIA_BLINK_EXPORT BufferedDataSource |
| 125 : NON_EXPORTED_BASE(public BufferedDataSourceInterface) { | 129 : NON_EXPORTED_BASE(public BufferedDataSourceInterface) { |
| 126 public: | 130 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 | 187 // Cancels any open network connections once reaching the deferred state. If |
| 184 // |always_cancel| is false this is done only for preload=metadata, non- | 188 // |always_cancel| is false this is done only for preload=metadata, non- |
| 185 // streaming resources that have not started playback. If |always_cancel| is | 189 // streaming resources that have not started playback. If |always_cancel| is |
| 186 // true, all resource types will have their connections canceled. If already | 190 // true, all resource types will have their connections canceled. If already |
| 187 // deferred, connections will be immediately closed. | 191 // deferred, connections will be immediately closed. |
| 188 void OnBufferingHaveEnough(bool always_cancel) override; | 192 void OnBufferingHaveEnough(bool always_cancel) override; |
| 189 | 193 |
| 190 // Returns an estimate of the number of bytes held by the data source. | 194 // Returns an estimate of the number of bytes held by the data source. |
| 191 int64_t GetMemoryUsage() const override; | 195 int64_t GetMemoryUsage() const override; |
| 192 | 196 |
| 197 GURL GetUrlAfterRedirects() const override; |
| 198 |
| 193 // DataSource implementation. | 199 // DataSource implementation. |
| 194 // Called from demuxer thread. | 200 // Called from demuxer thread. |
| 195 void Stop() override; | 201 void Stop() override; |
| 196 | 202 |
| 197 void Read(int64_t position, | 203 void Read(int64_t position, |
| 198 int size, | 204 int size, |
| 199 uint8_t* data, | 205 uint8_t* data, |
| 200 const DataSource::ReadCB& read_cb) override; | 206 const DataSource::ReadCB& read_cb) override; |
| 201 bool GetSize(int64_t* size_out) override; | 207 bool GetSize(int64_t* size_out) override; |
| 202 bool IsStreaming() override; | 208 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. | 339 // reaching into this class from multiple threads to attain a WeakPtr. |
| 334 base::WeakPtr<BufferedDataSource> weak_ptr_; | 340 base::WeakPtr<BufferedDataSource> weak_ptr_; |
| 335 base::WeakPtrFactory<BufferedDataSource> weak_factory_; | 341 base::WeakPtrFactory<BufferedDataSource> weak_factory_; |
| 336 | 342 |
| 337 DISALLOW_COPY_AND_ASSIGN(BufferedDataSource); | 343 DISALLOW_COPY_AND_ASSIGN(BufferedDataSource); |
| 338 }; | 344 }; |
| 339 | 345 |
| 340 } // namespace media | 346 } // namespace media |
| 341 | 347 |
| 342 #endif // MEDIA_BLINK_BUFFERED_DATA_SOURCE_H_ | 348 #endif // MEDIA_BLINK_BUFFERED_DATA_SOURCE_H_ |
| OLD | NEW |