Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #include "components/safe_browsing_db/v4_update_protocol_manager.h" | 5 #include "components/safe_browsing_db/v4_update_protocol_manager.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 94 void V4UpdateProtocolManager::ResetUpdateErrors() { | 94 void V4UpdateProtocolManager::ResetUpdateErrors() { |
| 95 update_error_count_ = 0; | 95 update_error_count_ = 0; |
| 96 update_back_off_mult_ = 1; | 96 update_back_off_mult_ = 1; |
| 97 } | 97 } |
| 98 | 98 |
| 99 V4UpdateProtocolManager::V4UpdateProtocolManager( | 99 V4UpdateProtocolManager::V4UpdateProtocolManager( |
| 100 net::URLRequestContextGetter* request_context_getter, | 100 net::URLRequestContextGetter* request_context_getter, |
| 101 const V4ProtocolConfig& config) | 101 const V4ProtocolConfig& config) |
| 102 : update_error_count_(0), | 102 : update_error_count_(0), |
| 103 update_back_off_mult_(1), | 103 update_back_off_mult_(1), |
| 104 next_update_time_(Time::Now()), | 104 // The next_update_time_ is just before now so that we can immediately |
| 105 // fetch an update. | |
| 106 next_update_time_(Time::Now() - base::TimeDelta::FromMilliseconds(1)), | |
|
Nathan Parker
2016/03/30 20:12:16
Why not zero? It's less code.
vakh (use Gerrit instead)
2016/03/30 21:04:14
Done.
| |
| 105 config_(config), | 107 config_(config), |
| 106 request_context_getter_(request_context_getter), | 108 request_context_getter_(request_context_getter), |
| 107 url_fetcher_id_(0) {} | 109 url_fetcher_id_(0) {} |
| 108 | 110 |
| 109 V4UpdateProtocolManager::~V4UpdateProtocolManager() { | 111 V4UpdateProtocolManager::~V4UpdateProtocolManager() { |
| 110 } | 112 } |
| 111 | 113 |
| 112 std::string V4UpdateProtocolManager::GetUpdateRequest( | 114 std::string V4UpdateProtocolManager::GetUpdateRequest( |
| 113 const base::hash_set<UpdateListIdentifier>& lists_to_update, | 115 const base::hash_set<UpdateListIdentifier>& lists_to_update, |
| 114 const base::hash_map<UpdateListIdentifier, std::string>& | 116 const base::hash_map<UpdateListIdentifier, std::string>& |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 268 next_update_time_ = now + next; | 270 next_update_time_ = now + next; |
| 269 } | 271 } |
| 270 | 272 |
| 271 GURL V4UpdateProtocolManager::GetUpdateUrl( | 273 GURL V4UpdateProtocolManager::GetUpdateUrl( |
| 272 const std::string& req_base64) const { | 274 const std::string& req_base64) const { |
| 273 return V4ProtocolManagerUtil::GetRequestUrl(req_base64, "encodedUpdates", | 275 return V4ProtocolManagerUtil::GetRequestUrl(req_base64, "encodedUpdates", |
| 274 config_); | 276 config_); |
| 275 } | 277 } |
| 276 | 278 |
| 277 } // namespace safe_browsing | 279 } // namespace safe_browsing |
| OLD | NEW |