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

Unified Diff: webkit/glue/image_resource_fetcher.cc

Issue 8550010: base::Bind() conversion for webkit. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . 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/glue/image_resource_fetcher.h ('k') | webkit/glue/resource_fetcher.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/image_resource_fetcher.cc
diff --git a/webkit/glue/image_resource_fetcher.cc b/webkit/glue/image_resource_fetcher.cc
index 6a37a3499e6e21635a4f89d2aad2d3b6d655e23b..54d141350ac9eadf2f3eccc9239e04c29d3080cd 100644
--- a/webkit/glue/image_resource_fetcher.cc
+++ b/webkit/glue/image_resource_fetcher.cc
@@ -4,7 +4,8 @@
#include "webkit/glue/image_resource_fetcher.h"
-#include "base/callback.h"
+#include "base/bind.h"
+#include "base/bind_helpers.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
#include "ui/gfx/size.h"
#include "webkit/glue/image_decoder.h"
@@ -22,14 +23,15 @@ ImageResourceFetcher::ImageResourceFetcher(
int id,
int image_size,
WebURLRequest::TargetType target_type,
- Callback* callback)
+ const Callback& callback)
: callback_(callback),
id_(id),
image_url_(image_url),
image_size_(image_size) {
fetcher_.reset(new ResourceFetcher(
image_url, frame, target_type,
- NewCallback(this, &ImageResourceFetcher::OnURLFetchComplete)));
+ base::Bind(&ImageResourceFetcher::OnURLFetchComplete,
+ base::Unretained(this))));
}
ImageResourceFetcher::~ImageResourceFetcher() {
@@ -51,11 +53,10 @@ void ImageResourceFetcher::OnURLFetchComplete(
// response as an image. The delegate will see a null image, indicating
// that an error occurred.
- // Take care to clear callback_ before running the callback as it may lead to
- // our destruction.
- scoped_ptr<Callback> callback;
- callback.swap(callback_);
- callback->Run(this, bitmap);
+ // Take a reference to the callback as running the callback may lead to our
+ // destruction.
+ Callback callback = callback_;
+ callback.Run(this, bitmap);
}
} // namespace webkit_glue
« no previous file with comments | « webkit/glue/image_resource_fetcher.h ('k') | webkit/glue/resource_fetcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698