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

Unified Diff: webkit/fileapi/file_system_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_test_helper.cc ('k') | webkit/fileapi/file_system_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_url_request_job.cc
diff --git a/webkit/fileapi/file_system_url_request_job.cc b/webkit/fileapi/file_system_url_request_job.cc
index ad4664cbcf5394c2e98482f4ebee098570f7320a..a617d6a90e2574645d331a94c528847bcf8b6b1b 100644
--- a/webkit/fileapi/file_system_url_request_job.cc
+++ b/webkit/fileapi/file_system_url_request_job.cc
@@ -55,9 +55,12 @@ static net::HttpResponseHeaders* CreateHttpResponseHeaders() {
class FileSystemURLRequestJob::CallbackDispatcher
: public FileSystemCallbackDispatcher {
public:
- explicit CallbackDispatcher(FileSystemURLRequestJob* job)
- : job_(job) {
- DCHECK(job_);
+ // An instance of this class must be created by Create()
+ // (so that we do not leak ownerships).
+ static scoped_ptr<FileSystemCallbackDispatcher> Create(
+ FileSystemURLRequestJob* job) {
+ return scoped_ptr<FileSystemCallbackDispatcher>(
+ new CallbackDispatcher(job));
}
// fileapi::FileSystemCallbackDispatcher overrides.
@@ -93,6 +96,10 @@ class FileSystemURLRequestJob::CallbackDispatcher
}
private:
+ explicit CallbackDispatcher(FileSystemURLRequestJob* job) : job_(job) {
+ DCHECK(job_);
+ }
+
// TODO(adamk): Get rid of the need for refcounting here by
// allowing FileSystemOperations to be cancelled.
scoped_refptr<FileSystemURLRequestJob> job_;
@@ -213,7 +220,7 @@ int FileSystemURLRequestJob::GetResponseCode() const {
void FileSystemURLRequestJob::StartAsync() {
if (request_) {
- (new FileSystemOperation(new CallbackDispatcher(this),
+ (new FileSystemOperation(CallbackDispatcher::Create(this),
file_thread_proxy_,
file_system_context_)
)->GetMetadata(request_->url());
« no previous file with comments | « webkit/fileapi/file_system_test_helper.cc ('k') | webkit/fileapi/file_system_url_request_job_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698