OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/updater/extension_updater.h" | 5 #include "chrome/browser/extensions/updater/extension_updater.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 typedef extensions::ExtensionDownloaderDelegate::Error Error; | 45 typedef extensions::ExtensionDownloaderDelegate::Error Error; |
46 typedef extensions::ExtensionDownloaderDelegate::PingResult PingResult; | 46 typedef extensions::ExtensionDownloaderDelegate::PingResult PingResult; |
47 | 47 |
48 namespace { | 48 namespace { |
49 | 49 |
50 // Wait at least 5 minutes after browser startup before we do any checks. If you | 50 // Wait at least 5 minutes after browser startup before we do any checks. If you |
51 // change this value, make sure to update comments where it is used. | 51 // change this value, make sure to update comments where it is used. |
52 const int kStartupWaitSeconds = 60 * 5; | 52 const int kStartupWaitSeconds = 60 * 5; |
53 | 53 |
54 // For sanity checking on update frequency - enforced in release mode only. | 54 // For sanity checking on update frequency - enforced in release mode only. |
| 55 #ifdef NDEBUG |
55 const int kMinUpdateFrequencySeconds = 30; | 56 const int kMinUpdateFrequencySeconds = 30; |
| 57 #endif |
56 const int kMaxUpdateFrequencySeconds = 60 * 60 * 24 * 7; // 7 days | 58 const int kMaxUpdateFrequencySeconds = 60 * 60 * 24 * 7; // 7 days |
57 | 59 |
58 // Require at least 5 seconds between consecutive non-succesful extension update | 60 // Require at least 5 seconds between consecutive non-succesful extension update |
59 // checks. | 61 // checks. |
60 const int kMinUpdateThrottleTime = 5; | 62 const int kMinUpdateThrottleTime = 5; |
61 | 63 |
62 // When we've computed a days value, we want to make sure we don't send a | 64 // When we've computed a days value, we want to make sure we don't send a |
63 // negative value (due to the system clock being set backwards, etc.), since -1 | 65 // negative value (due to the system clock being set backwards, etc.), since -1 |
64 // is a special sentinel value that means "never pinged", and other negative | 66 // is a special sentinel value that means "never pinged", and other negative |
65 // values don't make sense. | 67 // values don't make sense. |
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
633 const InProgressCheck& request = requests_in_progress_[request_id]; | 635 const InProgressCheck& request = requests_in_progress_[request_id]; |
634 if (request.in_progress_ids_.empty()) { | 636 if (request.in_progress_ids_.empty()) { |
635 VLOG(2) << "Finished update check " << request_id; | 637 VLOG(2) << "Finished update check " << request_id; |
636 if (!request.callback.is_null()) | 638 if (!request.callback.is_null()) |
637 request.callback.Run(); | 639 request.callback.Run(); |
638 requests_in_progress_.erase(request_id); | 640 requests_in_progress_.erase(request_id); |
639 } | 641 } |
640 } | 642 } |
641 | 643 |
642 } // namespace extensions | 644 } // namespace extensions |
OLD | NEW |