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

Unified Diff: content/browser/dom_storage/session_storage_database.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/browser/dom_storage/session_storage_database.cc
diff --git a/webkit/browser/dom_storage/session_storage_database.cc b/content/browser/dom_storage/session_storage_database.cc
similarity index 96%
rename from webkit/browser/dom_storage/session_storage_database.cc
rename to content/browser/dom_storage/session_storage_database.cc
index 8352a9c2eb74c6b32c9fc5e6587dfb82d16b9591..0d7116a674684fe7d8cbd53cf970f89a8d7bc64d 100644
--- a/webkit/browser/dom_storage/session_storage_database.cc
+++ b/content/browser/dom_storage/session_storage_database.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "webkit/browser/dom_storage/session_storage_database.h"
+#include "content/browser/dom_storage/session_storage_database.h"
#include "base/file_util.h"
#include "base/logging.h"
@@ -49,7 +49,7 @@ enum SessionStorageUMA {
// | namespace-3-origin2 | 2 (shallow copy) |
// | next-map-id | 4 |
-namespace dom_storage {
+namespace content {
SessionStorageDatabase::SessionStorageDatabase(const base::FilePath& file_path)
: file_path_(file_path),
@@ -62,7 +62,7 @@ SessionStorageDatabase::~SessionStorageDatabase() {
void SessionStorageDatabase::ReadAreaValues(const std::string& namespace_id,
const GURL& origin,
- ValuesMap* result) {
+ DOMStorageValuesMap* result) {
// We don't create a database if it doesn't exist. In that case, there is
// nothing to be added to the result.
if (!LazyOpen(false))
@@ -83,10 +83,11 @@ void SessionStorageDatabase::ReadAreaValues(const std::string& namespace_id,
db_->ReleaseSnapshot(options.snapshot);
}
-bool SessionStorageDatabase::CommitAreaChanges(const std::string& namespace_id,
- const GURL& origin,
- bool clear_all_first,
- const ValuesMap& changes) {
+bool SessionStorageDatabase::CommitAreaChanges(
+ const std::string& namespace_id,
+ const GURL& origin,
+ bool clear_all_first,
+ const DOMStorageValuesMap& changes) {
// Even if |changes| is empty, we need to write the appropriate placeholders
// in the database, so that it can be later shallow-copied succssfully.
if (!LazyOpen(true))
@@ -502,7 +503,7 @@ bool SessionStorageDatabase::CreateMapForArea(const std::string& namespace_id,
bool SessionStorageDatabase::ReadMap(const std::string& map_id,
const leveldb::ReadOptions& options,
- ValuesMap* result,
+ DOMStorageValuesMap* result,
bool only_keys) {
scoped_ptr<leveldb::Iterator> it(db_->NewIterator(options));
std::string map_start_key = MapRefCountKey(map_id);
@@ -539,9 +540,10 @@ bool SessionStorageDatabase::ReadMap(const std::string& map_id,
}
void SessionStorageDatabase::WriteValuesToMap(const std::string& map_id,
- const ValuesMap& values,
+ const DOMStorageValuesMap& values,
leveldb::WriteBatch* batch) {
- for (ValuesMap::const_iterator it = values.begin(); it != values.end();
+ for (DOMStorageValuesMap::const_iterator it = values.begin();
+ it != values.end();
++it) {
base::NullableString16 value = it->second;
std::string key = MapKey(map_id, UTF16ToUTF8(it->first));
@@ -601,10 +603,11 @@ bool SessionStorageDatabase::DecreaseMapRefCount(const std::string& map_id,
bool SessionStorageDatabase::ClearMap(const std::string& map_id,
leveldb::WriteBatch* batch) {
- ValuesMap values;
+ DOMStorageValuesMap values;
if (!ReadMap(map_id, leveldb::ReadOptions(), &values, true))
return false;
- for (ValuesMap::const_iterator it = values.begin(); it != values.end(); ++it)
+ for (DOMStorageValuesMap::const_iterator it = values.begin();
+ it != values.end(); ++it)
batch->Delete(MapKey(map_id, UTF16ToUTF8(it->first)));
return true;
}
@@ -632,7 +635,7 @@ bool SessionStorageDatabase::DeepCopyArea(
// Read the values from the old map here. If we don't need to copy the data,
// this can stay empty.
- ValuesMap values;
+ DOMStorageValuesMap values;
if (copy_data && !ReadMap(*map_id, leveldb::ReadOptions(), &values, false))
return false;
if (!DecreaseMapRefCount(*map_id, 1, batch))
@@ -674,4 +677,4 @@ const char* SessionStorageDatabase::NextMapIdKey() {
return "next-map-id";
}
-} // namespace dom_storage
+} // namespace content
« no previous file with comments | « content/browser/dom_storage/session_storage_database.h ('k') | content/browser/dom_storage/session_storage_database_adapter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698