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

Side by Side Diff: net/spdy/spdy_buffer.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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/spdy_buffer.h" 5 #include "net/spdy/spdy_buffer.h"
6 6
7 #include <cstring> 7 #include <cstring>
8 8
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 data_ = NULL; 50 data_ = NULL;
51 } 51 }
52 52
53 const scoped_refptr<SharedFrame> shared_frame_; 53 const scoped_refptr<SharedFrame> shared_frame_;
54 const size_t offset_; 54 const size_t offset_;
55 55
56 DISALLOW_COPY_AND_ASSIGN(SharedFrameIOBuffer); 56 DISALLOW_COPY_AND_ASSIGN(SharedFrameIOBuffer);
57 }; 57 };
58 58
59 SpdyBuffer::SpdyBuffer(scoped_ptr<SpdyFrame> frame) 59 SpdyBuffer::SpdyBuffer(scoped_ptr<SpdyFrame> frame)
60 : shared_frame_(new SharedFrame()), 60 : shared_frame_(new SharedFrame()), offset_(0) {
61 offset_(0) {
62 shared_frame_->data = frame.Pass(); 61 shared_frame_->data = frame.Pass();
63 } 62 }
64 63
65 // The given data may not be strictly a SPDY frame; we (ab)use 64 // The given data may not be strictly a SPDY frame; we (ab)use
66 // |frame_| just as a container. 65 // |frame_| just as a container.
67 SpdyBuffer::SpdyBuffer(const char* data, size_t size) : 66 SpdyBuffer::SpdyBuffer(const char* data, size_t size)
68 shared_frame_(new SharedFrame()), 67 : shared_frame_(new SharedFrame()), offset_(0) {
69 offset_(0) {
70 CHECK_GT(size, 0u); 68 CHECK_GT(size, 0u);
71 CHECK_LE(size, kMaxSpdyFrameSize); 69 CHECK_LE(size, kMaxSpdyFrameSize);
72 shared_frame_->data = MakeSpdyFrame(data, size); 70 shared_frame_->data = MakeSpdyFrame(data, size);
73 } 71 }
74 72
75 SpdyBuffer::~SpdyBuffer() { 73 SpdyBuffer::~SpdyBuffer() {
76 if (GetRemainingSize() > 0) 74 if (GetRemainingSize() > 0)
77 ConsumeHelper(GetRemainingSize(), DISCARD); 75 ConsumeHelper(GetRemainingSize(), DISCARD);
78 } 76 }
79 77
(...skipping 16 matching lines...) Expand all
96 IOBuffer* SpdyBuffer::GetIOBufferForRemainingData() { 94 IOBuffer* SpdyBuffer::GetIOBufferForRemainingData() {
97 return new SharedFrameIOBuffer(shared_frame_, offset_); 95 return new SharedFrameIOBuffer(shared_frame_, offset_);
98 } 96 }
99 97
100 void SpdyBuffer::ConsumeHelper(size_t consume_size, 98 void SpdyBuffer::ConsumeHelper(size_t consume_size,
101 ConsumeSource consume_source) { 99 ConsumeSource consume_source) {
102 DCHECK_GE(consume_size, 1u); 100 DCHECK_GE(consume_size, 1u);
103 DCHECK_LE(consume_size, GetRemainingSize()); 101 DCHECK_LE(consume_size, GetRemainingSize());
104 offset_ += consume_size; 102 offset_ += consume_size;
105 for (std::vector<ConsumeCallback>::const_iterator it = 103 for (std::vector<ConsumeCallback>::const_iterator it =
106 consume_callbacks_.begin(); it != consume_callbacks_.end(); ++it) { 104 consume_callbacks_.begin();
105 it != consume_callbacks_.end();
106 ++it) {
107 it->Run(consume_size, consume_source); 107 it->Run(consume_size, consume_source);
108 } 108 }
109 }; 109 };
110 110
111 } // namespace net 111 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698