| 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 range_length_(range_length), | 119 range_length_(range_length), |
| 120 expected_modification_time_(expected_modification_time), | 120 expected_modification_time_(expected_modification_time), |
| 121 content_length_(0), | 121 content_length_(0), |
| 122 bytes_remaining_(0), | 122 bytes_remaining_(0), |
| 123 ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) { | 123 ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) { |
| 124 } | 124 } |
| 125 | 125 |
| 126 UploadFileElementReader::~UploadFileElementReader() { | 126 UploadFileElementReader::~UploadFileElementReader() { |
| 127 } | 127 } |
| 128 | 128 |
| 129 const UploadFileElementReader* UploadFileElementReader::AsFileReader() const { |
| 130 return this; |
| 131 } |
| 132 |
| 129 int UploadFileElementReader::Init(const CompletionCallback& callback) { | 133 int UploadFileElementReader::Init(const CompletionCallback& callback) { |
| 130 Reset(); | 134 Reset(); |
| 131 | 135 |
| 132 ScopedFileStreamPtr* file_stream = new ScopedFileStreamPtr; | 136 ScopedFileStreamPtr* file_stream = new ScopedFileStreamPtr; |
| 133 uint64* content_length = new uint64; | 137 uint64* content_length = new uint64; |
| 134 const bool posted = base::PostTaskAndReplyWithResult( | 138 const bool posted = base::PostTaskAndReplyWithResult( |
| 135 base::WorkerPool::GetTaskRunner(true /* task_is_slow */), | 139 base::WorkerPool::GetTaskRunner(true /* task_is_slow */), |
| 136 FROM_HERE, | 140 FROM_HERE, |
| 137 base::Bind(&InitInternal, | 141 base::Bind(&InitInternal, |
| 138 path_, | 142 path_, |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 ScopedOverridingContentLengthForTests(uint64 value) { | 245 ScopedOverridingContentLengthForTests(uint64 value) { |
| 242 overriding_content_length = value; | 246 overriding_content_length = value; |
| 243 } | 247 } |
| 244 | 248 |
| 245 UploadFileElementReader::ScopedOverridingContentLengthForTests:: | 249 UploadFileElementReader::ScopedOverridingContentLengthForTests:: |
| 246 ~ScopedOverridingContentLengthForTests() { | 250 ~ScopedOverridingContentLengthForTests() { |
| 247 overriding_content_length = 0; | 251 overriding_content_length = 0; |
| 248 } | 252 } |
| 249 | 253 |
| 250 } // namespace net | 254 } // namespace net |
| OLD | NEW |