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

Unified Diff: content/common/dom_storage/dom_storage_map.cc

Issue 896643002: [DOMStorage] Rate limiting writes to disk. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: content/common/dom_storage/dom_storage_map.cc
diff --git a/content/common/dom_storage/dom_storage_map.cc b/content/common/dom_storage/dom_storage_map.cc
index de33a52e89ac4db83c0b2401509729fba56d9f19..71368bdd55039ddc76278e7b5706e30517ab8aae 100644
--- a/content/common/dom_storage/dom_storage_map.cc
+++ b/content/common/dom_storage/dom_storage_map.cc
@@ -14,17 +14,6 @@ size_t size_of_item(const base::string16& key, const base::string16& value) {
return (key.length() + value.length()) * sizeof(base::char16);
}
-size_t CountBytes(const DOMStorageValuesMap& values) {
- if (values.size() == 0)
- return 0;
-
- size_t count = 0;
- DOMStorageValuesMap::const_iterator it = values.begin();
- for (; it != values.end(); ++it)
- count += size_of_item(it->first, it->second.string());
- return count;
-}
-
} // namespace
DOMStorageMap::DOMStorageMap(size_t quota)
@@ -119,4 +108,14 @@ void DOMStorageMap::ResetKeyIterator() {
last_key_index_ = 0;
}
+size_t DOMStorageMap::CountBytes(const DOMStorageValuesMap& values) {
+ if (values.empty())
+ return 0;
+
+ size_t count = 0;
+ for (const auto& pair : values)
+ count += size_of_item(pair.first, pair.second.string());
+ return count;
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698