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

Side by Side Diff: remoting/protocol/buffered_socket_writer.cc

Issue 15782010: Update remoting/ and jingle/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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
« no previous file with comments | « remoting/protocol/authenticator_test_base.cc ('k') | remoting/protocol/channel_multiplexer.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "remoting/protocol/buffered_socket_writer.h" 5 #include "remoting/protocol/buffered_socket_writer.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 delete queue_.front(); 168 delete queue_.front();
169 queue_.pop_front(); 169 queue_.pop_front();
170 return result; 170 return result;
171 } 171 }
172 172
173 BufferedSocketWriter::BufferedSocketWriter() { 173 BufferedSocketWriter::BufferedSocketWriter() {
174 } 174 }
175 175
176 void BufferedSocketWriter::GetNextPacket( 176 void BufferedSocketWriter::GetNextPacket(
177 net::IOBuffer** buffer, int* size) { 177 net::IOBuffer** buffer, int* size) {
178 if (!current_buf_) { 178 if (!current_buf_.get()) {
179 if (queue_.empty()) { 179 if (queue_.empty()) {
180 *buffer = NULL; 180 *buffer = NULL;
181 return; // Nothing to write. 181 return; // Nothing to write.
182 } 182 }
183 current_buf_ = new net::DrainableIOBuffer( 183 current_buf_ = new net::DrainableIOBuffer(queue_.front()->data.get(),
184 queue_.front()->data, queue_.front()->data->size()); 184 queue_.front()->data->size());
185 } 185 }
186 186
187 *buffer = current_buf_; 187 *buffer = current_buf_.get();
188 *size = current_buf_->BytesRemaining(); 188 *size = current_buf_->BytesRemaining();
189 } 189 }
190 190
191 base::Closure BufferedSocketWriter::AdvanceBufferPosition(int written) { 191 base::Closure BufferedSocketWriter::AdvanceBufferPosition(int written) {
192 buffer_size_ -= written; 192 buffer_size_ -= written;
193 current_buf_->DidConsume(written); 193 current_buf_->DidConsume(written);
194 194
195 if (current_buf_->BytesRemaining() == 0) { 195 if (current_buf_->BytesRemaining() == 0) {
196 current_buf_ = NULL; 196 current_buf_ = NULL;
197 return PopQueue(); 197 return PopQueue();
(...skipping 10 matching lines...) Expand all
208 208
209 BufferedDatagramWriter::BufferedDatagramWriter() { 209 BufferedDatagramWriter::BufferedDatagramWriter() {
210 } 210 }
211 211
212 void BufferedDatagramWriter::GetNextPacket( 212 void BufferedDatagramWriter::GetNextPacket(
213 net::IOBuffer** buffer, int* size) { 213 net::IOBuffer** buffer, int* size) {
214 if (queue_.empty()) { 214 if (queue_.empty()) {
215 *buffer = NULL; 215 *buffer = NULL;
216 return; // Nothing to write. 216 return; // Nothing to write.
217 } 217 }
218 *buffer = queue_.front()->data; 218 *buffer = queue_.front()->data.get();
219 *size = queue_.front()->data->size(); 219 *size = queue_.front()->data->size();
220 } 220 }
221 221
222 base::Closure BufferedDatagramWriter::AdvanceBufferPosition(int written) { 222 base::Closure BufferedDatagramWriter::AdvanceBufferPosition(int written) {
223 DCHECK_EQ(written, queue_.front()->data->size()); 223 DCHECK_EQ(written, queue_.front()->data->size());
224 buffer_size_ -= queue_.front()->data->size(); 224 buffer_size_ -= queue_.front()->data->size();
225 return PopQueue(); 225 return PopQueue();
226 } 226 }
227 227
228 void BufferedDatagramWriter::OnError(int result) { 228 void BufferedDatagramWriter::OnError(int result) {
229 // Nothing to do here. 229 // Nothing to do here.
230 } 230 }
231 231
232 BufferedDatagramWriter::~BufferedDatagramWriter() { 232 BufferedDatagramWriter::~BufferedDatagramWriter() {
233 } 233 }
234 234
235 } // namespace protocol 235 } // namespace protocol
236 } // namespace remoting 236 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/authenticator_test_base.cc ('k') | remoting/protocol/channel_multiplexer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698