summaryrefslogtreecommitdiffstats
path: root/webkit/appcache
diff options
context:
space:
mode:
authorwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-07 05:15:44 +0000
committerwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-07 05:15:44 +0000
commitdf16ed24d3cdb487fa37b7b8cb5d6c74926a95dd (patch)
tree8ee7f6e768e9b4a4ae1aaf2233c03ea6d96c38a7 /webkit/appcache
parentad25e60d2adfd1eab3d6a56cba82ec864d6db1fc (diff)
downloadchromium_src-df16ed24d3cdb487fa37b7b8cb5d6c74926a95dd.zip
chromium_src-df16ed24d3cdb487fa37b7b8cb5d6c74926a95dd.tar.gz
chromium_src-df16ed24d3cdb487fa37b7b8cb5d6c74926a95dd.tar.bz2
Fix webkit URLRequestJob subtypes to handle Kill() correctly.
Kill() should prevent calling back into the delegate. So we cancel pending callbacks. BUG=63692 TEST=existing Review URL: http://codereview.chromium.org/5545003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@68445 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/appcache')
-rw-r--r--webkit/appcache/appcache_request_handler.h1
-rw-r--r--webkit/appcache/appcache_url_request_job.cc12
-rw-r--r--webkit/appcache/appcache_url_request_job.h6
3 files changed, 11 insertions, 8 deletions
diff --git a/webkit/appcache/appcache_request_handler.h b/webkit/appcache/appcache_request_handler.h
index e07a77c..b1cb331 100644
--- a/webkit/appcache/appcache_request_handler.h
+++ b/webkit/appcache/appcache_request_handler.h
@@ -124,4 +124,3 @@ class AppCacheRequestHandler : public net::URLRequest::UserData,
} // namespace appcache
#endif // WEBKIT_APPCACHE_APPCACHE_REQUEST_HANDLER_H_
-
diff --git a/webkit/appcache/appcache_url_request_job.cc b/webkit/appcache/appcache_url_request_job.cc
index c70cd7a..6a61674 100644
--- a/webkit/appcache/appcache_url_request_job.cc
+++ b/webkit/appcache/appcache_url_request_job.cc
@@ -6,6 +6,7 @@
#include "webkit/appcache/appcache_url_request_job.h"
+#include "base/compiler_specific.h"
#include "base/message_loop.h"
#include "base/string_util.h"
#include "base/stringprintf.h"
@@ -27,7 +28,8 @@ AppCacheURLRequestJob::AppCacheURLRequestJob(
cache_id_(kNoCacheId), is_fallback_(false),
cache_entry_not_found_(false),
ALLOW_THIS_IN_INITIALIZER_LIST(read_callback_(
- this, &AppCacheURLRequestJob::OnReadComplete)) {
+ this, &AppCacheURLRequestJob::OnReadComplete)),
+ ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) {
DCHECK(storage_);
}
@@ -67,8 +69,10 @@ void AppCacheURLRequestJob::MaybeBeginDelivery() {
if (has_been_started() && has_delivery_orders()) {
// Start asynchronously so that all error reporting and data
// callbacks happen as they would for network requests.
- MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod(
- this, &AppCacheURLRequestJob::BeginDelivery));
+ MessageLoop::current()->PostTask(
+ FROM_HERE,
+ method_factory_.NewRunnableMethod(
+ &AppCacheURLRequestJob::BeginDelivery));
}
}
@@ -210,6 +214,7 @@ void AppCacheURLRequestJob::Kill() {
storage_ = NULL;
}
URLRequestJob::Kill();
+ method_factory_.RevokeAll();
}
}
@@ -278,4 +283,3 @@ void AppCacheURLRequestJob::SetExtraRequestHeaders(
}
} // namespace appcache
-
diff --git a/webkit/appcache/appcache_url_request_job.h b/webkit/appcache/appcache_url_request_job.h
index 8630815..7491e71 100644
--- a/webkit/appcache/appcache_url_request_job.h
+++ b/webkit/appcache/appcache_url_request_job.h
@@ -7,6 +7,7 @@
#include <string>
+#include "base/task.h"
#include "net/http/http_byte_range.h"
#include "net/url_request/url_request_job.h"
#include "webkit/appcache/appcache_entry.h"
@@ -20,8 +21,7 @@ namespace appcache {
class AppCacheURLRequestJob : public net::URLRequestJob,
public AppCacheStorage::Delegate {
public:
- explicit AppCacheURLRequestJob(net::URLRequest* request,
- AppCacheStorage* storage);
+ AppCacheURLRequestJob(net::URLRequest* request, AppCacheStorage* storage);
virtual ~AppCacheURLRequestJob();
// Informs the job of what response it should deliver. Only one of these
@@ -143,9 +143,9 @@ class AppCacheURLRequestJob : public net::URLRequestJob,
scoped_ptr<net::HttpResponseInfo> range_response_info_;
scoped_ptr<AppCacheResponseReader> reader_;
net::CompletionCallbackImpl<AppCacheURLRequestJob> read_callback_;
+ ScopedRunnableMethodFactory<AppCacheURLRequestJob> method_factory_;
};
} // namespace appcache
#endif // WEBKIT_APPCACHE_APPCACHE_REQUEST_HANDLER_H_
-