| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/update_client/update_engine.h" | 5 #include "components/update_client/update_engine.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 notify_observers_callback(notify_observers_callback), | 37 notify_observers_callback(notify_observers_callback), |
| 38 callback(callback), | 38 callback(callback), |
| 39 main_task_runner(base::ThreadTaskRunnerHandle::Get()), | 39 main_task_runner(base::ThreadTaskRunnerHandle::Get()), |
| 40 blocking_task_runner(config->GetSequencedTaskRunner()), | 40 blocking_task_runner(config->GetSequencedTaskRunner()), |
| 41 update_checker_factory(update_checker_factory), | 41 update_checker_factory(update_checker_factory), |
| 42 crx_downloader_factory(crx_downloader_factory), | 42 crx_downloader_factory(crx_downloader_factory), |
| 43 ping_manager(ping_manager), | 43 ping_manager(ping_manager), |
| 44 retry_after_sec_(0) {} | 44 retry_after_sec_(0) {} |
| 45 | 45 |
| 46 UpdateContext::~UpdateContext() { | 46 UpdateContext::~UpdateContext() { |
| 47 STLDeleteElements(&update_items); | 47 base::STLDeleteElements(&update_items); |
| 48 } | 48 } |
| 49 | 49 |
| 50 UpdateEngine::UpdateEngine( | 50 UpdateEngine::UpdateEngine( |
| 51 const scoped_refptr<Configurator>& config, | 51 const scoped_refptr<Configurator>& config, |
| 52 UpdateChecker::Factory update_checker_factory, | 52 UpdateChecker::Factory update_checker_factory, |
| 53 CrxDownloader::Factory crx_downloader_factory, | 53 CrxDownloader::Factory crx_downloader_factory, |
| 54 PingManager* ping_manager, | 54 PingManager* ping_manager, |
| 55 const NotifyObserversCallback& notify_observers_callback) | 55 const NotifyObserversCallback& notify_observers_callback) |
| 56 : config_(config), | 56 : config_(config), |
| 57 update_checker_factory_(update_checker_factory), | 57 update_checker_factory_(update_checker_factory), |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 | 145 |
| 146 const auto now(base::Time::Now()); | 146 const auto now(base::Time::Now()); |
| 147 | 147 |
| 148 // Throttle the calls in the interval (t - 1 day, t) to limit the effect of | 148 // Throttle the calls in the interval (t - 1 day, t) to limit the effect of |
| 149 // unset clocks or clock drift. | 149 // unset clocks or clock drift. |
| 150 return throttle_updates_until_ - base::TimeDelta::FromDays(1) < now && | 150 return throttle_updates_until_ - base::TimeDelta::FromDays(1) < now && |
| 151 now < throttle_updates_until_; | 151 now < throttle_updates_until_; |
| 152 } | 152 } |
| 153 | 153 |
| 154 } // namespace update_client | 154 } // namespace update_client |
| OLD | NEW |