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

Unified Diff: chrome/browser/media_galleries/fileapi/native_media_file_util.cc

Issue 278113002: Remove PlatformFile from fileapi::AsyncFileUtil (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/media_galleries/fileapi/native_media_file_util.cc
diff --git a/chrome/browser/media_galleries/fileapi/native_media_file_util.cc b/chrome/browser/media_galleries/fileapi/native_media_file_util.cc
index 0e3942b5229312e9afe71e015eba664faab3eb7d..039e28af495d8ce215ff0df26e414f8fc39c4813 100644
--- a/chrome/browser/media_galleries/fileapi/native_media_file_util.cc
+++ b/chrome/browser/media_galleries/fileapi/native_media_file_util.cc
@@ -55,17 +55,11 @@ void DidOpenSnapshot(
const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref,
base::File file) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
- if (file.error_details() != base::File::FILE_OK) {
- base::PlatformFile invalid_file(base::kInvalidPlatformFileValue);
- callback.Run(file.error_details(),
- base::PassPlatformFile(&invalid_file),
- base::Closure());
+ if (!file.IsValid()) {
+ callback.Run(file.Pass(), base::Closure());
return;
}
- base::PlatformFile platform_file = file.TakePlatformFile();
- callback.Run(base::File::FILE_OK,
- base::PassPlatformFile(&platform_file),
- base::Bind(&HoldFileRef, file_ref));
+ callback.Run(file.Pass(), base::Bind(&HoldFileRef, file_ref));
}
} // namespace
@@ -112,10 +106,7 @@ void NativeMediaFileUtil::CreatedSnapshotFileForCreateOrOpen(
const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
if (result != base::File::FILE_OK) {
- base::PlatformFile invalid_file(base::kInvalidPlatformFileValue);
- callback.Run(result,
- base::PassPlatformFile(&invalid_file),
- base::Closure());
+ callback.Run(base::File(), base::Closure());
return;
}
base::PostTaskAndReplyWithResult(
@@ -124,9 +115,7 @@ void NativeMediaFileUtil::CreatedSnapshotFileForCreateOrOpen(
base::Bind(&fileapi::NativeFileUtil::CreateOrOpen,
platform_path,
file_flags),
- base::Bind(&DidOpenSnapshot,
- callback,
- file_ref));
+ base::Bind(&DidOpenSnapshot, callback, file_ref));
}
void NativeMediaFileUtil::CreateOrOpen(
@@ -139,10 +128,7 @@ void NativeMediaFileUtil::CreateOrOpen(
if (file_flags & ~(base::File::FLAG_OPEN |
base::File::FLAG_READ |
base::File::FLAG_WRITE_ATTRIBUTES)) {
- base::PlatformFile invalid_file(base::kInvalidPlatformFileValue);
- callback.Run(base::File::FILE_ERROR_SECURITY,
- base::PassPlatformFile(&invalid_file),
- base::Closure());
+ callback.Run(base::File(base::File::FILE_ERROR_SECURITY), base::Closure());
return;
}
scoped_refptr<base::SequencedTaskRunner> task_runner = context->task_runner();
« no previous file with comments | « chrome/browser/media_galleries/fileapi/native_media_file_util.h ('k') | webkit/browser/fileapi/async_file_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698