OLD | NEW |
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.h" | 5 #include "net/base/upload_data.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 "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "net/base/file_stream.h" | 10 #include "net/base/file_stream.h" |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 elements_.back().SetToChunk(bytes, bytes_len); | 152 elements_.back().SetToChunk(bytes, bytes_len); |
153 if (chunk_callback_) | 153 if (chunk_callback_) |
154 chunk_callback_->OnChunkAvailable(); | 154 chunk_callback_->OnChunkAvailable(); |
155 } | 155 } |
156 | 156 |
157 void UploadData::set_chunk_callback(ChunkCallback* callback) { | 157 void UploadData::set_chunk_callback(ChunkCallback* callback) { |
158 chunk_callback_ = callback; | 158 chunk_callback_ = callback; |
159 } | 159 } |
160 | 160 |
161 uint64 UploadData::GetContentLength() { | 161 uint64 UploadData::GetContentLength() { |
162 DCHECK(!is_chunked_); | |
163 uint64 len = 0; | 162 uint64 len = 0; |
164 std::vector<Element>::iterator it = elements_.begin(); | 163 std::vector<Element>::iterator it = elements_.begin(); |
165 for (; it != elements_.end(); ++it) | 164 for (; it != elements_.end(); ++it) |
166 len += (*it).GetContentLength(); | 165 len += (*it).GetContentLength(); |
167 return len; | 166 return len; |
168 } | 167 } |
169 | 168 |
170 void UploadData::SetElements(const std::vector<Element>& elements) { | 169 void UploadData::SetElements(const std::vector<Element>& elements) { |
171 elements_ = elements; | 170 elements_ = elements; |
172 } | 171 } |
173 | 172 |
174 UploadData::~UploadData() { | 173 UploadData::~UploadData() { |
175 } | 174 } |
176 | 175 |
177 } // namespace net | 176 } // namespace net |
OLD | NEW |