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

Unified Diff: chrome/browser/safe_browsing/safe_browsing_service.h

Issue 7313003: Separate memory purger from safe browsing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 9 years, 5 months 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 | « chrome/browser/memory_purger.cc ('k') | chrome/browser/safe_browsing/safe_browsing_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 65b7ea2da13d3e3de58b0f13b0cd66c811f2eca6..0d29f462d864e122e702e2085327486477c61d79 100644
--- a/chrome/browser/safe_browsing/safe_browsing_service.h
+++ b/chrome/browser/safe_browsing/safe_browsing_service.h
@@ -21,6 +21,8 @@
#include "base/task.h"
#include "base/time.h"
#include "chrome/browser/safe_browsing/safe_browsing_util.h"
+#include "content/common/notification_observer.h"
+#include "content/common/notification_registrar.h"
#include "googleurl/src/gurl.h"
class MalwareDetails;
@@ -39,7 +41,8 @@ class URLRequestContextGetter;
// Construction needs to happen on the main thread.
class SafeBrowsingService
- : public base::RefCountedThreadSafe<SafeBrowsingService> {
+ : public base::RefCountedThreadSafe<SafeBrowsingService>,
+ public NotificationObserver {
public:
class Client;
// Users of this service implement this interface to be notified
@@ -236,14 +239,6 @@ class SafeBrowsingService
// Preference handling.
static void RegisterPrefs(PrefService* prefs);
- // Called on the IO thread to try to close the database, freeing the memory
- // associated with it. The database will be automatically reopened as needed.
- //
- // NOTE: Actual database closure is asynchronous, and until it happens, the IO
- // thread is not allowed to access it; may not actually trigger a close if one
- // is already pending or doing so would cause problems.
- void CloseDatabase();
-
// Called on the IO thread to reset the database.
void ResetDatabase();
@@ -311,6 +306,14 @@ class SafeBrowsingService
// db thread can call GetDatabase() directly.
bool MakeDatabaseAvailable();
+ // Called on the IO thread to try to close the database, freeing the memory
+ // associated with it. The database will be automatically reopened as needed.
+ //
+ // NOTE: Actual database closure is asynchronous, and until it happens, the IO
+ // thread is not allowed to access it; may not actually trigger a close if one
+ // is already pending or doing so would cause problems.
+ void CloseDatabase();
+
// Should only be called on db thread as SafeBrowsingDatabase is not
// threadsafe.
SafeBrowsingDatabase* GetDatabase();
@@ -410,6 +413,11 @@ class SafeBrowsingService
// Adds the given entry to the whitelist. Called on the UI thread.
void UpdateWhitelist(const UnsafeResource& resource);
+ // NotificationObserver override
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details) OVERRIDE;
+
// The factory used to instanciate a SafeBrowsingService object.
// Useful for tests, so they can provide their own implementation of
// SafeBrowsingService.
@@ -472,6 +480,8 @@ class SafeBrowsingService
// Similar to |download_urlcheck_timeout_ms_|, but for download hash checks.
int64 download_hashcheck_timeout_ms_;
+ NotificationRegistrar registrar_;
+
DISALLOW_COPY_AND_ASSIGN(SafeBrowsingService);
};
« no previous file with comments | « chrome/browser/memory_purger.cc ('k') | chrome/browser/safe_browsing/safe_browsing_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698