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

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

Issue 8843: Add write and read/write support to FileStream (renamed from FileInputStream)... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 1 month 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/upload_data_stream.h ('k') | net/build/net.vcproj » ('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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 61
62 if (bytes_copied == count) { 62 if (bytes_copied == count) {
63 advance_to_next_element = true; 63 advance_to_next_element = true;
64 } else { 64 } else {
65 next_element_offset_ += bytes_copied; 65 next_element_offset_ += bytes_copied;
66 } 66 }
67 } else { 67 } else {
68 DCHECK(element.type() == UploadData::TYPE_FILE); 68 DCHECK(element.type() == UploadData::TYPE_FILE);
69 69
70 if (!next_element_stream_.IsOpen()) { 70 if (!next_element_stream_.IsOpen()) {
71 int rv = next_element_stream_.Open(element.file_path(), false); 71 int flags = base::PLATFORM_FILE_OPEN |
72 base::PLATFORM_FILE_READ;
73 int rv = next_element_stream_.Open(element.file_path(), flags);
72 // If the file does not exist, that's technically okay.. we'll just 74 // If the file does not exist, that's technically okay.. we'll just
73 // upload an empty file. This is for consistency with Mozilla. 75 // upload an empty file. This is for consistency with Mozilla.
74 DLOG_IF(WARNING, rv != OK) << "Failed to open \"" << 76 DLOG_IF(WARNING, rv != OK) << "Failed to open \"" <<
75 element.file_path() << "\" for reading: " << rv; 77 element.file_path() << "\" for reading: " << rv;
76 78
77 next_element_remaining_ = 0; // Default to reading nothing. 79 next_element_remaining_ = 0; // Default to reading nothing.
78 if (rv == OK) { 80 if (rv == OK) {
79 uint64 offset = element.file_range_offset(); 81 uint64 offset = element.file_range_offset();
80 if (offset && next_element_stream_.Seek(FROM_BEGIN, offset) < 0) { 82 if (offset && next_element_stream_.Seek(FROM_BEGIN, offset) < 0) {
81 DLOG(WARNING) << "Failed to seek \"" << element.file_path() << 83 DLOG(WARNING) << "Failed to seek \"" << element.file_path() <<
(...skipping 19 matching lines...) Expand all
101 if (advance_to_next_element) { 103 if (advance_to_next_element) {
102 ++next_element_; 104 ++next_element_;
103 next_element_offset_ = 0; 105 next_element_offset_ = 0;
104 next_element_stream_.Close(); 106 next_element_stream_.Close();
105 } 107 }
106 } 108 }
107 } 109 }
108 110
109 } // namespace net 111 } // namespace net
110 112
OLDNEW
« no previous file with comments | « net/base/upload_data_stream.h ('k') | net/build/net.vcproj » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698