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

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

Issue 935333002: Update from https://crrev.com/316786 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 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
« no previous file with comments | « net/socket/tcp_socket_win.cc ('k') | net/spdy/spdy_framer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
11 #include "base/profiler/scoped_tracker.h"
11 #include "net/base/io_buffer.h" 12 #include "net/base/io_buffer.h"
12 #include "net/spdy/spdy_protocol.h" 13 #include "net/spdy/spdy_protocol.h"
13 14
14 namespace net { 15 namespace net {
15 16
16 namespace { 17 namespace {
17 18
18 // Bound on largest frame any SPDY version has allowed. 19 // Bound on largest frame any SPDY version has allowed.
19 const size_t kMaxSpdyFrameSize = 0x00ffffff; 20 const size_t kMaxSpdyFrameSize = 0x00ffffff;
20 21
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 82
82 size_t SpdyBuffer::GetRemainingSize() const { 83 size_t SpdyBuffer::GetRemainingSize() const {
83 return shared_frame_->data->size() - offset_; 84 return shared_frame_->data->size() - offset_;
84 } 85 }
85 86
86 void SpdyBuffer::AddConsumeCallback(const ConsumeCallback& consume_callback) { 87 void SpdyBuffer::AddConsumeCallback(const ConsumeCallback& consume_callback) {
87 consume_callbacks_.push_back(consume_callback); 88 consume_callbacks_.push_back(consume_callback);
88 } 89 }
89 90
90 void SpdyBuffer::Consume(size_t consume_size) { 91 void SpdyBuffer::Consume(size_t consume_size) {
92 // TODO(pkasting): Remove ScopedTracker below once crbug.com/457517 is fixed.
93 tracked_objects::ScopedTracker tracking_profile(
94 FROM_HERE_WITH_EXPLICIT_FUNCTION("457517 SpdyBuffer::Consume"));
91 ConsumeHelper(consume_size, CONSUME); 95 ConsumeHelper(consume_size, CONSUME);
92 }; 96 };
93 97
94 IOBuffer* SpdyBuffer::GetIOBufferForRemainingData() { 98 IOBuffer* SpdyBuffer::GetIOBufferForRemainingData() {
95 return new SharedFrameIOBuffer(shared_frame_, offset_); 99 return new SharedFrameIOBuffer(shared_frame_, offset_);
96 } 100 }
97 101
98 void SpdyBuffer::ConsumeHelper(size_t consume_size, 102 void SpdyBuffer::ConsumeHelper(size_t consume_size,
99 ConsumeSource consume_source) { 103 ConsumeSource consume_source) {
100 DCHECK_GE(consume_size, 1u); 104 DCHECK_GE(consume_size, 1u);
101 DCHECK_LE(consume_size, GetRemainingSize()); 105 DCHECK_LE(consume_size, GetRemainingSize());
102 offset_ += consume_size; 106 offset_ += consume_size;
103 for (std::vector<ConsumeCallback>::const_iterator it = 107 for (std::vector<ConsumeCallback>::const_iterator it =
104 consume_callbacks_.begin(); it != consume_callbacks_.end(); ++it) { 108 consume_callbacks_.begin(); it != consume_callbacks_.end(); ++it) {
105 it->Run(consume_size, consume_source); 109 it->Run(consume_size, consume_source);
106 } 110 }
107 }; 111 };
108 112
109 } // namespace net 113 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/tcp_socket_win.cc ('k') | net/spdy/spdy_framer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698