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

Side by Side Diff: net/websockets/websocket_basic_stream.cc

Issue 1157403005: Subsituting pattern ScopedVector push_back.(ptr.release()) with push_back(ptr.Pass()) in net/websoc… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | net/websockets/websocket_basic_stream_test.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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/websockets/websocket_basic_stream.h" 5 #include "net/websockets/websocket_basic_stream.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 ScopedVector<WebSocketFrameChunk>* frame_chunks, 256 ScopedVector<WebSocketFrameChunk>* frame_chunks,
257 ScopedVector<WebSocketFrame>* frames) { 257 ScopedVector<WebSocketFrame>* frames) {
258 for (size_t i = 0; i < frame_chunks->size(); ++i) { 258 for (size_t i = 0; i < frame_chunks->size(); ++i) {
259 scoped_ptr<WebSocketFrame> frame; 259 scoped_ptr<WebSocketFrame> frame;
260 int result = ConvertChunkToFrame( 260 int result = ConvertChunkToFrame(
261 scoped_ptr<WebSocketFrameChunk>((*frame_chunks)[i]), &frame); 261 scoped_ptr<WebSocketFrameChunk>((*frame_chunks)[i]), &frame);
262 (*frame_chunks)[i] = NULL; 262 (*frame_chunks)[i] = NULL;
263 if (result != OK) 263 if (result != OK)
264 return result; 264 return result;
265 if (frame) 265 if (frame)
266 frames->push_back(frame.release()); 266 frames->push_back(frame.Pass());
267 } 267 }
268 // All the elements of |frame_chunks| are now NULL, so there is no point in 268 // All the elements of |frame_chunks| are now NULL, so there is no point in
269 // calling delete on them all. 269 // calling delete on them all.
270 frame_chunks->weak_clear(); 270 frame_chunks->weak_clear();
271 if (frames->empty()) 271 if (frames->empty())
272 return ERR_IO_PENDING; 272 return ERR_IO_PENDING;
273 return OK; 273 return OK;
274 } 274 }
275 275
276 int WebSocketBasicStream::ConvertChunkToFrame( 276 int WebSocketBasicStream::ConvertChunkToFrame(
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 const CompletionCallback& callback, 415 const CompletionCallback& callback,
416 int result) { 416 int result) {
417 result = HandleReadResult(result, frames); 417 result = HandleReadResult(result, frames);
418 if (result == ERR_IO_PENDING) 418 if (result == ERR_IO_PENDING)
419 result = ReadFrames(frames, callback); 419 result = ReadFrames(frames, callback);
420 if (result != ERR_IO_PENDING) 420 if (result != ERR_IO_PENDING)
421 callback.Run(result); 421 callback.Run(result);
422 } 422 }
423 423
424 } // namespace net 424 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/websockets/websocket_basic_stream_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698