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

Unified Diff: webkit/fileapi/file_system_dir_url_request_job.cc

Issue 9016020: Cleanup FileSystemOperation for preparing for adding FSO-factory method (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 8 years, 11 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.cc ('k') | webkit/fileapi/file_system_dir_url_request_job_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/fileapi/file_system_dir_url_request_job.cc
diff --git a/webkit/fileapi/file_system_dir_url_request_job.cc b/webkit/fileapi/file_system_dir_url_request_job.cc
index 9fbe27a41573ea99070c3f2e4423c1bf61a57da9..83a5455cd4ad0ae07b7e57b06a419f976cbc8a71 100644
--- a/webkit/fileapi/file_system_dir_url_request_job.cc
+++ b/webkit/fileapi/file_system_dir_url_request_job.cc
@@ -41,9 +41,12 @@ static FilePath GetRelativePath(const GURL& url) {
class FileSystemDirURLRequestJob::CallbackDispatcher
: public FileSystemCallbackDispatcher {
public:
- explicit CallbackDispatcher(FileSystemDirURLRequestJob* job)
- : job_(job) {
- DCHECK(job_);
+ // An instance of this class must be created by Create()
+ // (so that we do not leak ownership).
+ static scoped_ptr<FileSystemCallbackDispatcher> Create(
+ FileSystemDirURLRequestJob* job) {
+ return scoped_ptr<FileSystemCallbackDispatcher>(
+ new CallbackDispatcher(job));
}
// fileapi::FileSystemCallbackDispatcher overrides.
@@ -79,6 +82,10 @@ class FileSystemDirURLRequestJob::CallbackDispatcher
}
private:
+ explicit CallbackDispatcher(FileSystemDirURLRequestJob* job) : job_(job) {
+ DCHECK(job_);
+ }
+
// TODO(adamk): Get rid of the need for refcounting here by
// allowing FileSystemOperations to be cancelled.
scoped_refptr<FileSystemDirURLRequestJob> job_;
@@ -175,7 +182,7 @@ void FileSystemDirURLRequestJob::DidReadDirectory(
}
FileSystemOperation* FileSystemDirURLRequestJob::GetNewOperation() {
- return new FileSystemOperation(new CallbackDispatcher(this),
+ return new FileSystemOperation(CallbackDispatcher::Create(this),
file_thread_proxy_,
file_system_context_);
}
« no previous file with comments | « webkit/fileapi/file_system_context.cc ('k') | webkit/fileapi/file_system_dir_url_request_job_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698