| 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 int64 rv = file->OpenSync( | 119 int64 rv = file->OpenSync( |
| 120 file_path_, | 120 file_path_, |
| 121 base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ); | 121 base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ); |
| 122 if (rv != OK) { | 122 if (rv != OK) { |
| 123 // If the file can't be opened, we'll just upload an empty file. | 123 // If the file can't be opened, we'll just upload an empty file. |
| 124 DLOG(WARNING) << "Failed to open \"" << file_path_.value() | 124 DLOG(WARNING) << "Failed to open \"" << file_path_.value() |
| 125 << "\" for reading: " << rv; | 125 << "\" for reading: " << rv; |
| 126 return NULL; | 126 return NULL; |
| 127 } | 127 } |
| 128 if (file_range_offset_) { | 128 if (file_range_offset_) { |
| 129 rv = file->Seek(FROM_BEGIN, file_range_offset_); | 129 rv = file->SeekSync(FROM_BEGIN, file_range_offset_); |
| 130 if (rv < 0) { | 130 if (rv < 0) { |
| 131 DLOG(WARNING) << "Failed to seek \"" << file_path_.value() | 131 DLOG(WARNING) << "Failed to seek \"" << file_path_.value() |
| 132 << "\" to offset: " << file_range_offset_ << " (" << rv | 132 << "\" to offset: " << file_range_offset_ << " (" << rv |
| 133 << ")"; | 133 << ")"; |
| 134 return NULL; | 134 return NULL; |
| 135 } | 135 } |
| 136 } | 136 } |
| 137 | 137 |
| 138 return file.release(); | 138 return file.release(); |
| 139 } | 139 } |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 return; | 285 return; |
| 286 | 286 |
| 287 for (size_t i = 0; i < elements_.size(); ++i) | 287 for (size_t i = 0; i < elements_.size(); ++i) |
| 288 *content_length += elements_[i].GetContentLength(); | 288 *content_length += elements_[i].GetContentLength(); |
| 289 } | 289 } |
| 290 | 290 |
| 291 UploadData::~UploadData() { | 291 UploadData::~UploadData() { |
| 292 } | 292 } |
| 293 | 293 |
| 294 } // namespace net | 294 } // namespace net |
| OLD | NEW |