summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--webkit/glue/image_resource_fetcher.cc1
-rw-r--r--webkit/glue/image_resource_fetcher.h2
-rw-r--r--webkit/glue/resource_fetcher.cc8
-rw-r--r--webkit/glue/resource_fetcher.h2
4 files changed, 9 insertions, 4 deletions
diff --git a/webkit/glue/image_resource_fetcher.cc b/webkit/glue/image_resource_fetcher.cc
index 8c63cc5..dc90744 100644
--- a/webkit/glue/image_resource_fetcher.cc
+++ b/webkit/glue/image_resource_fetcher.cc
@@ -45,6 +45,7 @@ void ImageResourceFetcher::OnURLFetchComplete(
// response as an image. The delegate will see a null image, indicating
// that an error occurred.
callback_->Run(this, bitmap);
+ callback_.reset();
}
} // namespace webkit_glue
diff --git a/webkit/glue/image_resource_fetcher.h b/webkit/glue/image_resource_fetcher.h
index 1503481..af542dd 100644
--- a/webkit/glue/image_resource_fetcher.h
+++ b/webkit/glue/image_resource_fetcher.h
@@ -39,7 +39,7 @@ class ImageResourceFetcher {
void OnURLFetchComplete(const WebKit::WebURLResponse& response,
const std::string& data);
- Callback* callback_;
+ scoped_ptr<Callback> callback_;
// Unique identifier for the request.
const int id_;
diff --git a/webkit/glue/resource_fetcher.cc b/webkit/glue/resource_fetcher.cc
index 1716a91..e7e6978 100644
--- a/webkit/glue/resource_fetcher.cc
+++ b/webkit/glue/resource_fetcher.cc
@@ -84,8 +84,10 @@ void ResourceFetcher::didFinishLoading(WebURLLoader* loader) {
DCHECK(!completed_);
completed_ = true;
- if (callback_)
+ if (callback_.get()) {
callback_->Run(response_, data_);
+ callback_.reset();
+ }
}
void ResourceFetcher::didFail(WebURLLoader* loader, const WebURLError& error) {
@@ -93,8 +95,10 @@ void ResourceFetcher::didFail(WebURLLoader* loader, const WebURLError& error) {
completed_ = true;
// Go ahead and tell our delegate that we're done.
- if (callback_)
+ if (callback_.get()) {
callback_->Run(WebURLResponse(), std::string());
+ callback_.reset();
+ }
}
/////////////////////////////////////////////////////////////////////////////
diff --git a/webkit/glue/resource_fetcher.h b/webkit/glue/resource_fetcher.h
index bc75f63..338e0e1 100644
--- a/webkit/glue/resource_fetcher.h
+++ b/webkit/glue/resource_fetcher.h
@@ -72,7 +72,7 @@ class ResourceFetcher : public WebKit::WebURLLoaderClient {
GURL url_;
// Callback when we're done
- Callback* callback_;
+ scoped_ptr<Callback> callback_;
// A copy of the original resource response
WebKit::WebURLResponse response_;