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

Side by Side Diff: components/safe_browsing_db/v4_local_database_manager.h

Issue 2062013002: Fetch incremental updates. Store new state in V4Store. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: git fetch && git pull && gclient sync Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_SAFE_BROWSING_DB_V4_LOCAL_DATABASE_MANAGER_H_ 5 #ifndef COMPONENTS_SAFE_BROWSING_DB_V4_LOCAL_DATABASE_MANAGER_H_
6 #define COMPONENTS_SAFE_BROWSING_DB_V4_LOCAL_DATABASE_MANAGER_H_ 6 #define COMPONENTS_SAFE_BROWSING_DB_V4_LOCAL_DATABASE_MANAGER_H_
7 7
8 // A class that provides the interface between the SafeBrowsing protocol manager 8 // A class that provides the interface between the SafeBrowsing protocol manager
9 // and database that holds the downloaded updates. 9 // and database that holds the downloaded updates.
10 10
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 void UpdateRequestCompleted(const std::vector<ListUpdateResponse>& responses); 65 void UpdateRequestCompleted(const std::vector<ListUpdateResponse>& responses);
66 66
67 void SetupUpdateProtocolManager( 67 void SetupUpdateProtocolManager(
68 net::URLRequestContextGetter* request_context_getter, 68 net::URLRequestContextGetter* request_context_getter,
69 const V4ProtocolConfig& config); 69 const V4ProtocolConfig& config);
70 70
71 void SetupDatabase(); 71 void SetupDatabase();
72 72
73 void DatabaseReady(std::unique_ptr<V4Database> v4_database); 73 void DatabaseReady(std::unique_ptr<V4Database> v4_database);
74 74
75 void OnCloseDatabase(); 75 // Called when the database has been updated and schedules the next update.
76 void DatabaseUpdated();
76 77
77 // The base directory under which to create the files that contain hashes. 78 // The base directory under which to create the files that contain hashes.
78 const base::FilePath base_path_; 79 const base::FilePath base_path_;
79 80
80 // Whether the service is running. 81 // Whether the service is running.
81 bool enabled_; 82 bool enabled_;
82 83
83 // Stores the current status of the lists to download from the SafeBrowsing 84 // Stores the current status of the lists to download from the SafeBrowsing
84 // servers. 85 // servers.
85 // TODO(vakh): current_list_states_ doesn't really belong here. 86 // TODO(vakh): current_list_states_ doesn't really belong here.
86 // It should come through the database, from the various V4Stores. 87 // It should come through the database, from the various V4Stores.
87 base::hash_map<UpdateListIdentifier, std::string> current_list_states_; 88 base::hash_map<UpdateListIdentifier, std::string> current_list_states_;
88 89
89 // The protocol manager that downloads the hash prefix updates. 90 // The protocol manager that downloads the hash prefix updates.
90 std::unique_ptr<V4UpdateProtocolManager> v4_update_protocol_manager_; 91 std::unique_ptr<V4UpdateProtocolManager> v4_update_protocol_manager_;
91 92
92 // The database that manages the stores containing the hash prefix updates. 93 // The database that manages the stores containing the hash prefix updates.
93 // All writes to this variable must happen on the IO thread only. 94 // All writes to this variable must happen on the IO thread only.
94 std::unique_ptr<V4Database> v4_database_; 95 std::unique_ptr<V4Database> v4_database_;
95 96
97 // Called when the V4Database has finished applying the latest update and is
98 // ready to process next update.
99 DatabaseUpdatedCallback db_updated_callback_;
100
96 // The sequenced task runner for running safe browsing database operations. 101 // The sequenced task runner for running safe browsing database operations.
97 scoped_refptr<base::SequencedTaskRunner> task_runner_; 102 scoped_refptr<base::SequencedTaskRunner> task_runner_;
98 103
99 friend class base::RefCountedThreadSafe<V4LocalDatabaseManager>; 104 friend class base::RefCountedThreadSafe<V4LocalDatabaseManager>;
100 DISALLOW_COPY_AND_ASSIGN(V4LocalDatabaseManager); 105 DISALLOW_COPY_AND_ASSIGN(V4LocalDatabaseManager);
101 }; // class V4LocalDatabaseManager 106 }; // class V4LocalDatabaseManager
102 107
103 } // namespace safe_browsing 108 } // namespace safe_browsing
104 109
105 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_LOCAL_DATABASE_MANAGER_H_ 110 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_LOCAL_DATABASE_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698