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

Unified Diff: webkit/tools/test_shell/simple_file_system.cc

Issue 4821005: Make FileSystemOperation's lifetime more explicit. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: '' Created 10 years, 1 month 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: webkit/tools/test_shell/simple_file_system.cc
diff --git a/webkit/tools/test_shell/simple_file_system.cc b/webkit/tools/test_shell/simple_file_system.cc
index 520f709caffbd72f61b12ef8885301b0ca24708e..998647b1d52d5844b4180b356f73cdb43e3daf7e 100644
--- a/webkit/tools/test_shell/simple_file_system.cc
+++ b/webkit/tools/test_shell/simple_file_system.cc
@@ -24,22 +24,18 @@ using WebKit::WebVector;
namespace {
-class TestShellFileSystemCallbackDispatcher
+class SimpleFileSystemCallbackDispatcher
: public fileapi::FileSystemCallbackDispatcher {
public:
- TestShellFileSystemCallbackDispatcher(
+ SimpleFileSystemCallbackDispatcher(
SimpleFileSystem* file_system,
WebFileSystemCallbacks* callbacks)
: file_system_(file_system),
- callbacks_(callbacks),
- request_id_(-1) {
+ callbacks_(callbacks) {
}
- void set_request_id(int request_id) { request_id_ = request_id; }
-
virtual void DidSucceed() {
callbacks_->didSucceed();
ericu 2010/11/16 19:26:54 It looks to me like these test operations now neve
kinuko 2010/11/16 20:29:08 They're not registered now. There's no need to tr
- file_system_->RemoveCompletedOperation(request_id_);
}
virtual void DidReadMetadata(const base::PlatformFileInfo& info) {
@@ -49,7 +45,6 @@ class TestShellFileSystemCallbackDispatcher
web_file_info.type = info.is_directory ?
WebFileInfo::TypeDirectory : WebFileInfo::TypeFile;
callbacks_->didReadMetadata(web_file_info);
- file_system_->RemoveCompletedOperation(request_id_);
}
virtual void DidReadDirectory(
@@ -66,7 +61,6 @@ class TestShellFileSystemCallbackDispatcher
WebVector<WebKit::WebFileSystemEntry> web_entries =
web_entries_vector;
callbacks_->didReadDirectory(web_entries, has_more);
- file_system_->RemoveCompletedOperation(request_id_);
}
virtual void DidOpenFileSystem(const std::string&, const FilePath&) {
@@ -76,7 +70,6 @@ class TestShellFileSystemCallbackDispatcher
virtual void DidFail(base::PlatformFileError error_code) {
callbacks_->didFail(
webkit_glue::PlatformFileErrorToWebFileError(error_code));
- file_system_->RemoveCompletedOperation(request_id_);
}
virtual void DidWrite(int64, bool) {
@@ -86,16 +79,11 @@ class TestShellFileSystemCallbackDispatcher
private:
SimpleFileSystem* file_system_;
WebFileSystemCallbacks* callbacks_;
- int request_id_;
};
} // namespace
SimpleFileSystem::~SimpleFileSystem() {
- // Drop all the operations.
- for (OperationsMap::const_iterator iter(&operations_);
- !iter.IsAtEnd(); iter.Advance())
- operations_.Remove(iter.GetCurrentKey());
}
void SimpleFileSystem::move(
@@ -179,16 +167,9 @@ WebFileWriter* SimpleFileSystem::createFileWriter(
fileapi::FileSystemOperation* SimpleFileSystem::GetNewOperation(
WebFileSystemCallbacks* callbacks) {
- // This pointer will be owned by |operation|.
- TestShellFileSystemCallbackDispatcher* dispatcher =
- new TestShellFileSystemCallbackDispatcher(this, callbacks);
+ SimpleFileSystemCallbackDispatcher* dispatcher =
+ new SimpleFileSystemCallbackDispatcher(this, callbacks);
fileapi::FileSystemOperation* operation = new fileapi::FileSystemOperation(
dispatcher, base::MessageLoopProxy::CreateForCurrentThread());
- int32 request_id = operations_.Add(operation);
- dispatcher->set_request_id(request_id);
return operation;
}
-
-void SimpleFileSystem::RemoveCompletedOperation(int request_id) {
- operations_.Remove(request_id);
-}
« webkit/fileapi/file_system_operation.cc ('K') | « webkit/tools/test_shell/simple_file_system.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698