Index: chrome/browser/safe_browsing/safe_browsing_service.h |
diff --git a/chrome/browser/safe_browsing/safe_browsing_service.h b/chrome/browser/safe_browsing/safe_browsing_service.h |
index 27e15b03e9de51ac031f5fda6557acc9ee0be8dc..83381b87f64fbf6bc35ac53a749639ea32a78988 100644 |
--- a/chrome/browser/safe_browsing/safe_browsing_service.h |
+++ b/chrome/browser/safe_browsing/safe_browsing_service.h |
@@ -121,7 +121,7 @@ class SafeBrowsingService : public base::RefCountedThreadSafe< |
return services_delegate_->GetDownloadService(); |
} |
- net::URLRequestContextGetter* url_request_context(); |
+ scoped_refptr<net::URLRequestContextGetter> url_request_context(); |
estark
2016/12/16 23:39:04
why is this change needed?
meacer
2016/12/17 01:23:21
This is so that we can pass the request context be
meacer
2016/12/19 23:16:45
I think the current implementation is buggy: There
estark
2016/12/22 00:11:44
Acknowledged.
|
const scoped_refptr<SafeBrowsingUIManager>& ui_manager() const; |
@@ -159,6 +159,7 @@ class SafeBrowsingService : public base::RefCountedThreadSafe< |
// Type for subscriptions to SafeBrowsing service state. |
typedef base::CallbackList<void(void)>::Subscription StateSubscription; |
+ typedef base::CallbackList<void(void)>::Subscription ShutdownSubscription; |
// Adds a listener for when SafeBrowsing preferences might have changed. |
// To get the current state, the callback should call enabled_by_prefs(). |
@@ -166,6 +167,12 @@ class SafeBrowsingService : public base::RefCountedThreadSafe< |
std::unique_ptr<StateSubscription> RegisterStateCallback( |
const base::Callback<void(void)>& callback); |
+ // Adds a listener for when SafeBrowsingService starts shutting down. |
+ // The callbacks run on the UI thread, and give the subscribers an opportunity |
+ // to clean up any references they hold to SafeBrowsingService. |
+ std::unique_ptr<ShutdownSubscription> RegisterShutdownCallback( |
+ const base::Callback<void(void)>& callback); |
+ |
// Sends serialized download report to backend. |
virtual void SendSerializedDownloadReport(const std::string& report); |
@@ -283,6 +290,10 @@ class SafeBrowsingService : public base::RefCountedThreadSafe< |
// Should only be accessed on the UI thread. |
base::CallbackList<void(void)> state_callback_list_; |
+ // Callbacks when SafeBrowsing service starts shutting down. |
+ // Should only be accessed on the UI thread. |
+ base::CallbackList<void(void)> shutdown_callback_list_; |
+ |
// The UI manager handles showing interstitials. Accessed on both UI and IO |
// thread. |
scoped_refptr<SafeBrowsingUIManager> ui_manager_; |