Commit 971d3775 authored by kalman@chromium.org's avatar kalman@chromium.org

Define the storage API throttling constants in storage.json so that they are

documented for developers.

BUG=120347
TEST=browser_tests --gtest_filter=*ExtensionSettings*


Review URL: http://codereview.chromium.org/10266006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@134512 0039d316-1c4b-4281-b951-d872f2087c98
parent 7d71356a
......@@ -11,6 +11,7 @@
#include "chrome/browser/extensions/settings/settings_api.h"
#include "chrome/browser/extensions/settings/settings_frontend.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/extensions/api/storage.h"
#include "content/public/browser/browser_thread.h"
namespace extensions {
......@@ -129,10 +130,10 @@ std::vector<std::string> GetKeys(const DictionaryValue& dict) {
// Creates quota heuristics for settings modification.
static void GetModificationQuotaLimitHeuristics(
QuotaLimitHeuristics* heuristics) {
// A max of 1000 operations per hour.
QuotaLimitHeuristic::Config longLimitConfig = {
1000,
base::TimeDelta::FromHours(1)
// See storage.json for current value.
api::storage::sync::MAX_WRITE_OPERATIONS_PER_HOUR,
base::TimeDelta::FromHours(1)
};
heuristics->push_back(
new ExtensionsQuotaService::TimedLimit(
......@@ -140,8 +141,9 @@ static void GetModificationQuotaLimitHeuristics(
// A max of 10 operations per minute, sustained over 10 minutes.
QuotaLimitHeuristic::Config shortLimitConfig = {
10,
base::TimeDelta::FromMinutes(1)
// See storage.json for current value.
api::storage::sync::MAX_SUSTAINED_WRITE_OPERATIONS_PER_MINUTE,
base::TimeDelta::FromMinutes(1)
};
heuristics->push_back(
new ExtensionsQuotaService::SustainedLimit(
......
......@@ -185,6 +185,14 @@
"MAX_ITEMS": {
"value": 512,
"description": "The maximum number of items that can be stored in sync storage."
},
"MAX_WRITE_OPERATIONS_PER_HOUR": {
"value": 1000,
"description": "The maximum number of <code>set</code>, <code>remove</code>, or <code>clear</code> operations that can be performed each hour."
},
"MAX_SUSTAINED_WRITE_OPERATIONS_PER_MINUTE": {
"value": 10,
"description": "The maximum number of <code>set</code>, <code>remove</code>, or <code>clear</code> operations that can be performed each minute, sustained over 10 minutes."
}
}
},
......
......@@ -480,6 +480,48 @@ You can find examples that use this API on the
<!-- OBJECT METHODS -->
<!-- OBJECT EVENT FIELDS -->
<!-- FUNCTION PARAMETERS -->
</div>
</div><div>
<div>
<dt>
<var>MAX_WRITE_OPERATIONS_PER_HOUR</var>
<em>
<!-- TYPE -->
<div style="display:inline">
(
<span id="typeTemplate">
<code>1,000</code>
</span>
)
</div>
</em>
</dt>
<dd>The maximum number of <code>set</code>, <code>remove</code>, or <code>clear</code> operations that can be performed each hour.</dd>
<!-- OBJECT PROPERTIES -->
<!-- OBJECT METHODS -->
<!-- OBJECT EVENT FIELDS -->
<!-- FUNCTION PARAMETERS -->
</div>
</div><div>
<div>
<dt>
<var>MAX_SUSTAINED_WRITE_OPERATIONS_PER_MINUTE</var>
<em>
<!-- TYPE -->
<div style="display:inline">
(
<span id="typeTemplate">
<code>10</code>
</span>
)
</div>
</em>
</dt>
<dd>The maximum number of <code>set</code>, <code>remove</code>, or <code>clear</code> operations that can be performed each minute, sustained over 10 minutes.</dd>
<!-- OBJECT PROPERTIES -->
<!-- OBJECT METHODS -->
<!-- OBJECT EVENT FIELDS -->
<!-- FUNCTION PARAMETERS -->
</div>
</div>
</dl>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment