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 <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 | 182 |
183 void SetMustReadWholeFile(bool must_read_whole_file) { | 183 void SetMustReadWholeFile(bool must_read_whole_file) { |
184 must_read_whole_file_ = must_read_whole_file; | 184 must_read_whole_file_ = must_read_whole_file; |
185 } | 185 } |
186 | 186 |
187 int32_t writers_created() const { return writers_created_; } | 187 int32_t writers_created() const { return writers_created_; } |
188 | 188 |
189 void SetRangeSupported(bool supported) { range_supported_ = supported; } | 189 void SetRangeSupported(bool supported) { range_supported_ = supported; } |
190 | 190 |
191 protected: | 191 protected: |
192 scoped_ptr<DataProvider> CreateWriter( | 192 std::unique_ptr<DataProvider> CreateWriter( |
193 const MultiBufferBlockId& pos) override { | 193 const MultiBufferBlockId& pos) override { |
194 DCHECK(create_ok_); | 194 DCHECK(create_ok_); |
195 writers_created_++; | 195 writers_created_++; |
196 CHECK_LT(writers.size(), max_writers_); | 196 CHECK_LT(writers.size(), max_writers_); |
197 return scoped_ptr<DataProvider>(new FakeMultiBufferDataProvider( | 197 return std::unique_ptr<DataProvider>(new FakeMultiBufferDataProvider( |
198 pos, file_size_, max_blocks_after_defer_, must_read_whole_file_, this, | 198 pos, file_size_, max_blocks_after_defer_, must_read_whole_file_, this, |
199 rnd_)); | 199 rnd_)); |
200 } | 200 } |
201 void Prune(size_t max_to_free) override { | 201 void Prune(size_t max_to_free) override { |
202 // Prune should not cause additional writers to be spawned. | 202 // Prune should not cause additional writers to be spawned. |
203 create_ok_ = false; | 203 create_ok_ = false; |
204 MultiBuffer::Prune(max_to_free); | 204 MultiBuffer::Prune(max_to_free); |
205 create_ok_ = true; | 205 create_ok_ = true; |
206 } | 206 } |
207 | 207 |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
566 multibuffer_.CheckLRUState(); | 566 multibuffer_.CheckLRUState(); |
567 } | 567 } |
568 multibuffer_.CheckPresentState(); | 568 multibuffer_.CheckPresentState(); |
569 while (!read_helpers.empty()) { | 569 while (!read_helpers.empty()) { |
570 delete read_helpers.back(); | 570 delete read_helpers.back(); |
571 read_helpers.pop_back(); | 571 read_helpers.pop_back(); |
572 } | 572 } |
573 } | 573 } |
574 | 574 |
575 } // namespace media | 575 } // namespace media |
OLD | NEW |