| 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 <string> | 11 #include <string> |
| 11 #include <vector> | 12 #include <vector> |
| 12 | 13 |
| 13 #include "base/callback.h" | 14 #include "base/callback.h" |
| 14 #include "base/macros.h" | 15 #include "base/macros.h" |
| 15 #include "base/memory/scoped_ptr.h" | |
| 16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 17 #include "base/synchronization/lock.h" | 17 #include "base/synchronization/lock.h" |
| 18 #include "media/base/data_source.h" | 18 #include "media/base/data_source.h" |
| 19 #include "media/base/ranges.h" | 19 #include "media/base/ranges.h" |
| 20 #include "media/blink/buffered_resource_loader.h" | 20 #include "media/blink/buffered_resource_loader.h" |
| 21 #include "media/blink/media_blink_export.h" | 21 #include "media/blink/media_blink_export.h" |
| 22 #include "url/gurl.h" | 22 #include "url/gurl.h" |
| 23 | 23 |
| 24 namespace base { | 24 namespace base { |
| 25 class SingleThreadTaskRunner; | 25 class SingleThreadTaskRunner; |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 int64_t total_bytes_; | 259 int64_t total_bytes_; |
| 260 | 260 |
| 261 // This value will be true if this data source can only support streaming. | 261 // This value will be true if this data source can only support streaming. |
| 262 // i.e. range request is not supported. | 262 // i.e. range request is not supported. |
| 263 bool streaming_; | 263 bool streaming_; |
| 264 | 264 |
| 265 // A webframe for loading. | 265 // A webframe for loading. |
| 266 blink::WebFrame* frame_; | 266 blink::WebFrame* frame_; |
| 267 | 267 |
| 268 // A resource loader for the media resource. | 268 // A resource loader for the media resource. |
| 269 scoped_ptr<BufferedResourceLoader> loader_; | 269 std::unique_ptr<BufferedResourceLoader> loader_; |
| 270 | 270 |
| 271 // Callback method from the pipeline for initialization. | 271 // Callback method from the pipeline for initialization. |
| 272 InitializeCB init_cb_; | 272 InitializeCB init_cb_; |
| 273 | 273 |
| 274 // Read parameters received from the Read() method call. Must be accessed | 274 // Read parameters received from the Read() method call. Must be accessed |
| 275 // under |lock_|. | 275 // under |lock_|. |
| 276 class ReadOperation; | 276 class ReadOperation; |
| 277 scoped_ptr<ReadOperation> read_op_; | 277 std::unique_ptr<ReadOperation> read_op_; |
| 278 | 278 |
| 279 // This buffer is intermediate, we use it for BufferedResourceLoader to write | 279 // This buffer is intermediate, we use it for BufferedResourceLoader to write |
| 280 // to. And when read in BufferedResourceLoader is done, we copy data from | 280 // to. And when read in BufferedResourceLoader is done, we copy data from |
| 281 // this buffer to |read_buffer_|. The reason for an additional copy is that | 281 // this buffer to |read_buffer_|. The reason for an additional copy is that |
| 282 // we don't own |read_buffer_|. But since the read operation is asynchronous, | 282 // we don't own |read_buffer_|. But since the read operation is asynchronous, |
| 283 // |read_buffer| can be destroyed at any time, so we only copy into | 283 // |read_buffer| can be destroyed at any time, so we only copy into |
| 284 // |read_buffer| in the final step when it is safe. | 284 // |read_buffer| in the final step when it is safe. |
| 285 // Memory is allocated for this member during initialization of this object | 285 // Memory is allocated for this member during initialization of this object |
| 286 // because we want buffer to be passed into BufferedResourceLoader to be | 286 // because we want buffer to be passed into BufferedResourceLoader to be |
| 287 // always non-null. And by initializing this member with a default size we can | 287 // always non-null. And by initializing this member with a default size we can |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 // reaching into this class from multiple threads to attain a WeakPtr. | 333 // reaching into this class from multiple threads to attain a WeakPtr. |
| 334 base::WeakPtr<BufferedDataSource> weak_ptr_; | 334 base::WeakPtr<BufferedDataSource> weak_ptr_; |
| 335 base::WeakPtrFactory<BufferedDataSource> weak_factory_; | 335 base::WeakPtrFactory<BufferedDataSource> weak_factory_; |
| 336 | 336 |
| 337 DISALLOW_COPY_AND_ASSIGN(BufferedDataSource); | 337 DISALLOW_COPY_AND_ASSIGN(BufferedDataSource); |
| 338 }; | 338 }; |
| 339 | 339 |
| 340 } // namespace media | 340 } // namespace media |
| 341 | 341 |
| 342 #endif // MEDIA_BLINK_BUFFERED_DATA_SOURCE_H_ | 342 #endif // MEDIA_BLINK_BUFFERED_DATA_SOURCE_H_ |
| OLD | NEW |