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

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: simple_file_writer fix 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
« no previous file with comments | « webkit/fileapi/sandboxed_file_system_operation.cc ('k') | webkit/tools/test_shell/simple_file_writer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 29ea45e323209318487e565344ed9ac70bf17813..94269b97e3b8cd3df4cff87aa318ac55f144440c 100644
--- a/webkit/tools/test_shell/simple_file_system.cc
+++ b/webkit/tools/test_shell/simple_file_system.cc
@@ -54,17 +54,11 @@ class SimpleFileSystemCallbackDispatcher
}
~SimpleFileSystemCallbackDispatcher() {
- DCHECK(!operation_.get());
- }
-
- void set_operation(SandboxedFileSystemOperation* operation) {
- operation_.reset(operation);
}
virtual void DidSucceed() {
- if (file_system_)
- callbacks_->didSucceed();
- RemoveOperation();
+ DCHECK(file_system_);
+ callbacks_->didSucceed();
}
virtual void DidReadMetadata(const base::PlatformFileInfo& info) {
@@ -75,7 +69,6 @@ class SimpleFileSystemCallbackDispatcher
web_file_info.type = info.is_directory ?
WebFileInfo::TypeDirectory : WebFileInfo::TypeFile;
callbacks_->didReadMetadata(web_file_info);
- RemoveOperation();
}
virtual void DidReadDirectory(
@@ -93,7 +86,6 @@ class SimpleFileSystemCallbackDispatcher
WebVector<WebKit::WebFileSystemEntry> web_entries =
web_entries_vector;
callbacks_->didReadDirectory(web_entries, has_more);
- RemoveOperation();
}
virtual void DidOpenFileSystem(
@@ -104,14 +96,12 @@ class SimpleFileSystemCallbackDispatcher
else
callbacks_->didOpenFileSystem(
UTF8ToUTF16(name), webkit_glue::FilePathToWebString(path));
- RemoveOperation();
}
virtual void DidFail(base::PlatformFileError error_code) {
DCHECK(file_system_);
callbacks_->didFail(
webkit_glue::PlatformFileErrorToWebFileError(error_code));
- RemoveOperation();
}
virtual void DidWrite(int64, bool) {
@@ -119,17 +109,8 @@ class SimpleFileSystemCallbackDispatcher
}
private:
- void RemoveOperation() {
- // We need to make sure operation_ is null when we delete the operation
- // (which in turn deletes this dispatcher instance).
- scoped_ptr<SandboxedFileSystemOperation> operation;
- operation.swap(operation_);
- operation.reset();
- }
-
WeakPtr<SimpleFileSystem> file_system_;
WebFileSystemCallbacks* callbacks_;
- scoped_ptr<SandboxedFileSystemOperation> operation_;
};
} // namespace
@@ -262,6 +243,5 @@ SandboxedFileSystemOperation* SimpleFileSystem::GetNewOperation(
SandboxedFileSystemOperation* operation = new SandboxedFileSystemOperation(
dispatcher, base::MessageLoopProxy::CreateForCurrentThread(),
sandboxed_context_.get());
- dispatcher->set_operation(operation);
return operation;
}
« no previous file with comments | « webkit/fileapi/sandboxed_file_system_operation.cc ('k') | webkit/tools/test_shell/simple_file_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698