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

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

Issue 18764: Change FileStream to use FilePath instead of wstring. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 11 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_win.cc ('k') | net/url_request/url_request_file_job.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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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_stream.h" 5 #include "net/base/upload_data_stream.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "net/base/net_errors.h" 8 #include "net/base/net_errors.h"
9 9
10 namespace net { 10 namespace net {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 advance_to_next_element = true; 58 advance_to_next_element = true;
59 } else { 59 } else {
60 next_element_offset_ += bytes_copied; 60 next_element_offset_ += bytes_copied;
61 } 61 }
62 } else { 62 } else {
63 DCHECK(element.type() == UploadData::TYPE_FILE); 63 DCHECK(element.type() == UploadData::TYPE_FILE);
64 64
65 if (!next_element_stream_.IsOpen()) { 65 if (!next_element_stream_.IsOpen()) {
66 int flags = base::PLATFORM_FILE_OPEN | 66 int flags = base::PLATFORM_FILE_OPEN |
67 base::PLATFORM_FILE_READ; 67 base::PLATFORM_FILE_READ;
68 int rv = next_element_stream_.Open(element.file_path(), flags); 68 int rv = next_element_stream_.Open(
69 FilePath::FromWStringHack(element.file_path()), flags);
69 // If the file does not exist, that's technically okay.. we'll just 70 // If the file does not exist, that's technically okay.. we'll just
70 // upload an empty file. This is for consistency with Mozilla. 71 // upload an empty file. This is for consistency with Mozilla.
71 DLOG_IF(WARNING, rv != OK) << "Failed to open \"" << 72 DLOG_IF(WARNING, rv != OK) << "Failed to open \"" <<
72 element.file_path() << "\" for reading: " << rv; 73 element.file_path() << "\" for reading: " << rv;
73 74
74 next_element_remaining_ = 0; // Default to reading nothing. 75 next_element_remaining_ = 0; // Default to reading nothing.
75 if (rv == OK) { 76 if (rv == OK) {
76 uint64 offset = element.file_range_offset(); 77 uint64 offset = element.file_range_offset();
77 if (offset && next_element_stream_.Seek(FROM_BEGIN, offset) < 0) { 78 if (offset && next_element_stream_.Seek(FROM_BEGIN, offset) < 0) {
78 DLOG(WARNING) << "Failed to seek \"" << element.file_path() << 79 DLOG(WARNING) << "Failed to seek \"" << element.file_path() <<
(...skipping 19 matching lines...) Expand all
98 if (advance_to_next_element) { 99 if (advance_to_next_element) {
99 ++next_element_; 100 ++next_element_;
100 next_element_offset_ = 0; 101 next_element_offset_ = 0;
101 next_element_stream_.Close(); 102 next_element_stream_.Close();
102 } 103 }
103 } 104 }
104 } 105 }
105 106
106 } // namespace net 107 } // namespace net
107 108
OLDNEW
« no previous file with comments | « net/base/file_stream_win.cc ('k') | net/url_request/url_request_file_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698