Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Side by Side Diff: chrome/browser/extensions/extensions_quota_service.cc

Issue 10232004: Only apply extension throttling quota to sync, not local. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/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.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
(...skipping 17 matching lines...) Expand all
28 DCHECK(CalledOnValidThread()); 28 DCHECK(CalledOnValidThread());
29 purge_timer_.Stop(); 29 purge_timer_.Stop();
30 Purge(); 30 Purge();
31 } 31 }
32 32
33 bool ExtensionsQuotaService::Assess(const std::string& extension_id, 33 bool ExtensionsQuotaService::Assess(const std::string& extension_id,
34 ExtensionFunction* function, const ListValue* args, 34 ExtensionFunction* function, const ListValue* args,
35 const base::TimeTicks& event_time) { 35 const base::TimeTicks& event_time) {
36 DCHECK(CalledOnValidThread()); 36 DCHECK(CalledOnValidThread());
37 37
38 if (function->ShouldSkipQuotaLimiting())
39 return true;
40
38 // Lookup function list for extension. 41 // Lookup function list for extension.
39 FunctionHeuristicsMap& functions = function_heuristics_[extension_id]; 42 FunctionHeuristicsMap& functions = function_heuristics_[extension_id];
40 43
41 // Lookup heuristics for function, create if necessary. 44 // Lookup heuristics for function, create if necessary.
42 QuotaLimitHeuristics& heuristics = functions[function->name()]; 45 QuotaLimitHeuristics& heuristics = functions[function->name()];
43 if (heuristics.empty()) 46 if (heuristics.empty())
44 function->GetQuotaLimitHeuristics(&heuristics); 47 function->GetQuotaLimitHeuristics(&heuristics);
45 48
46 if (heuristics.empty()) 49 if (heuristics.empty())
47 return true; // No heuristic implies no limit. 50 return true; // No heuristic implies no limit.
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 return false; 160 return false;
158 } 161 }
159 } 162 }
160 163
161 // We can go negative since we check has_tokens when we get to *next* bucket, 164 // We can go negative since we check has_tokens when we get to *next* bucket,
162 // and for the small interval all that matters is whether we used up all the 165 // and for the small interval all that matters is whether we used up all the
163 // tokens (which is true if num_tokens_ <= 0). 166 // tokens (which is true if num_tokens_ <= 0).
164 bucket->DeductToken(); 167 bucket->DeductToken();
165 return true; 168 return true;
166 } 169 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_function.cc ('k') | chrome/browser/extensions/settings/settings_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698