Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(380)

Side by Side Diff: net/base/upload_file_element_reader.cc

Issue 323683002: net: FileStream cleanup (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add DCHECK, fix ASSERT message Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 107
108 if (result < 0) { 108 if (result < 0) {
109 DLOG(WARNING) << "Failed to open \"" << path_.value() 109 DLOG(WARNING) << "Failed to open \"" << path_.value()
110 << "\" for reading: " << result; 110 << "\" for reading: " << result;
111 callback.Run(result); 111 callback.Run(result);
112 return; 112 return;
113 } 113 }
114 114
115 if (range_offset_) { 115 if (range_offset_) {
116 int result = file_stream_->Seek( 116 int result = file_stream_->Seek(
117 FROM_BEGIN, range_offset_, 117 base::File::FROM_BEGIN, range_offset_,
118 base::Bind(&UploadFileElementReader::OnSeekCompleted, 118 base::Bind(&UploadFileElementReader::OnSeekCompleted,
119 weak_ptr_factory_.GetWeakPtr(), 119 weak_ptr_factory_.GetWeakPtr(),
120 callback)); 120 callback));
121 DCHECK_GT(0, result); 121 DCHECK_GT(0, result);
122 if (result != ERR_IO_PENDING) 122 if (result != ERR_IO_PENDING)
123 callback.Run(result); 123 callback.Run(result);
124 } else { 124 } else {
125 OnSeekCompleted(callback, OK); 125 OnSeekCompleted(callback, OK);
126 } 126 }
127 } 127 }
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 ScopedOverridingContentLengthForTests(uint64 value) { 205 ScopedOverridingContentLengthForTests(uint64 value) {
206 overriding_content_length = value; 206 overriding_content_length = value;
207 } 207 }
208 208
209 UploadFileElementReader::ScopedOverridingContentLengthForTests:: 209 UploadFileElementReader::ScopedOverridingContentLengthForTests::
210 ~ScopedOverridingContentLengthForTests() { 210 ~ScopedOverridingContentLengthForTests() {
211 overriding_content_length = 0; 211 overriding_content_length = 0;
212 } 212 }
213 213
214 } // namespace net 214 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698