| 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_file_element_reader.h" | 5 #include "net/base/upload_file_element_reader.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/task_runner_util.h" | 10 #include "base/task_runner_util.h" |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 | 133 |
| 134 if (result < 0) { | 134 if (result < 0) { |
| 135 DLOG(WARNING) << "Failed to seek \"" << path_.value() | 135 DLOG(WARNING) << "Failed to seek \"" << path_.value() |
| 136 << "\" to offset: " << range_offset_ << " (" << result << ")"; | 136 << "\" to offset: " << range_offset_ << " (" << result << ")"; |
| 137 callback.Run(result); | 137 callback.Run(result); |
| 138 return; | 138 return; |
| 139 } | 139 } |
| 140 | 140 |
| 141 base::File::Info* file_info = new base::File::Info; | 141 base::File::Info* file_info = new base::File::Info; |
| 142 bool posted = base::PostTaskAndReplyWithResult( | 142 bool posted = base::PostTaskAndReplyWithResult( |
| 143 task_runner_, | 143 task_runner_.get(), |
| 144 FROM_HERE, | 144 FROM_HERE, |
| 145 base::Bind(&base::GetFileInfo, | 145 base::Bind(&base::GetFileInfo, path_, file_info), |
| 146 path_, | |
| 147 file_info), | |
| 148 base::Bind(&UploadFileElementReader::OnGetFileInfoCompleted, | 146 base::Bind(&UploadFileElementReader::OnGetFileInfoCompleted, |
| 149 weak_ptr_factory_.GetWeakPtr(), | 147 weak_ptr_factory_.GetWeakPtr(), |
| 150 callback, | 148 callback, |
| 151 base::Owned(file_info))); | 149 base::Owned(file_info))); |
| 152 DCHECK(posted); | 150 DCHECK(posted); |
| 153 } | 151 } |
| 154 | 152 |
| 155 void UploadFileElementReader::OnGetFileInfoCompleted( | 153 void UploadFileElementReader::OnGetFileInfoCompleted( |
| 156 const CompletionCallback& callback, | 154 const CompletionCallback& callback, |
| 157 base::File::Info* file_info, | 155 base::File::Info* file_info, |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 ScopedOverridingContentLengthForTests(uint64 value) { | 203 ScopedOverridingContentLengthForTests(uint64 value) { |
| 206 overriding_content_length = value; | 204 overriding_content_length = value; |
| 207 } | 205 } |
| 208 | 206 |
| 209 UploadFileElementReader::ScopedOverridingContentLengthForTests:: | 207 UploadFileElementReader::ScopedOverridingContentLengthForTests:: |
| 210 ~ScopedOverridingContentLengthForTests() { | 208 ~ScopedOverridingContentLengthForTests() { |
| 211 overriding_content_length = 0; | 209 overriding_content_length = 0; |
| 212 } | 210 } |
| 213 | 211 |
| 214 } // namespace net | 212 } // namespace net |
| OLD | NEW |