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