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

Side by Side Diff: net/filter/block_buffer.cc

Issue 1662763002: [ON HOLD] Implement pull-based design for content decoding (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "net/filter/block_buffer.h"
6
7 namespace {
8
9 const size_t kBufferSize = 32 * 1024;
10
11 } // namespace
12
13 namespace net {
14
15 BlockBuffer::BlockBuffer()
16 : buffer_(new IOBuffer(kBufferSize)),
17 bytes_(buffer_->data()),
18 bytes_left_(0) {}
19 BlockBuffer::~BlockBuffer() {}
20
21 bool BlockBuffer::HasMoreBytes() const {
22 return bytes_left_ > 0;
23 }
24
25 void BlockBuffer::WasRefilled(size_t filled_bytes) {
26 DCHECK(bytes_left_ == 0);
27 bytes_ = buffer_->data();
28 bytes_left_ = filled_bytes;
29 }
30
31 void BlockBuffer::WasDrained(size_t drained_bytes) {
32 DCHECK(drained_bytes <= bytes_left_);
33 bytes_left_ -= drained_bytes;
34 bytes_ += drained_bytes;
35 }
36
37 size_t BlockBuffer::size() const {
38 return kBufferSize;
39 }
40
41 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698