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

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

Issue 189393002: net: Update FileStream to use base::File instead of PlatformFile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use OPEN_ALWAYS on the async unit test Created 6 years, 9 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
« no previous file with comments | « net/base/file_stream_unittest.cc ('k') | net/url_request/url_fetcher_response_writer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 return this; 46 return this;
47 } 47 }
48 48
49 int UploadFileElementReader::Init(const CompletionCallback& callback) { 49 int UploadFileElementReader::Init(const CompletionCallback& callback) {
50 DCHECK(!callback.is_null()); 50 DCHECK(!callback.is_null());
51 Reset(); 51 Reset();
52 52
53 file_stream_.reset(new FileStream(NULL, task_runner_.get())); 53 file_stream_.reset(new FileStream(NULL, task_runner_.get()));
54 int result = file_stream_->Open( 54 int result = file_stream_->Open(
55 path_, 55 path_,
56 base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ | 56 base::File::FLAG_OPEN | base::File::FLAG_READ |
57 base::PLATFORM_FILE_ASYNC, 57 base::File::FLAG_ASYNC,
58 base::Bind(&UploadFileElementReader::OnOpenCompleted, 58 base::Bind(&UploadFileElementReader::OnOpenCompleted,
59 weak_ptr_factory_.GetWeakPtr(), 59 weak_ptr_factory_.GetWeakPtr(),
60 callback)); 60 callback));
61 DCHECK_GT(0, result); 61 DCHECK_GT(0, result);
62 return result; 62 return result;
63 } 63 }
64 64
65 uint64 UploadFileElementReader::GetContentLength() const { 65 uint64 UploadFileElementReader::GetContentLength() const {
66 if (overriding_content_length) 66 if (overriding_content_length)
67 return overriding_content_length; 67 return overriding_content_length;
(...skipping 137 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
« no previous file with comments | « net/base/file_stream_unittest.cc ('k') | net/url_request/url_fetcher_response_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698