Revert 61899 for breaking cookes on file:// URLs.
BUG=58553
=================================================
Fix instances of passing raw pointers to RefCounted objects in tasks.
Some of these manually handled it correctly by using AddRef()/Release() pairs. I switched them to make_scoped_refptr() to be more consistent. This also makes them cleanup properly on MessageLoop shutdown if we start deleting tasks.
BUG=28083
TEST=builds
Review URL: http://codereview.chromium.org/3581008
[email protected]
Review URL: http://codereview.chromium.org/3654001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62043 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/safe_browsing/safe_browsing_service.cc b/chrome/browser/safe_browsing/safe_browsing_service.cc
index e1fbab8..da38f18 100644
--- a/chrome/browser/safe_browsing/safe_browsing_service.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_service.cc
@@ -386,6 +386,9 @@
mackey_url_prefix,
disable_auto_update);
+ // Balance the reference added by Start().
+ request_context_getter->Release();
+
protocol_manager_->Initialize();
}
@@ -645,16 +648,14 @@
}
// We will issue network fetches using the default profile's request context.
- scoped_refptr<URLRequestContextGetter> request_context_getter =
+ URLRequestContextGetter* request_context_getter =
GetDefaultProfile()->GetRequestContext();
+ request_context_getter->AddRef(); // Balanced in OnIOInitialize.
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
NewRunnableMethod(
- this,
- &SafeBrowsingService::OnIOInitialize,
- client_key,
- wrapped_key,
+ this, &SafeBrowsingService::OnIOInitialize, client_key, wrapped_key,
request_context_getter));
}