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

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

Issue 9949011: Make FileStream::Seek async and add FileStream::SeekSync for sync operation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 8 years, 8 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/test_completion_callback.cc ('k') | net/disk_cache/entry_unittest.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_data.h" 5 #include "net/base/upload_data.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 int64 rv = file->OpenSync( 119 int64 rv = file->OpenSync(
120 file_path_, 120 file_path_,
121 base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ); 121 base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ);
122 if (rv != OK) { 122 if (rv != OK) {
123 // If the file can't be opened, we'll just upload an empty file. 123 // If the file can't be opened, we'll just upload an empty file.
124 DLOG(WARNING) << "Failed to open \"" << file_path_.value() 124 DLOG(WARNING) << "Failed to open \"" << file_path_.value()
125 << "\" for reading: " << rv; 125 << "\" for reading: " << rv;
126 return NULL; 126 return NULL;
127 } 127 }
128 if (file_range_offset_) { 128 if (file_range_offset_) {
129 rv = file->Seek(FROM_BEGIN, file_range_offset_); 129 rv = file->SeekSync(FROM_BEGIN, file_range_offset_);
130 if (rv < 0) { 130 if (rv < 0) {
131 DLOG(WARNING) << "Failed to seek \"" << file_path_.value() 131 DLOG(WARNING) << "Failed to seek \"" << file_path_.value()
132 << "\" to offset: " << file_range_offset_ << " (" << rv 132 << "\" to offset: " << file_range_offset_ << " (" << rv
133 << ")"; 133 << ")";
134 return NULL; 134 return NULL;
135 } 135 }
136 } 136 }
137 137
138 return file.release(); 138 return file.release();
139 } 139 }
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 return; 285 return;
286 286
287 for (size_t i = 0; i < elements_.size(); ++i) 287 for (size_t i = 0; i < elements_.size(); ++i)
288 *content_length += elements_[i].GetContentLength(); 288 *content_length += elements_[i].GetContentLength();
289 } 289 }
290 290
291 UploadData::~UploadData() { 291 UploadData::~UploadData() {
292 } 292 }
293 293
294 } // namespace net 294 } // namespace net
OLDNEW
« no previous file with comments | « net/base/test_completion_callback.cc ('k') | net/disk_cache/entry_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698