OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/extensions/extension_updater.h" | 5 #include "chrome/browser/extensions/extension_updater.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
935 double jitter_factor = (RandDouble() * .2) - 0.1; | 935 double jitter_factor = (RandDouble() * .2) - 0.1; |
936 delay_ms += delay_ms * jitter_factor; | 936 delay_ms += delay_ms * jitter_factor; |
937 TimeDelta actual_delay = TimeDelta::FromMilliseconds( | 937 TimeDelta actual_delay = TimeDelta::FromMilliseconds( |
938 static_cast<int64>(delay_ms)); | 938 static_cast<int64>(delay_ms)); |
939 | 939 |
940 // Save the time of next check. | 940 // Save the time of next check. |
941 Time next = Time::Now() + actual_delay; | 941 Time next = Time::Now() + actual_delay; |
942 prefs_->SetInt64(kNextExtensionsUpdateCheck, next.ToInternalValue()); | 942 prefs_->SetInt64(kNextExtensionsUpdateCheck, next.ToInternalValue()); |
943 prefs_->ScheduleSavePersistentPrefs(); | 943 prefs_->ScheduleSavePersistentPrefs(); |
944 | 944 |
945 timer_.Start(FROM_HERE, actual_delay, this, &ExtensionUpdater::TimerFired); | 945 timer_.Start(actual_delay, this, &ExtensionUpdater::TimerFired); |
946 } | 946 } |
947 | 947 |
948 void ExtensionUpdater::TimerFired() { | 948 void ExtensionUpdater::TimerFired() { |
949 DCHECK(alive_); | 949 DCHECK(alive_); |
950 CheckNow(); | 950 CheckNow(); |
951 | 951 |
952 // If the user has overridden the update frequency, don't bother reporting | 952 // If the user has overridden the update frequency, don't bother reporting |
953 // this. | 953 // this. |
954 if (frequency_seconds_ == ExtensionService::kDefaultUpdateFrequencySeconds) { | 954 if (frequency_seconds_ == ExtensionService::kDefaultUpdateFrequencySeconds) { |
955 Time last = Time::FromInternalValue(prefs_->GetInt64( | 955 Time last = Time::FromInternalValue(prefs_->GetInt64( |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1242 std::set<std::string>::const_iterator i; | 1242 std::set<std::string>::const_iterator i; |
1243 for (i = ids.begin(); i != ids.end(); ++i) | 1243 for (i = ids.begin(); i != ids.end(); ++i) |
1244 in_progress_ids_.insert(*i); | 1244 in_progress_ids_.insert(*i); |
1245 } | 1245 } |
1246 | 1246 |
1247 void ExtensionUpdater::RemoveFromInProgress(const std::set<std::string>& ids) { | 1247 void ExtensionUpdater::RemoveFromInProgress(const std::set<std::string>& ids) { |
1248 std::set<std::string>::const_iterator i; | 1248 std::set<std::string>::const_iterator i; |
1249 for (i = ids.begin(); i != ids.end(); ++i) | 1249 for (i = ids.begin(); i != ids.end(); ++i) |
1250 in_progress_ids_.erase(*i); | 1250 in_progress_ids_.erase(*i); |
1251 } | 1251 } |
OLD | NEW |