| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/extensions_quota_service.h" | 5 #include "chrome/browser/extensions/extensions_quota_service.h" |
| 6 | 6 |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/stl_util-inl.h" | 8 #include "base/stl_util.h" |
| 9 #include "chrome/browser/extensions/extension_function.h" | 9 #include "chrome/browser/extensions/extension_function.h" |
| 10 | 10 |
| 11 // If the browser stays open long enough, we reset state once a day. | 11 // If the browser stays open long enough, we reset state once a day. |
| 12 // Whatever this value is, it should be an order of magnitude longer than | 12 // Whatever this value is, it should be an order of magnitude longer than |
| 13 // the longest interval in any of the QuotaLimitHeuristics in use. | 13 // the longest interval in any of the QuotaLimitHeuristics in use. |
| 14 static const int kPurgeIntervalInDays = 1; | 14 static const int kPurgeIntervalInDays = 1; |
| 15 | 15 |
| 16 const char QuotaLimitHeuristic::kGenericOverQuotaError[] = | 16 const char QuotaLimitHeuristic::kGenericOverQuotaError[] = |
| 17 "This request exceeds available quota."; | 17 "This request exceeds available quota."; |
| 18 | 18 |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 return false; | 146 return false; |
| 147 } | 147 } |
| 148 } | 148 } |
| 149 | 149 |
| 150 // We can go negative since we check has_tokens when we get to *next* bucket, | 150 // We can go negative since we check has_tokens when we get to *next* bucket, |
| 151 // and for the small interval all that matters is whether we used up all the | 151 // and for the small interval all that matters is whether we used up all the |
| 152 // tokens (which is true if num_tokens_ <= 0). | 152 // tokens (which is true if num_tokens_ <= 0). |
| 153 bucket->DeductToken(); | 153 bucket->DeductToken(); |
| 154 return true; | 154 return true; |
| 155 } | 155 } |
| OLD | NEW |