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

Side by Side Diff: webkit/blob/blob_url_request_job.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/url_request/url_request_file_job.cc ('k') | webkit/fileapi/file_system_url_request_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) 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/blob/blob_url_request_job.h" 5 #include "webkit/blob/blob_url_request_job.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 if (rv != base::PLATFORM_FILE_OK) { 378 if (rv != base::PLATFORM_FILE_OK) {
379 NotifyFailure(net::ERR_FAILED); 379 NotifyFailure(net::ERR_FAILED);
380 return; 380 return;
381 } 381 }
382 382
383 DCHECK(!stream_.get()); 383 DCHECK(!stream_.get());
384 stream_.reset(new net::FileStream(file.ReleaseValue(), kFileOpenFlags, NULL)); 384 stream_.reset(new net::FileStream(file.ReleaseValue(), kFileOpenFlags, NULL));
385 385
386 const BlobData::Item& item = blob_data_->items().at(current_item_index_); 386 const BlobData::Item& item = blob_data_->items().at(current_item_index_);
387 { 387 {
388 // stream_.Seek() blocks the IO thread, see http://crbug.com/75548. 388 // stream_.SeekSync() blocks the IO thread, see http://crbug.com/75548.
389 base::ThreadRestrictions::ScopedAllowIO allow_io; 389 base::ThreadRestrictions::ScopedAllowIO allow_io;
390 int64 offset = current_item_offset_ + static_cast<int64>(item.offset); 390 int64 offset = current_item_offset_ + static_cast<int64>(item.offset);
391 if (offset > 0 && offset != stream_->Seek(net::FROM_BEGIN, offset)) { 391 if (offset > 0 && offset != stream_->SeekSync(net::FROM_BEGIN, offset)) {
392 NotifyFailure(net::ERR_FAILED); 392 NotifyFailure(net::ERR_FAILED);
393 return; 393 return;
394 } 394 }
395 } 395 }
396 396
397 ReadFileStream(bytes_to_read); 397 ReadFileStream(bytes_to_read);
398 } 398 }
399 399
400 bool BlobURLRequestJob::ReadFileStream(int bytes_to_read) { 400 bool BlobURLRequestJob::ReadFileStream(int bytes_to_read) {
401 DCHECK(stream_.get()); 401 DCHECK(stream_.get());
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 response_info_.reset(new net::HttpResponseInfo()); 572 response_info_.reset(new net::HttpResponseInfo());
573 response_info_->headers = headers; 573 response_info_->headers = headers;
574 574
575 set_expected_content_size(remaining_bytes_); 575 set_expected_content_size(remaining_bytes_);
576 headers_set_ = true; 576 headers_set_ = true;
577 577
578 NotifyHeadersComplete(); 578 NotifyHeadersComplete();
579 } 579 }
580 580
581 } // namespace webkit_blob 581 } // namespace webkit_blob
OLDNEW
« no previous file with comments | « net/url_request/url_request_file_job.cc ('k') | webkit/fileapi/file_system_url_request_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698