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

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

Issue 6339012: More net/ method ordering. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More done while waiting for previous patch to clear Created 9 years, 11 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 | « net/base/upload_data.cc ('k') | net/base/x509_certificate.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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/upload_data_stream.h" 5 #include "net/base/upload_data_stream.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "net/base/file_stream.h" 9 #include "net/base/file_stream.h"
10 #include "net/base/io_buffer.h" 10 #include "net/base/io_buffer.h"
11 #include "net/base/net_errors.h" 11 #include "net/base/net_errors.h"
12 12
13 namespace net { 13 namespace net {
14 14
15 UploadDataStream::~UploadDataStream() {
16 }
17
15 UploadDataStream* UploadDataStream::Create(UploadData* data, int* error_code) { 18 UploadDataStream* UploadDataStream::Create(UploadData* data, int* error_code) {
16 scoped_ptr<UploadDataStream> stream(new UploadDataStream(data)); 19 scoped_ptr<UploadDataStream> stream(new UploadDataStream(data));
17 int rv = stream->FillBuf(); 20 int rv = stream->FillBuf();
18 if (error_code) 21 if (error_code)
19 *error_code = rv; 22 *error_code = rv;
20 if (rv != OK) 23 if (rv != OK)
21 return NULL; 24 return NULL;
22 25
23 return stream.release(); 26 return stream.release();
24 } 27 }
(...skipping 18 matching lines...) Expand all
43 buf_(new IOBuffer(kBufSize)), 46 buf_(new IOBuffer(kBufSize)),
44 buf_len_(0), 47 buf_len_(0),
45 next_element_(0), 48 next_element_(0),
46 next_element_offset_(0), 49 next_element_offset_(0),
47 next_element_remaining_(0), 50 next_element_remaining_(0),
48 total_size_(data->is_chunked() ? 0 : data->GetContentLength()), 51 total_size_(data->is_chunked() ? 0 : data->GetContentLength()),
49 current_position_(0), 52 current_position_(0),
50 eof_(false) { 53 eof_(false) {
51 } 54 }
52 55
53 UploadDataStream::~UploadDataStream() {
54 }
55
56 int UploadDataStream::FillBuf() { 56 int UploadDataStream::FillBuf() {
57 std::vector<UploadData::Element>& elements = *data_->elements(); 57 std::vector<UploadData::Element>& elements = *data_->elements();
58 58
59 while (buf_len_ < kBufSize && next_element_ < elements.size()) { 59 while (buf_len_ < kBufSize && next_element_ < elements.size()) {
60 bool advance_to_next_element = false; 60 bool advance_to_next_element = false;
61 61
62 UploadData::Element& element = elements[next_element_]; 62 UploadData::Element& element = elements[next_element_];
63 63
64 size_t size_remaining = kBufSize - buf_len_; 64 size_t size_remaining = kBufSize - buf_len_;
65 if (element.type() == UploadData::TYPE_BYTES || 65 if (element.type() == UploadData::TYPE_BYTES ||
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 if (!data_->is_chunked() || 132 if (!data_->is_chunked() ||
133 (!elements.empty() && elements.back().is_last_chunk())) { 133 (!elements.empty() && elements.back().is_last_chunk())) {
134 eof_ = true; 134 eof_ = true;
135 } 135 }
136 } 136 }
137 137
138 return OK; 138 return OK;
139 } 139 }
140 140
141 } // namespace net 141 } // namespace net
OLDNEW
« no previous file with comments | « net/base/upload_data.cc ('k') | net/base/x509_certificate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698