Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 113 uint64 UploadData::Element::BytesRemaining() { | 113 uint64 UploadData::Element::BytesRemaining() { |
| 114 return GetContentLength() - offset_; | 114 return GetContentLength() - offset_; |
| 115 } | 115 } |
| 116 | 116 |
| 117 void UploadData::Element::ResetOffset() { | 117 void UploadData::Element::ResetOffset() { |
| 118 offset_ = 0; | 118 offset_ = 0; |
| 119 | 119 |
| 120 // Delete the file stream if already opened, so we can reread the file from | 120 // Delete the file stream if already opened, so we can reread the file from |
| 121 // the beginning. | 121 // the beginning. |
| 122 if (file_stream_) { | 122 if (file_stream_) { |
| 123 // Temporarily allow until fix: http://crbug.com/72001. | |
| 124 base::ThreadRestrictions::ScopedAllowIO allow_io; | |
|
eroman
2012/08/09 05:29:33
This removal seems unrelated to this changelist (I
hashimoto
2012/08/09 13:35:02
UploadData::ResetOffset() is the only user of Uplo
| |
| 125 file_stream_->CloseSync(); | 123 file_stream_->CloseSync(); |
| 126 delete file_stream_; | 124 delete file_stream_; |
| 127 file_stream_ = NULL; | 125 file_stream_ = NULL; |
| 128 } | 126 } |
| 129 } | 127 } |
| 130 | 128 |
| 131 FileStream* UploadData::Element::OpenFileStream() { | 129 FileStream* UploadData::Element::OpenFileStream() { |
| 132 scoped_ptr<FileStream> file(new FileStream(NULL)); | 130 scoped_ptr<FileStream> file(new FileStream(NULL)); |
| 133 int64 rv = file->OpenSync( | 131 int64 rv = file->OpenSync( |
| 134 file_path_, | 132 file_path_, |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 299 return; | 297 return; |
| 300 | 298 |
| 301 for (size_t i = 0; i < elements_.size(); ++i) | 299 for (size_t i = 0; i < elements_.size(); ++i) |
| 302 *content_length += elements_[i].GetContentLength(); | 300 *content_length += elements_[i].GetContentLength(); |
| 303 } | 301 } |
| 304 | 302 |
| 305 UploadData::~UploadData() { | 303 UploadData::~UploadData() { |
| 306 } | 304 } |
| 307 | 305 |
| 308 } // namespace net | 306 } // namespace net |
| OLD | NEW |