Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1755)

Side by Side Diff: media/blink/multibuffer.h

Issue 1971373002: Fix progress reporting for multibuffers to report progress for every byte we receive. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #ifndef MEDIA_BLINK_MULTIBUFFER_H_ 5 #ifndef MEDIA_BLINK_MULTIBUFFER_H_
6 #define MEDIA_BLINK_MULTIBUFFER_H_ 6 #define MEDIA_BLINK_MULTIBUFFER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 virtual ~DataProvider() {} 107 virtual ~DataProvider() {}
108 108
109 // Returns the block number that is to be returned 109 // Returns the block number that is to be returned
110 // by the next Read() call. 110 // by the next Read() call.
111 virtual MultiBufferBlockId Tell() const = 0; 111 virtual MultiBufferBlockId Tell() const = 0;
112 112
113 // Returns true if one (or more) blocks are 113 // Returns true if one (or more) blocks are
114 // availble to read. 114 // availble to read.
115 virtual bool Available() const = 0; 115 virtual bool Available() const = 0;
116 116
117 // Returns how many bytes are available, note that Available() may still
118 // return false even if AvailableBytes() returns true.
119 virtual int64_t AvailableBytes() const = 0;
120
117 // Returns the next block. Only valid if Available() 121 // Returns the next block. Only valid if Available()
118 // returns true. Last block might be of a smaller size 122 // returns true. Last block might be of a smaller size
119 // and after the last block we will get an end-of-stream 123 // and after the last block we will get an end-of-stream
120 // DataBuffer. 124 // DataBuffer.
121 virtual scoped_refptr<DataBuffer> Read() = 0; 125 virtual scoped_refptr<DataBuffer> Read() = 0;
122 126
123 // Ask the data provider to stop giving us data. 127 // Ask the data provider to stop giving us data.
124 // It's ok if the effect is not immediate. 128 // It's ok if the effect is not immediate.
125 virtual void SetDeferred(bool deferred) = 0; 129 virtual void SetDeferred(bool deferred) = 0;
126 }; 130 };
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 // Unpin block 4 & 5: PinRange(4, 6, -1); 246 // Unpin block 4 & 5: PinRange(4, 6, -1);
243 void PinRange(const BlockId& from, const BlockId& to, int32_t how_much); 247 void PinRange(const BlockId& from, const BlockId& to, int32_t how_much);
244 248
245 // Calls PinRange for each range in |ranges|, convenience 249 // Calls PinRange for each range in |ranges|, convenience
246 // function for applying multiple changes to the pinned ranges. 250 // function for applying multiple changes to the pinned ranges.
247 void PinRanges(const IntervalMap<BlockId, int32_t>& ranges); 251 void PinRanges(const IntervalMap<BlockId, int32_t>& ranges);
248 252
249 // Increment max cache size by |size| (counted in blocks). 253 // Increment max cache size by |size| (counted in blocks).
250 void IncrementMaxSize(int32_t size); 254 void IncrementMaxSize(int32_t size);
251 255
256 int64_t UncommittedBytesAt(const BlockId& block);
wolenetz 2016/05/12 23:41:17 nit: document this public method please.
hubbe 2016/05/13 00:05:14 Done.
257
252 // Caller takes ownership of 'provider', cache will 258 // Caller takes ownership of 'provider', cache will
253 // not call it anymore. 259 // not call it anymore.
254 std::unique_ptr<DataProvider> RemoveProvider(DataProvider* provider); 260 std::unique_ptr<DataProvider> RemoveProvider(DataProvider* provider);
255 261
256 // Add a writer to this cache. Cache takes ownership, and may 262 // Add a writer to this cache. Cache takes ownership, and may
257 // destroy |provider| later. (Not during this call.) 263 // destroy |provider| later. (Not during this call.)
258 void AddProvider(std::unique_ptr<DataProvider> provider); 264 void AddProvider(std::unique_ptr<DataProvider> provider);
259 265
260 // Transfer all data from |other| to this. 266 // Transfer all data from |other| to this.
261 void MergeFrom(MultiBuffer* other); 267 void MergeFrom(MultiBuffer* other);
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 // and 0 for all blocks that are not. Used to quickly figure out 344 // and 0 for all blocks that are not. Used to quickly figure out
339 // ranges of available/unavailable blocks without iterating. 345 // ranges of available/unavailable blocks without iterating.
340 IntervalMap<BlockId, int32_t> present_; 346 IntervalMap<BlockId, int32_t> present_;
341 347
342 DISALLOW_COPY_AND_ASSIGN(MultiBuffer); 348 DISALLOW_COPY_AND_ASSIGN(MultiBuffer);
343 }; 349 };
344 350
345 } // namespace media 351 } // namespace media
346 352
347 #endif // MEDIA_BLINK_MULTIBUFFER_H_ 353 #endif // MEDIA_BLINK_MULTIBUFFER_H_
OLDNEW
« no previous file with comments | « no previous file | media/blink/multibuffer.cc » ('j') | media/blink/multibuffer_data_source_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698