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

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

Issue 22297005: Move webkit/{browser,common}/dom_storage into content/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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/webkit/common/dom_storage/dom_storage_map.cc b/content/common/dom_storage/dom_storage_map.cc
similarity index 72%
rename from webkit/common/dom_storage/dom_storage_map.cc
rename to content/common/dom_storage/dom_storage_map.cc
index 5cc3c5e62fd10086db998e6e3cd134a149f26461..7613201ce7905b5a72dc8e5ec06a6b96cba0ef7c 100644
--- a/webkit/common/dom_storage/dom_storage_map.cc
+++ b/content/common/dom_storage/dom_storage_map.cc
@@ -2,22 +2,24 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "webkit/common/dom_storage/dom_storage_map.h"
+#include "content/common/dom_storage/dom_storage_map.h"
#include "base/logging.h"
+namespace content {
+
namespace {
size_t size_of_item(const base::string16& key, const base::string16& value) {
return (key.length() + value.length()) * sizeof(char16);
}
-size_t CountBytes(const dom_storage::ValuesMap& values) {
+size_t CountBytes(const DOMStorageValuesMap& values) {
if (values.size() == 0)
return 0;
size_t count = 0;
- dom_storage::ValuesMap::const_iterator it = values.begin();
+ DOMStorageValuesMap::const_iterator it = values.begin();
for (; it != values.end(); ++it)
count += size_of_item(it->first, it->second.string());
return count;
@@ -25,21 +27,19 @@ size_t CountBytes(const dom_storage::ValuesMap& values) {
} // namespace
-namespace dom_storage {
-
-DomStorageMap::DomStorageMap(size_t quota)
+DOMStorageMap::DOMStorageMap(size_t quota)
: bytes_used_(0),
quota_(quota) {
ResetKeyIterator();
}
-DomStorageMap::~DomStorageMap() {}
+DOMStorageMap::~DOMStorageMap() {}
-unsigned DomStorageMap::Length() const {
+unsigned DOMStorageMap::Length() const {
return values_.size();
}
-base::NullableString16 DomStorageMap::Key(unsigned index) {
+base::NullableString16 DOMStorageMap::Key(unsigned index) {
if (index >= values_.size())
return base::NullableString16();
while (last_key_index_ != index) {
@@ -54,17 +54,17 @@ base::NullableString16 DomStorageMap::Key(unsigned index) {
return base::NullableString16(key_iterator_->first, false);
}
-base::NullableString16 DomStorageMap::GetItem(const base::string16& key) const {
- ValuesMap::const_iterator found = values_.find(key);
+base::NullableString16 DOMStorageMap::GetItem(const base::string16& key) const {
+ DOMStorageValuesMap::const_iterator found = values_.find(key);
if (found == values_.end())
return base::NullableString16();
return found->second;
}
-bool DomStorageMap::SetItem(
+bool DOMStorageMap::SetItem(
const base::string16& key, const base::string16& value,
base::NullableString16* old_value) {
- ValuesMap::const_iterator found = values_.find(key);
+ DOMStorageValuesMap::const_iterator found = values_.find(key);
if (found == values_.end())
*old_value = base::NullableString16();
else
@@ -86,10 +86,10 @@ bool DomStorageMap::SetItem(
return true;
}
-bool DomStorageMap::RemoveItem(
+bool DOMStorageMap::RemoveItem(
const base::string16& key,
base::string16* old_value) {
- ValuesMap::iterator found = values_.find(key);
+ DOMStorageValuesMap::iterator found = values_.find(key);
if (found == values_.end())
return false;
*old_value = found->second.string();
@@ -99,24 +99,24 @@ bool DomStorageMap::RemoveItem(
return true;
}
-void DomStorageMap::SwapValues(ValuesMap* values) {
+void DOMStorageMap::SwapValues(DOMStorageValuesMap* values) {
// Note: A pre-existing file may be over the quota budget.
values_.swap(*values);
bytes_used_ = CountBytes(values_);
ResetKeyIterator();
}
-DomStorageMap* DomStorageMap::DeepCopy() const {
- DomStorageMap* copy = new DomStorageMap(quota_);
+DOMStorageMap* DOMStorageMap::DeepCopy() const {
+ DOMStorageMap* copy = new DOMStorageMap(quota_);
copy->values_ = values_;
copy->bytes_used_ = bytes_used_;
copy->ResetKeyIterator();
return copy;
}
-void DomStorageMap::ResetKeyIterator() {
+void DOMStorageMap::ResetKeyIterator() {
key_iterator_ = values_.begin();
last_key_index_ = 0;
}
-} // namespace dom_storage
+} // namespace content
« no previous file with comments | « content/common/dom_storage/dom_storage_map.h ('k') | content/common/dom_storage/dom_storage_map_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698