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

Unified Diff: webkit/appcache/view_appcache_internals_job.cc

Issue 8776024: base::Bind: Convert AppCacheService::GetAllAppCacheInfo. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review fix. Created 9 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/appcache/appcache_test_helper.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/appcache/view_appcache_internals_job.cc
diff --git a/webkit/appcache/view_appcache_internals_job.cc b/webkit/appcache/view_appcache_internals_job.cc
index 6d1f8247c8ebaed401bc5a7272251022e141f090..6ddb5db072b557f1c7dfd11ec66d6b9cda0c939d 100644
--- a/webkit/appcache/view_appcache_internals_job.cc
+++ b/webkit/appcache/view_appcache_internals_job.cc
@@ -11,6 +11,7 @@
#include "base/format_macros.h"
#include "base/i18n/time_formatting.h"
#include "base/logging.h"
+#include "base/memory/weak_ptr.h"
#include "base/string_number_conversions.h"
#include "base/string_util.h"
#include "base/stringprintf.h"
@@ -316,16 +317,16 @@ class BaseInternalsJob : public net::URLRequestSimpleJob {
class MainPageJob : public BaseInternalsJob {
public:
MainPageJob(net::URLRequest* request, AppCacheService* service)
- : BaseInternalsJob(request, service) {}
+ : BaseInternalsJob(request, service),
+ ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {
+ }
virtual void Start() {
DCHECK(request_);
info_collection_ = new AppCacheInfoCollection;
- gotinfo_complete_callback_ =
- new net::CancelableOldCompletionCallback<MainPageJob>(
- this, &MainPageJob::OnGotInfoComplete);
appcache_service_->GetAllAppCacheInfo(
- info_collection_, gotinfo_complete_callback_);
+ info_collection_, base::Bind(&MainPageJob::OnGotInfoComplete,
+ weak_factory_.GetWeakPtr()));
}
// Produces a page containing the listing
@@ -360,20 +361,15 @@ class MainPageJob : public BaseInternalsJob {
}
private:
- virtual ~MainPageJob() {
- if (gotinfo_complete_callback_)
- gotinfo_complete_callback_.release()->Cancel();
- }
+ virtual ~MainPageJob() {}
void OnGotInfoComplete(int rv) {
- gotinfo_complete_callback_ = NULL;
if (rv != net::OK)
info_collection_ = NULL;
StartAsync();
}
- scoped_refptr<net::CancelableOldCompletionCallback<MainPageJob> >
- gotinfo_complete_callback_;
+ base::WeakPtrFactory<MainPageJob> weak_factory_;
scoped_refptr<AppCacheInfoCollection> info_collection_;
DISALLOW_COPY_AND_ASSIGN(MainPageJob);
};
« no previous file with comments | « webkit/appcache/appcache_test_helper.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698