OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #include <set> | 5 #include <set> |
6 #include <utility> | 6 #include <utility> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
11 #include "media/blink/resource_multibuffer_data_provider.h" | 11 #include "media/blink/resource_multibuffer_data_provider.h" |
12 #include "media/blink/url_index.h" | 12 #include "media/blink/url_index.h" |
13 | 13 |
14 namespace media { | 14 namespace media { |
15 | 15 |
16 const int kBlockSizeShift = 15; // 1<<15 == 32kb | 16 const int kBlockSizeShift = 15; // 1<<15 == 32kb |
17 const int kUrlMappingTimeoutSeconds = 300; | 17 const int kUrlMappingTimeoutSeconds = 300; |
18 | 18 |
19 ResourceMultiBuffer::ResourceMultiBuffer(UrlData* url_data, int block_shift) | 19 ResourceMultiBuffer::ResourceMultiBuffer(UrlData* url_data, int block_shift) |
20 : MultiBuffer(block_shift, url_data->url_index_->lru_), | 20 : MultiBuffer(block_shift, url_data->url_index_->lru_), |
21 url_data_(url_data) {} | 21 url_data_(url_data) {} |
22 | 22 |
23 ResourceMultiBuffer::~ResourceMultiBuffer() {} | 23 ResourceMultiBuffer::~ResourceMultiBuffer() {} |
24 | 24 |
25 scoped_ptr<MultiBuffer::DataProvider> ResourceMultiBuffer::CreateWriter( | 25 std::unique_ptr<MultiBuffer::DataProvider> ResourceMultiBuffer::CreateWriter( |
26 const MultiBufferBlockId& pos) { | 26 const MultiBufferBlockId& pos) { |
27 ResourceMultiBufferDataProvider* ret = | 27 ResourceMultiBufferDataProvider* ret = |
28 new ResourceMultiBufferDataProvider(url_data_, pos); | 28 new ResourceMultiBufferDataProvider(url_data_, pos); |
29 ret->Start(); | 29 ret->Start(); |
30 return scoped_ptr<MultiBuffer::DataProvider>(ret); | 30 return std::unique_ptr<MultiBuffer::DataProvider>(ret); |
31 } | 31 } |
32 | 32 |
33 bool ResourceMultiBuffer::RangeSupported() const { | 33 bool ResourceMultiBuffer::RangeSupported() const { |
34 return url_data_->range_supported_; | 34 return url_data_->range_supported_; |
35 } | 35 } |
36 | 36 |
37 void ResourceMultiBuffer::OnEmpty() { | 37 void ResourceMultiBuffer::OnEmpty() { |
38 url_data_->OnEmpty(); | 38 url_data_->OnEmpty(); |
39 } | 39 } |
40 | 40 |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 url_data->CachedSize() > (*by_url_slot)->CachedSize())) { | 229 url_data->CachedSize() > (*by_url_slot)->CachedSize())) { |
230 *by_url_slot = url_data; | 230 *by_url_slot = url_data; |
231 } else { | 231 } else { |
232 (*by_url_slot)->MergeFrom(url_data); | 232 (*by_url_slot)->MergeFrom(url_data); |
233 } | 233 } |
234 } | 234 } |
235 return *by_url_slot; | 235 return *by_url_slot; |
236 } | 236 } |
237 | 237 |
238 } // namespace media | 238 } // namespace media |
OLD | NEW |