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

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

Issue 9270030: net: Don't merge HTTP headers and body if the body is not in memory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix win build Created 8 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
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 "net/base/upload_data.h" 5 #include "net/base/upload_data.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 if (is_chunked_) 170 if (is_chunked_)
171 return 0; 171 return 0;
172 172
173 uint64 len = 0; 173 uint64 len = 0;
174 std::vector<Element>::iterator it = elements_.begin(); 174 std::vector<Element>::iterator it = elements_.begin();
175 for (; it != elements_.end(); ++it) 175 for (; it != elements_.end(); ++it)
176 len += (*it).GetContentLength(); 176 len += (*it).GetContentLength();
177 return len; 177 return len;
178 } 178 }
179 179
180 bool UploadData::IsInMemory() const {
181 // Chunks are provided as a stream, hence it's not in memory.
wtc 2012/01/24 19:08:04 Nit: this comment is not 100% accurate. Chunks ar
satorux1 2012/01/24 19:25:42 Done.
182 if (is_chunked_)
wtc 2012/01/24 19:08:04 Question: Is this test necessary? If is_chunked_
satorux1 2012/01/24 19:25:42 I originally thought about it, but there is a case
183 return false;
184
185 for (size_t i = 0; i < elements_.size(); ++i) {
186 if (elements_[i].type() != TYPE_BYTES)
187 return false;
188 }
189 return true;
190 }
191
180 void UploadData::SetElements(const std::vector<Element>& elements) { 192 void UploadData::SetElements(const std::vector<Element>& elements) {
181 elements_ = elements; 193 elements_ = elements;
182 } 194 }
183 195
184 UploadData::~UploadData() { 196 UploadData::~UploadData() {
185 } 197 }
186 198
187 } // namespace net 199 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698