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

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: rebased (upon codereview/4879001) 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 8bf5721cc7f625e6e5ebf6151fe1c5b9d1d525ea..1c1a5c0f47149cf2c823da62d36e4f1f75b3081e 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();
}
virtual void DidReadMetadata(const base::PlatformFileInfo& info) {
@@ -76,7 +70,6 @@ class SimpleFileSystemCallbackDispatcher
WebFileInfo::TypeDirectory : WebFileInfo::TypeFile;
callbacks_->didReadMetadata(web_file_info);
}
- RemoveOperation();
}
virtual void DidReadDirectory(
@@ -95,7 +88,6 @@ class SimpleFileSystemCallbackDispatcher
web_entries_vector;
callbacks_->didReadDirectory(web_entries, has_more);
}
- RemoveOperation();
}
virtual void DidOpenFileSystem(
@@ -107,14 +99,12 @@ class SimpleFileSystemCallbackDispatcher
callbacks_->didOpenFileSystem(
UTF8ToUTF16(name), webkit_glue::FilePathToWebString(path));
}
- RemoveOperation();
}
virtual void DidFail(base::PlatformFileError error_code) {
if (file_system_)
callbacks_->didFail(
webkit_glue::PlatformFileErrorToWebFileError(error_code));
- RemoveOperation();
}
virtual void DidWrite(int64, bool) {
@@ -122,17 +112,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
@@ -265,6 +246,5 @@ SandboxedFileSystemOperation* SimpleFileSystem::GetNewOperation(
SandboxedFileSystemOperation* operation = new SandboxedFileSystemOperation(
dispatcher, base::MessageLoopProxy::CreateForCurrentThread(),
sandboxed_context_.get());
- dispatcher->set_operation(operation);
return operation;
}

Powered by Google App Engine
This is Rietveld 408576698