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

Unified Diff: webkit/fileapi/file_system_context.cc

Issue 9372044: Refactor FileSystemOperation to take callback for each method. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reflected kinuko's comments + Fixture for failing-Write -> Cancel pattern. Created 8 years, 10 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
« no previous file with comments | « webkit/fileapi/file_system_context.h ('k') | webkit/fileapi/file_system_dir_url_request_job.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/fileapi/file_system_context.cc
diff --git a/webkit/fileapi/file_system_context.cc b/webkit/fileapi/file_system_context.cc
index 2a806c03419d9eb569cce2dc0aa9623b318b6d2c..2bee4f307fa36286b92dacfbbd1c2012c04ebcad 100644
--- a/webkit/fileapi/file_system_context.cc
+++ b/webkit/fileapi/file_system_context.cc
@@ -8,7 +8,6 @@
#include "base/file_util.h"
#include "base/message_loop_proxy.h"
#include "googleurl/src/gurl.h"
-#include "webkit/fileapi/file_system_callback_dispatcher.h"
#include "webkit/fileapi/file_system_file_util.h"
#include "webkit/fileapi/file_system_operation_interface.h"
#include "webkit/fileapi/file_system_options.h"
@@ -35,15 +34,11 @@ QuotaClient* CreateQuotaClient(
return new FileSystemQuotaClient(file_message_loop, context, is_incognito);
}
-void DidOpenFileSystem(scoped_ptr<FileSystemCallbackDispatcher> dispatcher,
+void DidOpenFileSystem(FileSystemContext::OpenFileSystemCallback callback,
const GURL& filesystem_root,
const std::string& filesystem_name,
base::PlatformFileError error) {
- if (error == base::PLATFORM_FILE_OK) {
- dispatcher->DidOpenFileSystem(filesystem_name, filesystem_root);
- } else {
- dispatcher->DidFail(error);
- }
+ callback.Run(error, filesystem_name, filesystem_root);
}
} // anonymous namespace
@@ -157,13 +152,13 @@ void FileSystemContext::OpenFileSystem(
const GURL& origin_url,
FileSystemType type,
bool create,
- scoped_ptr<FileSystemCallbackDispatcher> dispatcher) {
- DCHECK(dispatcher.get());
+ OpenFileSystemCallback callback) {
+ DCHECK(!callback.is_null());
FileSystemMountPointProvider* mount_point_provider =
GetMountPointProvider(type);
if (!mount_point_provider) {
- dispatcher->DidFail(base::PLATFORM_FILE_ERROR_SECURITY);
+ callback.Run(base::PLATFORM_FILE_ERROR_SECURITY, std::string(), GURL());
return;
}
@@ -172,13 +167,11 @@ void FileSystemContext::OpenFileSystem(
mount_point_provider->ValidateFileSystemRoot(
origin_url, type, create,
- base::Bind(&DidOpenFileSystem,
- base::Passed(&dispatcher), root_url, name));
+ base::Bind(&DidOpenFileSystem, callback, root_url, name));
}
FileSystemOperationInterface* FileSystemContext::CreateFileSystemOperation(
const GURL& url,
- scoped_ptr<FileSystemCallbackDispatcher> dispatcher,
base::MessageLoopProxy* file_proxy) {
GURL origin_url;
FileSystemType file_system_type = kFileSystemTypeUnknown;
@@ -190,8 +183,7 @@ FileSystemOperationInterface* FileSystemContext::CreateFileSystemOperation(
if (!mount_point_provider)
return NULL;
return mount_point_provider->CreateFileSystemOperation(
- origin_url, file_system_type, file_path,
- dispatcher.Pass(), file_proxy, this);
+ origin_url, file_system_type, file_path, file_proxy, this);
}
} // namespace fileapi
« no previous file with comments | « webkit/fileapi/file_system_context.h ('k') | webkit/fileapi/file_system_dir_url_request_job.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698