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

Side by Side Diff: net/spdy/hpack_output_stream.cc

Issue 266243004: Clang format slam. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "net/spdy/hpack_output_stream.h" 5 #include "net/spdy/hpack_output_stream.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 8
9
10 namespace net { 9 namespace net {
11 10
12 using base::StringPiece; 11 using base::StringPiece;
13 using std::string; 12 using std::string;
14 13
15 HpackOutputStream::HpackOutputStream() 14 HpackOutputStream::HpackOutputStream() : bit_offset_(0) {
16 : bit_offset_(0) {} 15 }
17 16
18 HpackOutputStream::~HpackOutputStream() {} 17 HpackOutputStream::~HpackOutputStream() {
18 }
19 19
20 void HpackOutputStream::AppendBits(uint8 bits, size_t bit_size) { 20 void HpackOutputStream::AppendBits(uint8 bits, size_t bit_size) {
21 DCHECK_GT(bit_size, 0u); 21 DCHECK_GT(bit_size, 0u);
22 DCHECK_LE(bit_size, 8u); 22 DCHECK_LE(bit_size, 8u);
23 DCHECK_EQ(bits >> bit_size, 0); 23 DCHECK_EQ(bits >> bit_size, 0);
24 size_t new_bit_offset = bit_offset_ + bit_size; 24 size_t new_bit_offset = bit_offset_ + bit_size;
25 if (bit_offset_ == 0) { 25 if (bit_offset_ == 0) {
26 // Buffer ends on a byte boundary. 26 // Buffer ends on a byte boundary.
27 DCHECK_LE(bit_size, 8u); 27 DCHECK_LE(bit_size, 8u);
28 buffer_.append(1, bits << (8 - bit_size)); 28 buffer_.append(1, bits << (8 - bit_size));
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 void HpackOutputStream::TakeString(string* output) { 68 void HpackOutputStream::TakeString(string* output) {
69 // This must hold, since all public functions cause the buffer to 69 // This must hold, since all public functions cause the buffer to
70 // end on a byte boundary. 70 // end on a byte boundary.
71 DCHECK_EQ(bit_offset_, 0u); 71 DCHECK_EQ(bit_offset_, 0u);
72 buffer_.swap(*output); 72 buffer_.swap(*output);
73 buffer_.clear(); 73 buffer_.clear();
74 bit_offset_ = 0; 74 bit_offset_ = 0;
75 } 75 }
76 76
77 } // namespace net 77 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698