From ed65fece343181e91b4d36e161434cc763475de7 Mon Sep 17 00:00:00 2001 From: "dumi@chromium.org" Date: Tue, 31 Aug 2010 19:30:27 +0000 Subject: Add an optional parameter to CreatePlatformFile() to report the type of error that occured while trying to open/create a file. TEST=none BUG=none Review URL: http://codereview.chromium.org/3223007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58045 0039d316-1c4b-4281-b951-d872f2087c98 --- webkit/blob/blob_url_request_job.cc | 15 ++++++++++----- webkit/blob/blob_url_request_job.h | 4 +++- 2 files changed, 13 insertions(+), 6 deletions(-) (limited to 'webkit/blob') diff --git a/webkit/blob/blob_url_request_job.cc b/webkit/blob/blob_url_request_job.cc index ef2fcc6..5103458 100644 --- a/webkit/blob/blob_url_request_job.cc +++ b/webkit/blob/blob_url_request_job.cc @@ -106,19 +106,24 @@ void BlobURLRequestJob::ResolveFile(const FilePath& file_path) { // Continue asynchronously. MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod( - this, &BlobURLRequestJob::DidResolve, exists, file_info)); + this, &BlobURLRequestJob::DidResolve, + (exists ? base::PLATFORM_FILE_OK : base::PLATFORM_FILE_ERROR_NOT_FOUND), + file_info)); } -void BlobURLRequestJob::DidResolve( - bool exists, const file_util::FileInfo& file_info) { +void BlobURLRequestJob::DidResolve(base::PlatformFileError rv, + const file_util::FileInfo& file_info) { // We may have been orphaned... if (!request_) return; - // If the file does not exist, bail out. - if (!exists) { + // If an error occured, bail out. + if (rv == base::PLATFORM_FILE_ERROR_NOT_FOUND) { NotifyFailure(net::ERR_FILE_NOT_FOUND); return; + } else if (rv != base::PLATFORM_FILE_OK) { + NotifyFailure(net::ERR_FAILED); + return; } // Validate the expected modification time. diff --git a/webkit/blob/blob_url_request_job.h b/webkit/blob/blob_url_request_job.h index 9d24839..5445774 100644 --- a/webkit/blob/blob_url_request_job.h +++ b/webkit/blob/blob_url_request_job.h @@ -5,6 +5,7 @@ #ifndef WEBKIT_BLOB_BLOB_URL_REQUEST_JOB_H_ #define WEBKIT_BLOB_BLOB_URL_REQUEST_JOB_H_ +#include "base/platform_file.h" #include "base/ref_counted.h" #include "base/scoped_callback_factory.h" #include "base/scoped_ptr.h" @@ -56,7 +57,8 @@ class BlobURLRequestJob : public URLRequestJob { void NotifySuccess(); void NotifyFailure(int); - void DidResolve(bool exists, const file_util::FileInfo& file_info); + void DidResolve(base::PlatformFileError rv, + const file_util::FileInfo& file_info); void DidRead(int result); base::ScopedCallbackFactory callback_factory_; -- cgit v1.1