Index: webkit/dom_storage/dom_storage_cached_area.cc |
diff --git a/webkit/dom_storage/dom_storage_cached_area.cc b/webkit/dom_storage/dom_storage_cached_area.cc |
index 30d6291d32a5e184f9aa013b3f4a81b658b23a02..2e1ec2023ab0e9d4a92d46a6a94f91fe64539839 100644 |
--- a/webkit/dom_storage/dom_storage_cached_area.cc |
+++ b/webkit/dom_storage/dom_storage_cached_area.cc |
@@ -13,10 +13,12 @@ |
namespace dom_storage { |
DomStorageCachedArea::DomStorageCachedArea( |
- int64 namespace_id, const GURL& origin, DomStorageProxy* proxy) |
+ int64 namespace_id, const GURL& origin, DomStorageProxy* proxy, |
+ int64 storage_size) |
: ignore_all_mutations_(false), |
namespace_id_(namespace_id), origin_(origin), |
- proxy_(proxy), weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { |
+ proxy_(proxy), weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), |
+ global_storage_size_(storage_size) { |
} |
DomStorageCachedArea::~DomStorageCachedArea() { |
@@ -47,6 +49,12 @@ bool DomStorageCachedArea::SetItem( |
if (key.length() + value.length() > dom_storage::kPerAreaQuota) |
return false; |
+ // TENTATIVE: Limit the global data to 512MB. |
+ if (key.length() + value.length() + global_storage_size_ |
+ > 512 * 1024 * 1024) { |
+ return false; |
+ } |
+ |
PrimeIfNeeded(connection_id); |
NullableString16 unused; |
if (!map_->SetItem(key, value, &unused)) |