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

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

Issue 14161010: Rewrite scoped_array<T> to scoped_ptr<T[]> in net. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 | « no previous file | no next file » | 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/logging.h" 9 #include "base/logging.h"
10 #include "net/base/io_buffer.h" 10 #include "net/base/io_buffer.h"
11 #include "net/spdy/spdy_protocol.h" 11 #include "net/spdy/spdy_protocol.h"
12 12
13 namespace net { 13 namespace net {
14 14
15 namespace { 15 namespace {
16 16
17 // Makes a SpdyFrame with |size| bytes of data copied from 17 // Makes a SpdyFrame with |size| bytes of data copied from
18 // |data|. |data| must be non-NULL and |size| must be positive. 18 // |data|. |data| must be non-NULL and |size| must be positive.
19 scoped_ptr<SpdyFrame> MakeSpdyFrame(const char* data, size_t size) { 19 scoped_ptr<SpdyFrame> MakeSpdyFrame(const char* data, size_t size) {
20 DCHECK(data); 20 DCHECK(data);
21 DCHECK_GT(size, 0u); 21 DCHECK_GT(size, 0u);
22 scoped_array<char> frame_data(new char[size]); 22 scoped_ptr<char[]> frame_data(new char[size]);
23 std::memcpy(frame_data.get(), data, size); 23 std::memcpy(frame_data.get(), data, size);
24 scoped_ptr<SpdyFrame> frame( 24 scoped_ptr<SpdyFrame> frame(
25 new SpdyFrame(frame_data.release(), size, true /* owns_buffer */)); 25 new SpdyFrame(frame_data.release(), size, true /* owns_buffer */));
26 return frame.Pass(); 26 return frame.Pass();
27 } 27 }
28 28
29 } // namespace 29 } // namespace
30 30
31 SpdyBuffer::SpdyBuffer(scoped_ptr<SpdyFrame> frame) 31 SpdyBuffer::SpdyBuffer(scoped_ptr<SpdyFrame> frame)
32 : frame_(frame.Pass()), 32 : frame_(frame.Pass()),
(...skipping 19 matching lines...) Expand all
52 DCHECK_GE(consume_size, 1u); 52 DCHECK_GE(consume_size, 1u);
53 DCHECK_LE(consume_size, GetRemainingSize()); 53 DCHECK_LE(consume_size, GetRemainingSize());
54 offset_ += consume_size; 54 offset_ += consume_size;
55 }; 55 };
56 56
57 IOBuffer* SpdyBuffer::GetIOBufferForRemainingData() { 57 IOBuffer* SpdyBuffer::GetIOBufferForRemainingData() {
58 return new WrappedIOBuffer(GetRemainingData()); 58 return new WrappedIOBuffer(GetRemainingData());
59 } 59 }
60 60
61 } // namespace net 61 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698