Commit cb1da540 authored by darin@chromium.org's avatar darin@chromium.org

Don't forget to free the callbacks!

BUG=none
TEST=none
TBR=brettw

Review URL: http://codereview.chromium.org/149295

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20100 0039d316-1c4b-4281-b951-d872f2087c98
parent 0eef4afc
......@@ -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
......@@ -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_;
......
......@@ -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();
}
}
/////////////////////////////////////////////////////////////////////////////
......
......@@ -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_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment