| Index: content/browser/dom_storage/dom_storage_database.cc
|
| diff --git a/webkit/browser/dom_storage/dom_storage_database.cc b/content/browser/dom_storage/dom_storage_database.cc
|
| similarity index 88%
|
| rename from webkit/browser/dom_storage/dom_storage_database.cc
|
| rename to content/browser/dom_storage/dom_storage_database.cc
|
| index f3199b6abe42130cedb570c08166245b4164c6cc..bff74a3ac0a41be71cc916a15ed5baab219038b9 100644
|
| --- a/webkit/browser/dom_storage/dom_storage_database.cc
|
| +++ b/content/browser/dom_storage/dom_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/dom_storage_database.h"
|
| +#include "content/browser/dom_storage/dom_storage_database.h"
|
|
|
| #include "base/bind.h"
|
| #include "base/file_util.h"
|
| @@ -17,17 +17,17 @@ const base::FilePath::CharType kJournal[] = FILE_PATH_LITERAL("-journal");
|
|
|
| } // anon namespace
|
|
|
| -namespace dom_storage {
|
| +namespace content {
|
|
|
| // static
|
| -base::FilePath DomStorageDatabase::GetJournalFilePath(
|
| +base::FilePath DOMStorageDatabase::GetJournalFilePath(
|
| const base::FilePath& database_path) {
|
| base::FilePath::StringType journal_file_name =
|
| database_path.BaseName().value() + kJournal;
|
| return database_path.DirName().Append(journal_file_name);
|
| }
|
|
|
| -DomStorageDatabase::DomStorageDatabase(const base::FilePath& file_path)
|
| +DOMStorageDatabase::DOMStorageDatabase(const base::FilePath& file_path)
|
| : file_path_(file_path) {
|
| // Note: in normal use we should never get an empty backing path here.
|
| // However, the unit test for this class can contruct an instance
|
| @@ -35,17 +35,17 @@ DomStorageDatabase::DomStorageDatabase(const base::FilePath& file_path)
|
| Init();
|
| }
|
|
|
| -DomStorageDatabase::DomStorageDatabase() {
|
| +DOMStorageDatabase::DOMStorageDatabase() {
|
| Init();
|
| }
|
|
|
| -void DomStorageDatabase::Init() {
|
| +void DOMStorageDatabase::Init() {
|
| failed_to_open_ = false;
|
| tried_to_recreate_ = false;
|
| known_to_be_empty_ = false;
|
| }
|
|
|
| -DomStorageDatabase::~DomStorageDatabase() {
|
| +DOMStorageDatabase::~DOMStorageDatabase() {
|
| if (known_to_be_empty_ && !file_path_.empty()) {
|
| // Delete the db and any lingering journal file from disk.
|
| Close();
|
| @@ -53,7 +53,7 @@ DomStorageDatabase::~DomStorageDatabase() {
|
| }
|
| }
|
|
|
| -void DomStorageDatabase::ReadAllValues(ValuesMap* result) {
|
| +void DOMStorageDatabase::ReadAllValues(DOMStorageValuesMap* result) {
|
| if (!LazyOpen(false))
|
| return;
|
|
|
| @@ -70,8 +70,8 @@ void DomStorageDatabase::ReadAllValues(ValuesMap* result) {
|
| known_to_be_empty_ = result->empty();
|
| }
|
|
|
| -bool DomStorageDatabase::CommitChanges(bool clear_all_first,
|
| - const ValuesMap& changes) {
|
| +bool DOMStorageDatabase::CommitChanges(bool clear_all_first,
|
| + const DOMStorageValuesMap& changes) {
|
| if (!LazyOpen(!changes.empty())) {
|
| // If we're being asked to commit changes that will result in an
|
| // empty database, we return true if the database file doesn't exist.
|
| @@ -92,7 +92,7 @@ bool DomStorageDatabase::CommitChanges(bool clear_all_first,
|
|
|
| bool did_delete = false;
|
| bool did_insert = false;
|
| - ValuesMap::const_iterator it = changes.begin();
|
| + DOMStorageValuesMap::const_iterator it = changes.begin();
|
| for(; it != changes.end(); ++it) {
|
| sql::Statement statement;
|
| base::string16 key = it->first;
|
| @@ -128,7 +128,7 @@ bool DomStorageDatabase::CommitChanges(bool clear_all_first,
|
| return success;
|
| }
|
|
|
| -bool DomStorageDatabase::LazyOpen(bool create_if_needed) {
|
| +bool DOMStorageDatabase::LazyOpen(bool create_if_needed) {
|
| if (failed_to_open_) {
|
| // Don't try to open a database that we know has failed
|
| // already.
|
| @@ -149,7 +149,7 @@ bool DomStorageDatabase::LazyOpen(bool create_if_needed) {
|
| }
|
|
|
| db_.reset(new sql::Connection());
|
| - db_->set_histogram_tag("DomStorageDatabase");
|
| + db_->set_histogram_tag("DOMStorageDatabase");
|
|
|
| if (file_path_.empty()) {
|
| // This code path should only be triggered by unit tests.
|
| @@ -197,7 +197,7 @@ bool DomStorageDatabase::LazyOpen(bool create_if_needed) {
|
| return DeleteFileAndRecreate();
|
| }
|
|
|
| -DomStorageDatabase::SchemaVersion DomStorageDatabase::DetectSchemaVersion() {
|
| +DOMStorageDatabase::SchemaVersion DOMStorageDatabase::DetectSchemaVersion() {
|
| DCHECK(IsOpen());
|
|
|
| // Connection::Open() may succeed even if the file we try and open is not a
|
| @@ -233,7 +233,7 @@ DomStorageDatabase::SchemaVersion DomStorageDatabase::DetectSchemaVersion() {
|
| return INVALID;
|
| }
|
|
|
| -bool DomStorageDatabase::CreateTableV2() {
|
| +bool DOMStorageDatabase::CreateTableV2() {
|
| DCHECK(IsOpen());
|
|
|
| return db_->Execute(
|
| @@ -242,7 +242,7 @@ bool DomStorageDatabase::CreateTableV2() {
|
| "value BLOB NOT NULL ON CONFLICT FAIL)");
|
| }
|
|
|
| -bool DomStorageDatabase::DeleteFileAndRecreate() {
|
| +bool DOMStorageDatabase::DeleteFileAndRecreate() {
|
| DCHECK(!IsOpen());
|
| DCHECK(base::PathExists(file_path_));
|
|
|
| @@ -262,7 +262,7 @@ bool DomStorageDatabase::DeleteFileAndRecreate() {
|
| return false;
|
| }
|
|
|
| -bool DomStorageDatabase::UpgradeVersion1To2() {
|
| +bool DOMStorageDatabase::UpgradeVersion1To2() {
|
| DCHECK(IsOpen());
|
| DCHECK(DetectSchemaVersion() == V1);
|
|
|
| @@ -273,7 +273,7 @@ bool DomStorageDatabase::UpgradeVersion1To2() {
|
| // Need to migrate from TEXT value column to BLOB.
|
| // Store the current database content so we can re-insert
|
| // the data into the new V2 table.
|
| - ValuesMap values;
|
| + DOMStorageValuesMap values;
|
| while (statement.Step()) {
|
| base::string16 key = statement.ColumnString16(0);
|
| base::NullableString16 value(statement.ColumnString16(1), false);
|
| @@ -288,8 +288,8 @@ bool DomStorageDatabase::UpgradeVersion1To2() {
|
| migration.Commit();
|
| }
|
|
|
| -void DomStorageDatabase::Close() {
|
| +void DOMStorageDatabase::Close() {
|
| db_.reset(NULL);
|
| }
|
|
|
| -} // namespace dom_storage
|
| +} // namespace content
|
|
|