Index: components/safe_browsing_db/v4_local_database_manager.h |
diff --git a/components/safe_browsing_db/v4_local_database_manager.h b/components/safe_browsing_db/v4_local_database_manager.h |
index ac8900c8822da87700609303c6cbb442978a57ff..4a19b511befa27ca310a2b3f5d9bf6587ff94392 100644 |
--- a/components/safe_browsing_db/v4_local_database_manager.h |
+++ b/components/safe_browsing_db/v4_local_database_manager.h |
@@ -27,7 +27,7 @@ class V4LocalDatabaseManager : public SafeBrowsingDatabaseManager { |
public: |
// Construct V4LocalDatabaseManager. |
// Must be initialized by calling StartOnIOThread() before using. |
- V4LocalDatabaseManager(); |
+ V4LocalDatabaseManager(const base::FilePath& base_path); |
// |
// SafeBrowsingDatabaseManager implementation |
@@ -41,9 +41,8 @@ class V4LocalDatabaseManager : public SafeBrowsingDatabaseManager { |
bool IsDownloadProtectionEnabled() const override; |
bool CheckBrowseUrl(const GURL& url, Client* client) override; |
void CancelCheck(Client* client) override; |
- void StartOnIOThread( |
- net::URLRequestContextGetter* request_context_getter, |
- const V4ProtocolConfig& config) override; |
+ void StartOnIOThread(net::URLRequestContextGetter* request_context_getter, |
+ const V4ProtocolConfig& config) override; |
void StopOnIOThread(bool shutdown) override; |
bool CheckDownloadUrl(const std::vector<GURL>& url_chain, |
Client* client) override; |
@@ -66,8 +65,26 @@ class V4LocalDatabaseManager : public SafeBrowsingDatabaseManager { |
// successfully. |
void UpdateRequestCompleted(const std::vector<ListUpdateResponse>& responses); |
+ void SetupUpdateProtocolManager( |
+ net::URLRequestContextGetter* request_context_getter, |
+ const V4ProtocolConfig& config); |
+ |
+ bool DatabaseAvailable() const; |
+ |
+ void SetupDatabase(); |
+ |
+ void OnCloseDatabase(); |
+ |
+ // The base directory under which to create the files that contain hashes. |
+ const base::FilePath& base_path_; |
+ |
+ // Whether the service is running. |
bool enabled_; |
+ // Indicates if we're in the midst of trying to close the database. If this |
+ // is true, nothing on the IO thread should access the database. |
+ bool closing_database_; |
+ |
// Stores the current status of the lists to download from the SafeBrowsing |
// servers. |
// TODO(vakh): current_list_states_ doesn't really belong here. |
@@ -80,6 +97,12 @@ class V4LocalDatabaseManager : public SafeBrowsingDatabaseManager { |
// The database that manages the stores containing the hash prefix updates. |
std::unique_ptr<V4Database> v4_database_; |
+ // Lock used to prevent possible data races due to compiler optimizations. |
+ mutable base::Lock database_lock_; |
+ |
+ // The sequenced task runner for running safe browsing database operations. |
+ scoped_refptr<base::SequencedTaskRunner> task_runner_; |
+ |
friend class base::RefCountedThreadSafe<V4LocalDatabaseManager>; |
DISALLOW_COPY_AND_ASSIGN(V4LocalDatabaseManager); |
}; // class V4LocalDatabaseManager |