Chromium Code Reviews| Index: components/safe_browsing_db/v4_update_protocol_manager.h |
| diff --git a/components/safe_browsing_db/v4_update_protocol_manager.h b/components/safe_browsing_db/v4_update_protocol_manager.h |
| index 4b2031779d1e3f2b3cd1f72158d5ef8adda66f2e..266d13635716b62516bcb513238357db13e4ddea 100644 |
| --- a/components/safe_browsing_db/v4_update_protocol_manager.h |
| +++ b/components/safe_browsing_db/v4_update_protocol_manager.h |
| @@ -37,9 +37,6 @@ namespace safe_browsing { |
| class V4UpdateProtocolManagerFactory; |
| -typedef FetchThreatListUpdatesRequest::ListUpdateRequest ListUpdateRequest; |
| -typedef FetchThreatListUpdatesResponse::ListUpdateResponse ListUpdateResponse; |
| - |
| // V4UpdateCallback is invoked when a scheduled update completes. |
| // Parameters: |
| // - The vector of update response protobufs received from the server for |
| @@ -62,27 +59,23 @@ class V4UpdateProtocolManager : public net::URLFetcherDelegate, |
| static std::unique_ptr<V4UpdateProtocolManager> Create( |
| net::URLRequestContextGetter* request_context_getter, |
| const V4ProtocolConfig& config, |
| - const base::hash_map<UpdateListIdentifier, std::string>& |
| - current_list_states, |
| V4UpdateCallback callback); |
| // net::URLFetcherDelegate interface. |
| void OnURLFetchComplete(const net::URLFetcher* source) override; |
| - // Schedule the next update without backoff. |
| - void ScheduleNextUpdate(); |
| + // Schedule the next update without backoff for the stores in |
| + // |store_state_map|. |
| + void ScheduleNextUpdate(const StoreStateMap* store_state_map); |
| protected: |
| // Constructs a V4UpdateProtocolManager that issues network requests using |
| - // |request_context_getter|. |
| - // Schedules an update to get the hash prefixes for the lists in |
| - // |current_list_states|, and invoke |callback| when the results |
| - // are retrieved. The callback may be invoked synchronously. |
| + // |request_context_getter|. It schedules updates to get the hash prefixes for |
| + // SafeBrowsing lists, and invoke |callback| when the results are retrieved. |
| + // The callback may be invoked synchronously. |
| V4UpdateProtocolManager( |
| net::URLRequestContextGetter* request_context_getter, |
| const V4ProtocolConfig& config, |
| - const base::hash_map<UpdateListIdentifier, std::string>& |
| - current_list_states, |
| V4UpdateCallback callback); |
| private: |
| @@ -105,9 +98,8 @@ class V4UpdateProtocolManager : public net::URLFetcherDelegate, |
| // Fills a FetchThreatListUpdatesRequest protocol buffer for a request. |
| // Returns the serialized and base 64 encoded request as a string. |
| - std::string GetBase64SerializedUpdateRequestProto( |
| - const base::hash_map<UpdateListIdentifier, std::string>& |
| - current_list_states); |
| + static std::string GetBase64SerializedUpdateRequestProto( |
| + const StoreStateMap* store_state_map); |
| // Parses the base64 encoded response received from the server as a |
| // FetchThreatListUpdatesResponse protobuf and returns each of the |
| @@ -137,6 +129,10 @@ class V4UpdateProtocolManager : public net::URLFetcherDelegate, |
| // Schedule the next update, after the given interval. |
| void ScheduleNextUpdateAfterInterval(base::TimeDelta interval); |
| + void set_store_state_map(const StoreStateMap* store_state_map) { |
| + store_state_map_ = store_state_map; |
| + } |
| + |
| // Get the next update interval, considering whether we are in backoff. |
| base::TimeDelta GetNextUpdateInterval(bool back_off); |
| @@ -145,10 +141,8 @@ class V4UpdateProtocolManager : public net::URLFetcherDelegate, |
| static V4UpdateProtocolManagerFactory* factory_; |
| // The last known state of the lists. |
| - // At init, this is read from the disk or is empty for no prior state. |
| - // Each successful update from the server contains a new state for each |
| - // requested list. |
| - base::hash_map<UpdateListIdentifier, std::string> current_list_states_; |
| + // Updated after every successful update of the database. |
| + const StoreStateMap* store_state_map_; |
|
Nathan Parker
2016/06/15 21:24:21
Q: Does this need to be stored here, or can it jus
vakh (use Gerrit instead)
2016/06/16 01:07:35
As discussed offline, the reason it is stored here
|
| // The number of HTTP response errors since the the last successful HTTP |
| // response, used for request backoff timing. |
| @@ -194,8 +188,6 @@ class V4UpdateProtocolManagerFactory { |
| virtual std::unique_ptr<V4UpdateProtocolManager> CreateProtocolManager( |
| net::URLRequestContextGetter* request_context_getter, |
| const V4ProtocolConfig& config, |
| - const base::hash_map<UpdateListIdentifier, std::string>& |
| - current_list_states, |
| V4UpdateCallback callback) = 0; |
| private: |