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

Side by Side Diff: net/base/chunked_upload_data_stream.cc

Issue 2259823002: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 3 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/base/elements_upload_data_stream_unittest.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/base/chunked_upload_data_stream.h" 5 #include "net/base/chunked_upload_data_stream.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "net/base/io_buffer.h" 9 #include "net/base/io_buffer.h"
10 #include "net/base/net_errors.h" 10 #include "net/base/net_errors.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 return base::WrapUnique(new Writer(weak_factory_.GetWeakPtr())); 42 return base::WrapUnique(new Writer(weak_factory_.GetWeakPtr()));
43 } 43 }
44 44
45 void ChunkedUploadDataStream::AppendData( 45 void ChunkedUploadDataStream::AppendData(
46 const char* data, int data_len, bool is_done) { 46 const char* data, int data_len, bool is_done) {
47 DCHECK(!all_data_appended_); 47 DCHECK(!all_data_appended_);
48 DCHECK(data_len > 0 || is_done); 48 DCHECK(data_len > 0 || is_done);
49 if (data_len > 0) { 49 if (data_len > 0) {
50 DCHECK(data); 50 DCHECK(data);
51 upload_data_.push_back( 51 upload_data_.push_back(
52 base::WrapUnique(new std::vector<char>(data, data + data_len))); 52 base::MakeUnique<std::vector<char>>(data, data + data_len));
53 } 53 }
54 all_data_appended_ = is_done; 54 all_data_appended_ = is_done;
55 55
56 if (!read_buffer_.get()) 56 if (!read_buffer_.get())
57 return; 57 return;
58 58
59 int result = ReadChunk(read_buffer_.get(), read_buffer_len_); 59 int result = ReadChunk(read_buffer_.get(), read_buffer_len_);
60 // Shouldn't get an error or ERR_IO_PENDING. 60 // Shouldn't get an error or ERR_IO_PENDING.
61 DCHECK_GE(result, 0); 61 DCHECK_GE(result, 0);
62 read_buffer_ = NULL; 62 read_buffer_ = NULL;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 // ERR_IO_PENDING. The read will be completed in the next call to AppendData. 114 // ERR_IO_PENDING. The read will be completed in the next call to AppendData.
115 if (bytes_read == 0 && !all_data_appended_) 115 if (bytes_read == 0 && !all_data_appended_)
116 return ERR_IO_PENDING; 116 return ERR_IO_PENDING;
117 117
118 if (read_index_ == upload_data_.size() && all_data_appended_) 118 if (read_index_ == upload_data_.size() && all_data_appended_)
119 SetIsFinalChunk(); 119 SetIsFinalChunk();
120 return bytes_read; 120 return bytes_read;
121 } 121 }
122 122
123 } // namespace net 123 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/base/elements_upload_data_stream_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698