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

Side by Side Diff: webkit/fileapi/file_writer_delegate.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 | « webkit/fileapi/file_system_url_request_job.cc ('k') | webkit/glue/webfileutilities_impl.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 "webkit/fileapi/file_writer_delegate.h" 5 #include "webkit/fileapi/file_writer_delegate.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/file_util_proxy.h" 9 #include "base/file_util_proxy.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 173
174 void FileWriterDelegate::OnResponseStarted(net::URLRequest* request) { 174 void FileWriterDelegate::OnResponseStarted(net::URLRequest* request) {
175 DCHECK_EQ(request_, request); 175 DCHECK_EQ(request_, request);
176 // file_stream_->Seek() blocks the IO thread. 176 // file_stream_->Seek() blocks the IO thread.
177 // See http://crbug.com/75548. 177 // See http://crbug.com/75548.
178 base::ThreadRestrictions::ScopedAllowIO allow_io; 178 base::ThreadRestrictions::ScopedAllowIO allow_io;
179 if (!request->status().is_success() || request->GetResponseCode() != 200) { 179 if (!request->status().is_success() || request->GetResponseCode() != 200) {
180 OnError(base::PLATFORM_FILE_ERROR_FAILED); 180 OnError(base::PLATFORM_FILE_ERROR_FAILED);
181 return; 181 return;
182 } 182 }
183 int64 error = file_stream_->Seek(net::FROM_BEGIN, offset_); 183 int64 error = file_stream_->SeekSync(net::FROM_BEGIN, offset_);
184 if (error != offset_) { 184 if (error != offset_) {
185 OnError(base::PLATFORM_FILE_ERROR_FAILED); 185 OnError(base::PLATFORM_FILE_ERROR_FAILED);
186 return; 186 return;
187 } 187 }
188 Read(); 188 Read();
189 } 189 }
190 190
191 void FileWriterDelegate::OnReadCompleted(net::URLRequest* request, 191 void FileWriterDelegate::OnReadCompleted(net::URLRequest* request,
192 int bytes_read) { 192 int bytes_read) {
193 DCHECK_EQ(request_, request); 193 DCHECK_EQ(request_, request);
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 319
320 FileSystemQuotaUtil* FileWriterDelegate::quota_util() const { 320 FileSystemQuotaUtil* FileWriterDelegate::quota_util() const {
321 DCHECK(file_system_operation_); 321 DCHECK(file_system_operation_);
322 DCHECK(file_system_operation_->file_system_context()); 322 DCHECK(file_system_operation_->file_system_context());
323 DCHECK(file_system_operation_->file_system_operation_context()); 323 DCHECK(file_system_operation_->file_system_operation_context());
324 return file_system_operation_->file_system_context()->GetQuotaUtil( 324 return file_system_operation_->file_system_context()->GetQuotaUtil(
325 path_.type()); 325 path_.type());
326 } 326 }
327 327
328 } // namespace fileapi 328 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/fileapi/file_system_url_request_job.cc ('k') | webkit/glue/webfileutilities_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698