diff options
Diffstat (limited to 'content/browser/indexed_db')
21 files changed, 163 insertions, 153 deletions
diff --git a/content/browser/indexed_db/indexed_db_backing_store.cc b/content/browser/indexed_db/indexed_db_backing_store.cc index 766d6a4..92f4b22 100644 --- a/content/browser/indexed_db/indexed_db_backing_store.cc +++ b/content/browser/indexed_db/indexed_db_backing_store.cc @@ -157,7 +157,7 @@ static void PutVarInt(LevelDBTransaction* transaction, template <typename DBOrTransaction> WARN_UNUSED_RESULT static bool GetString(DBOrTransaction* db, const StringPiece& key, - string16* found_string, + base::string16* found_string, bool* found) { std::string result; *found = false; @@ -172,7 +172,7 @@ WARN_UNUSED_RESULT static bool GetString(DBOrTransaction* db, static void PutString(LevelDBTransaction* transaction, const StringPiece& key, - const string16& value) { + const base::string16& value) { std::string buffer; EncodeString(value, &buffer); transaction->Put(key, &buffer); @@ -653,8 +653,8 @@ scoped_refptr<IndexedDBBackingStore> IndexedDBBackingStore::Create( return backing_store; } -std::vector<string16> IndexedDBBackingStore::GetDatabaseNames() { - std::vector<string16> found_names; +std::vector<base::string16> IndexedDBBackingStore::GetDatabaseNames() { + std::vector<base::string16> found_names; const std::string start_key = DatabaseNameKey::EncodeMinKeyForOrigin(origin_identifier_); const std::string stop_key = @@ -678,7 +678,7 @@ std::vector<string16> IndexedDBBackingStore::GetDatabaseNames() { } bool IndexedDBBackingStore::GetIDBDatabaseMetaData( - const string16& name, + const base::string16& name, IndexedDBDatabaseMetadata* metadata, bool* found) { const std::string key = DatabaseNameKey::Encode(origin_identifier_, name); @@ -755,10 +755,11 @@ WARN_UNUSED_RESULT static bool GetNewDatabaseId(LevelDBTransaction* transaction, return true; } -bool IndexedDBBackingStore::CreateIDBDatabaseMetaData(const string16& name, - const string16& version, - int64 int_version, - int64* row_id) { +bool IndexedDBBackingStore::CreateIDBDatabaseMetaData( + const base::string16& name, + const base::string16& version, + int64 int_version, + int64* row_id) { scoped_refptr<LevelDBTransaction> transaction = new LevelDBTransaction(db_.get()); @@ -811,7 +812,7 @@ static void DeleteRange(LevelDBTransaction* transaction, transaction->Remove(it->Key()); } -bool IndexedDBBackingStore::DeleteDatabase(const string16& name) { +bool IndexedDBBackingStore::DeleteDatabase(const base::string16& name) { IDB_TRACE("IndexedDBBackingStore::DeleteDatabase"); scoped_ptr<LevelDBWriteOnlyTransaction> transaction = LevelDBWriteOnlyTransaction::Create(db_.get()); @@ -895,7 +896,7 @@ bool IndexedDBBackingStore::GetObjectStores( // TODO(jsbell): Do this by direct key lookup rather than iteration, to // simplify. - string16 object_store_name; + base::string16 object_store_name; { StringPiece slice(it->Value()); if (!DecodeString(&slice, &object_store_name) || !slice.empty()) @@ -1049,7 +1050,7 @@ bool IndexedDBBackingStore::CreateObjectStore( IndexedDBBackingStore::Transaction* transaction, int64 database_id, int64 object_store_id, - const string16& name, + const base::string16& name, const IndexedDBKeyPath& key_path, bool auto_increment) { IDB_TRACE("IndexedDBBackingStore::CreateObjectStore"); @@ -1103,7 +1104,7 @@ bool IndexedDBBackingStore::DeleteObjectStore( return false; LevelDBTransaction* leveldb_transaction = transaction->transaction(); - string16 object_store_name; + base::string16 object_store_name; bool found = false; bool ok = GetString( leveldb_transaction, @@ -1473,7 +1474,7 @@ bool IndexedDBBackingStore::GetIndexes( // TODO(jsbell): Do this by direct key lookup rather than iteration, to // simplify. int64 index_id = meta_data_key.IndexId(); - string16 index_name; + base::string16 index_name; { StringPiece slice(it->Value()); if (!DecodeString(&slice, &index_name) || !slice.empty()) @@ -1553,7 +1554,7 @@ bool IndexedDBBackingStore::CreateIndex( int64 database_id, int64 object_store_id, int64 index_id, - const string16& name, + const base::string16& name, const IndexedDBKeyPath& key_path, bool is_unique, bool is_multi_entry) { diff --git a/content/browser/indexed_db/indexed_db_backing_store.h b/content/browser/indexed_db/indexed_db_backing_store.h index 9ea71f1..00b15a3 100644 --- a/content/browser/indexed_db/indexed_db_backing_store.h +++ b/content/browser/indexed_db/indexed_db_backing_store.h @@ -69,19 +69,19 @@ class CONTENT_EXPORT IndexedDBBackingStore const GURL& origin_url, LevelDBFactory* factory); - virtual std::vector<string16> GetDatabaseNames(); - virtual bool GetIDBDatabaseMetaData(const string16& name, + virtual std::vector<base::string16> GetDatabaseNames(); + virtual bool GetIDBDatabaseMetaData(const base::string16& name, IndexedDBDatabaseMetadata* metadata, bool* success) WARN_UNUSED_RESULT; - virtual bool CreateIDBDatabaseMetaData(const string16& name, - const string16& version, + virtual bool CreateIDBDatabaseMetaData(const base::string16& name, + const base::string16& version, int64 int_version, int64* row_id); virtual bool UpdateIDBDatabaseIntVersion( IndexedDBBackingStore::Transaction* transaction, int64 row_id, int64 int_version); - virtual bool DeleteDatabase(const string16& name); + virtual bool DeleteDatabase(const base::string16& name); bool GetObjectStores(int64 database_id, IndexedDBDatabaseMetadata::ObjectStoreMap* map) @@ -90,7 +90,7 @@ class CONTENT_EXPORT IndexedDBBackingStore IndexedDBBackingStore::Transaction* transaction, int64 database_id, int64 object_store_id, - const string16& name, + const base::string16& name, const IndexedDBKeyPath& key_path, bool auto_increment); virtual bool DeleteObjectStore( @@ -160,7 +160,7 @@ class CONTENT_EXPORT IndexedDBBackingStore int64 database_id, int64 object_store_id, int64 index_id, - const string16& name, + const base::string16& name, const IndexedDBKeyPath& key_path, bool is_unique, bool is_multi_entry) WARN_UNUSED_RESULT; diff --git a/content/browser/indexed_db/indexed_db_backing_store_unittest.cc b/content/browser/indexed_db/indexed_db_backing_store_unittest.cc index 396189e..d3e8296 100644 --- a/content/browser/indexed_db/indexed_db_backing_store_unittest.cc +++ b/content/browser/indexed_db/indexed_db_backing_store_unittest.cc @@ -236,19 +236,19 @@ TEST_F(IndexedDBBackingStoreTest, InvalidIds) { } TEST_F(IndexedDBBackingStoreTest, CreateDatabase) { - const string16 database_name(ASCIIToUTF16("db1")); + const base::string16 database_name(ASCIIToUTF16("db1")); int64 database_id; - const string16 version(ASCIIToUTF16("old_string_version")); + const base::string16 version(ASCIIToUTF16("old_string_version")); const int64 int_version = 9; const int64 object_store_id = 99; - const string16 object_store_name(ASCIIToUTF16("object_store1")); + const base::string16 object_store_name(ASCIIToUTF16("object_store1")); const bool auto_increment = true; const IndexedDBKeyPath object_store_key_path( ASCIIToUTF16("object_store_key")); const int64 index_id = 999; - const string16 index_name(ASCIIToUTF16("index1")); + const base::string16 index_name(ASCIIToUTF16("index1")); const bool unique = true; const bool multi_entry = true; const IndexedDBKeyPath index_key_path(ASCIIToUTF16("index_key")); diff --git a/content/browser/indexed_db/indexed_db_browsertest.cc b/content/browser/indexed_db/indexed_db_browsertest.cc index 687ce48..74b81b6 100644 --- a/content/browser/indexed_db/indexed_db_browsertest.cc +++ b/content/browser/indexed_db/indexed_db_browsertest.cc @@ -66,7 +66,7 @@ class IndexedDBBrowserTest : public ContentBrowserTest { if (hash) url = GURL(url.spec() + hash); - string16 expected_title16(ASCIIToUTF16(expected_string)); + base::string16 expected_title16(ASCIIToUTF16(expected_string)); TitleWatcher title_watcher(shell->web_contents(), expected_title16); NavigateToURL(shell, url); EXPECT_EQ(expected_title16, title_watcher.WaitAndGetTitle()); @@ -399,7 +399,7 @@ IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, ConnectionsClosedOnTabClose) { NavigateAndWaitForTitle(new_shell, "version_change_blocked.html", "#tab2", "setVersion(3) blocked"); - string16 expected_title16(ASCIIToUTF16("setVersion(3) complete")); + base::string16 expected_title16(ASCIIToUTF16("setVersion(3) complete")); TitleWatcher title_watcher(new_shell->web_contents(), expected_title16); base::KillProcess( @@ -421,7 +421,7 @@ IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, ForceCloseEventTest) { GetContext(), GURL("file:///"))); - string16 expected_title16(ASCIIToUTF16("connection closed")); + base::string16 expected_title16(ASCIIToUTF16("connection closed")); TitleWatcher title_watcher(shell()->web_contents(), expected_title16); EXPECT_EQ(expected_title16, title_watcher.WaitAndGetTitle()); } diff --git a/content/browser/indexed_db/indexed_db_callbacks.cc b/content/browser/indexed_db/indexed_db_callbacks.cc index 587b66f..755551c 100644 --- a/content/browser/indexed_db/indexed_db_callbacks.cc +++ b/content/browser/indexed_db/indexed_db_callbacks.cc @@ -71,7 +71,7 @@ void IndexedDBCallbacks::OnError(const IndexedDBDatabaseError& error) { dispatcher_host_ = NULL; } -void IndexedDBCallbacks::OnSuccess(const std::vector<string16>& value) { +void IndexedDBCallbacks::OnSuccess(const std::vector<base::string16>& value) { DCHECK(dispatcher_host_.get()); DCHECK_EQ(kNoCursor, ipc_cursor_id_); @@ -79,7 +79,7 @@ void IndexedDBCallbacks::OnSuccess(const std::vector<string16>& value) { DCHECK_EQ(kNoDatabase, ipc_database_id_); DCHECK_EQ(kNoDatabaseCallbacks, ipc_database_callbacks_id_); - std::vector<string16> list; + std::vector<base::string16> list; for (unsigned i = 0; i < value.size(); ++i) list.push_back(value[i]); diff --git a/content/browser/indexed_db/indexed_db_callbacks.h b/content/browser/indexed_db/indexed_db_callbacks.h index 1ea0c0b..048b563 100644 --- a/content/browser/indexed_db/indexed_db_callbacks.h +++ b/content/browser/indexed_db/indexed_db_callbacks.h @@ -51,7 +51,7 @@ class CONTENT_EXPORT IndexedDBCallbacks virtual void OnError(const IndexedDBDatabaseError& error); // IndexedDBFactory::GetDatabaseNames - virtual void OnSuccess(const std::vector<string16>& string); + virtual void OnSuccess(const std::vector<base::string16>& string); // IndexedDBFactory::Open / DeleteDatabase virtual void OnBlocked(int64 existing_version); diff --git a/content/browser/indexed_db/indexed_db_database.cc b/content/browser/indexed_db/indexed_db_database.cc index 8d63293..258b01e 100644 --- a/content/browser/indexed_db/indexed_db_database.cc +++ b/content/browser/indexed_db/indexed_db_database.cc @@ -108,7 +108,7 @@ class IndexedDBDatabase::PendingDeleteCall { }; scoped_refptr<IndexedDBDatabase> IndexedDBDatabase::Create( - const string16& name, + const base::string16& name, IndexedDBBackingStore* backing_store, IndexedDBFactory* factory, const Identifier& unique_identifier) { @@ -128,7 +128,7 @@ bool Contains(const T& container, const U& item) { } } -IndexedDBDatabase::IndexedDBDatabase(const string16& name, +IndexedDBDatabase::IndexedDBDatabase(const base::string16& name, IndexedDBBackingStore* backing_store, IndexedDBFactory* factory, const Identifier& unique_identifier) @@ -273,7 +273,7 @@ bool IndexedDBDatabase::ValidateObjectStoreIdAndNewIndexId( void IndexedDBDatabase::CreateObjectStore(int64 transaction_id, int64 object_store_id, - const string16& name, + const base::string16& name, const IndexedDBKeyPath& key_path, bool auto_increment) { IDB_TRACE("IndexedDBDatabase::CreateObjectStore"); @@ -351,7 +351,7 @@ void IndexedDBDatabase::DeleteObjectStore(int64 transaction_id, void IndexedDBDatabase::CreateIndex(int64 transaction_id, int64 object_store_id, int64 index_id, - const string16& name, + const base::string16& name, const IndexedDBKeyPath& key_path, bool unique, bool multi_entry) { @@ -392,8 +392,9 @@ void IndexedDBDatabase::CreateIndexOperation( index_metadata.key_path, index_metadata.unique, index_metadata.multi_entry)) { - string16 error_string = ASCIIToUTF16("Internal error creating index '") + - index_metadata.name + ASCIIToUTF16("'."); + base::string16 error_string = + ASCIIToUTF16("Internal error creating index '") + + index_metadata.name + ASCIIToUTF16("'."); transaction->Abort(IndexedDBDatabaseError( blink::WebIDBDatabaseExceptionUnknownError, error_string)); return; @@ -446,8 +447,9 @@ void IndexedDBDatabase::DeleteIndexOperation( object_store_id, index_metadata.id); if (!ok) { - string16 error_string = ASCIIToUTF16("Internal error deleting index '") + - index_metadata.name + ASCIIToUTF16("'."); + base::string16 error_string = + ASCIIToUTF16("Internal error deleting index '") + + index_metadata.name + ASCIIToUTF16("'."); transaction->Abort(IndexedDBDatabaseError( blink::WebIDBDatabaseExceptionUnknownError, error_string)); } @@ -791,7 +793,7 @@ void IndexedDBDatabase::PutOperation(scoped_ptr<PutOperationParams> params, } ScopedVector<IndexWriter> index_writers; - string16 error_message; + base::string16 error_message; bool obeys_constraints = false; bool backing_store_success = MakeIndexWriters(transaction, backing_store_.get(), @@ -897,7 +899,7 @@ void IndexedDBDatabase::SetIndexKeys(int64 transaction_id, } ScopedVector<IndexWriter> index_writers; - string16 error_message; + base::string16 error_message; bool obeys_constraints = false; DCHECK(metadata_.object_stores.find(object_store_id) != metadata_.object_stores.end()); @@ -1219,7 +1221,7 @@ void IndexedDBDatabase::DeleteObjectStoreOperation( transaction->database()->id(), object_store_metadata.id); if (!ok) { - string16 error_string = + base::string16 error_string = ASCIIToUTF16("Internal error deleting object store '") + object_store_metadata.name + ASCIIToUTF16("'."); transaction->Abort(IndexedDBDatabaseError( @@ -1449,7 +1451,7 @@ void IndexedDBDatabase::OpenConnection( DCHECK_EQ(IndexedDBDatabaseMetadata::NO_INT_VERSION, metadata_.int_version); } else { - string16 message; + base::string16 message; if (version == IndexedDBDatabaseMetadata::NO_INT_VERSION) message = ASCIIToUTF16( "Internal error opening database with no version specified."); @@ -1714,7 +1716,7 @@ void IndexedDBDatabase::DeleteObjectStoreAbortOperation( } void IndexedDBDatabase::VersionChangeAbortOperation( - const string16& previous_version, + const base::string16& previous_version, int64 previous_int_version, IndexedDBTransaction* transaction) { IDB_TRACE("IndexedDBDatabase::VersionChangeAbortOperation"); diff --git a/content/browser/indexed_db/indexed_db_database.h b/content/browser/indexed_db/indexed_db_database.h index fa730b0..b9b4dac 100644 --- a/content/browser/indexed_db/indexed_db_database.h +++ b/content/browser/indexed_db/indexed_db_database.h @@ -52,7 +52,7 @@ class CONTENT_EXPORT IndexedDBDatabase static const int64 kMinimumIndexId = 30; static scoped_refptr<IndexedDBDatabase> Create( - const string16& name, + const base::string16& name, IndexedDBBackingStore* backing_store, IndexedDBFactory* factory, const Identifier& unique_identifier); @@ -88,7 +88,7 @@ class CONTENT_EXPORT IndexedDBDatabase void CreateObjectStore(int64 transaction_id, int64 object_store_id, - const string16& name, + const base::string16& name, const IndexedDBKeyPath& key_path, bool auto_increment); void DeleteObjectStore(int64 transaction_id, int64 object_store_id); @@ -105,7 +105,7 @@ class CONTENT_EXPORT IndexedDBDatabase void CreateIndex(int64 transaction_id, int64 object_store_id, int64 index_id, - const string16& name, + const base::string16& name, const IndexedDBKeyPath& key_path, bool unique, bool multi_entry); @@ -198,7 +198,7 @@ class CONTENT_EXPORT IndexedDBDatabase blink::WebIDBDataLoss data_loss, std::string data_loss_message, IndexedDBTransaction* transaction); - void VersionChangeAbortOperation(const string16& previous_version, + void VersionChangeAbortOperation(const base::string16& previous_version, int64 previous_int_version, IndexedDBTransaction* transaction); void CreateIndexOperation(int64 object_store_id, @@ -243,7 +243,7 @@ class CONTENT_EXPORT IndexedDBDatabase private: friend class base::RefCounted<IndexedDBDatabase>; - IndexedDBDatabase(const string16& name, + IndexedDBDatabase(const base::string16& name, IndexedDBBackingStore* backing_store, IndexedDBFactory* factory, const Identifier& unique_identifier); diff --git a/content/browser/indexed_db/indexed_db_database_error.h b/content/browser/indexed_db/indexed_db_database_error.h index 297bec7..1a4f449 100644 --- a/content/browser/indexed_db/indexed_db_database_error.h +++ b/content/browser/indexed_db/indexed_db_database_error.h @@ -17,16 +17,16 @@ class IndexedDBDatabaseError { : code_(code) {} IndexedDBDatabaseError(uint16 code, const char* message) : code_(code), message_(ASCIIToUTF16(message)) {} - IndexedDBDatabaseError(uint16 code, const string16& message) + IndexedDBDatabaseError(uint16 code, const base::string16& message) : code_(code), message_(message) {} ~IndexedDBDatabaseError() {} uint16 code() const { return code_; } - const string16& message() const { return message_; } + const base::string16& message() const { return message_; } private: const uint16 code_; - const string16 message_; + const base::string16 message_; }; } // namespace content diff --git a/content/browser/indexed_db/indexed_db_factory.cc b/content/browser/indexed_db/indexed_db_factory.cc index 2cfef62..bd0c0ad 100644 --- a/content/browser/indexed_db/indexed_db_factory.cc +++ b/content/browser/indexed_db/indexed_db_factory.cc @@ -130,7 +130,7 @@ void IndexedDBFactory::GetDatabaseNames( } void IndexedDBFactory::DeleteDatabase( - const string16& name, + const base::string16& name, scoped_refptr<IndexedDBCallbacks> callbacks, const GURL& origin_url, const base::FilePath& data_directory) { @@ -233,7 +233,7 @@ scoped_refptr<IndexedDBBackingStore> IndexedDBFactory::OpenBackingStore( } void IndexedDBFactory::Open( - const string16& name, + const base::string16& name, int64 version, int64 transaction_id, scoped_refptr<IndexedDBCallbacks> callbacks, diff --git a/content/browser/indexed_db/indexed_db_factory.h b/content/browser/indexed_db/indexed_db_factory.h index b143853..74168d6 100644 --- a/content/browser/indexed_db/indexed_db_factory.h +++ b/content/browser/indexed_db/indexed_db_factory.h @@ -36,7 +36,7 @@ class CONTENT_EXPORT IndexedDBFactory void GetDatabaseNames(scoped_refptr<IndexedDBCallbacks> callbacks, const GURL& origin_url, const base::FilePath& data_directory); - void Open(const string16& name, + void Open(const base::string16& name, int64 version, int64 transaction_id, scoped_refptr<IndexedDBCallbacks> callbacks, @@ -44,7 +44,7 @@ class CONTENT_EXPORT IndexedDBFactory const GURL& origin_url, const base::FilePath& data_directory); - void DeleteDatabase(const string16& name, + void DeleteDatabase(const base::string16& name, scoped_refptr<IndexedDBCallbacks> callbacks, const GURL& origin_url, const base::FilePath& data_directory); diff --git a/content/browser/indexed_db/indexed_db_factory_unittest.cc b/content/browser/indexed_db/indexed_db_factory_unittest.cc index 859c2b7..9afa9e7 100644 --- a/content/browser/indexed_db/indexed_db_factory_unittest.cc +++ b/content/browser/indexed_db/indexed_db_factory_unittest.cc @@ -217,7 +217,7 @@ TEST_F(IndexedDBFactoryTest, QuotaErrorOnDiskFull) { new LookingForQuotaErrorMockCallbacks; scoped_refptr<IndexedDBDatabaseCallbacks> dummy_database_callbacks = new IndexedDBDatabaseCallbacks(NULL, 0, 0); - const string16 name(ASCIIToUTF16("name")); + const base::string16 name(ASCIIToUTF16("name")); factory->Open(name, 1, /* version */ 2, /* transaction_id */ diff --git a/content/browser/indexed_db/indexed_db_fake_backing_store.cc b/content/browser/indexed_db/indexed_db_fake_backing_store.cc index 8766162..3825982 100644 --- a/content/browser/indexed_db/indexed_db_fake_backing_store.cc +++ b/content/browser/indexed_db/indexed_db_fake_backing_store.cc @@ -10,19 +10,19 @@ namespace content { IndexedDBFakeBackingStore::~IndexedDBFakeBackingStore() {} -std::vector<string16> IndexedDBFakeBackingStore::GetDatabaseNames() { - return std::vector<string16>(); +std::vector<base::string16> IndexedDBFakeBackingStore::GetDatabaseNames() { + return std::vector<base::string16>(); } bool IndexedDBFakeBackingStore::GetIDBDatabaseMetaData( - const string16& name, + const base::string16& name, IndexedDBDatabaseMetadata*, bool* found) { return true; } bool IndexedDBFakeBackingStore::CreateIDBDatabaseMetaData( - const string16& name, - const string16& version, + const base::string16& name, + const base::string16& version, int64 int_version, int64* row_id) { return true; @@ -32,14 +32,14 @@ bool IndexedDBFakeBackingStore::UpdateIDBDatabaseIntVersion(Transaction*, int64 version) { return false; } -bool IndexedDBFakeBackingStore::DeleteDatabase(const string16& name) { +bool IndexedDBFakeBackingStore::DeleteDatabase(const base::string16& name) { return true; } bool IndexedDBFakeBackingStore::CreateObjectStore(Transaction*, int64 database_id, int64 object_store_id, - const string16& name, + const base::string16& name, const IndexedDBKeyPath&, bool auto_increment) { return false; @@ -85,7 +85,7 @@ bool IndexedDBFakeBackingStore::CreateIndex(Transaction*, int64 database_id, int64 object_store_id, int64 index_id, - const string16& name, + const base::string16& name, const IndexedDBKeyPath&, bool is_unique, bool is_multi_entry) { diff --git a/content/browser/indexed_db/indexed_db_fake_backing_store.h b/content/browser/indexed_db/indexed_db_fake_backing_store.h index 07b63de..93d047c 100644 --- a/content/browser/indexed_db/indexed_db_fake_backing_store.h +++ b/content/browser/indexed_db/indexed_db_fake_backing_store.h @@ -17,23 +17,23 @@ class IndexedDBFakeBackingStore : public IndexedDBBackingStore { : IndexedDBBackingStore(GURL("http://localhost:81"), scoped_ptr<LevelDBDatabase>(), scoped_ptr<LevelDBComparator>()) {} - virtual std::vector<string16> GetDatabaseNames() OVERRIDE; - virtual bool GetIDBDatabaseMetaData(const string16& name, + virtual std::vector<base::string16> GetDatabaseNames() OVERRIDE; + virtual bool GetIDBDatabaseMetaData(const base::string16& name, IndexedDBDatabaseMetadata*, bool* found) OVERRIDE; - virtual bool CreateIDBDatabaseMetaData(const string16& name, - const string16& version, + virtual bool CreateIDBDatabaseMetaData(const base::string16& name, + const base::string16& version, int64 int_version, int64* row_id) OVERRIDE; virtual bool UpdateIDBDatabaseIntVersion(Transaction*, int64 row_id, int64 version) OVERRIDE; - virtual bool DeleteDatabase(const string16& name) OVERRIDE; + virtual bool DeleteDatabase(const base::string16& name) OVERRIDE; virtual bool CreateObjectStore(Transaction*, int64 database_id, int64 object_store_id, - const string16& name, + const base::string16& name, const IndexedDBKeyPath&, bool auto_increment) OVERRIDE; @@ -65,7 +65,7 @@ class IndexedDBFakeBackingStore : public IndexedDBBackingStore { int64 database_id, int64 object_store_id, int64 index_id, - const string16& name, + const base::string16& name, const IndexedDBKeyPath&, bool is_unique, bool is_multi_entry) OVERRIDE; diff --git a/content/browser/indexed_db/indexed_db_index_writer.cc b/content/browser/indexed_db/indexed_db_index_writer.cc index 3b36cad..1c2ac0a 100644 --- a/content/browser/indexed_db/indexed_db_index_writer.cc +++ b/content/browser/indexed_db/indexed_db_index_writer.cc @@ -34,7 +34,7 @@ bool IndexWriter::VerifyIndexKeys( int64 index_id, bool* can_add_keys, const IndexedDBKey& primary_key, - string16* error_message) const { + base::string16* error_message) const { *can_add_keys = false; for (size_t i = 0; i < index_keys_.size(); ++i) { bool ok = AddingKeyAllowed(backing_store, @@ -122,7 +122,7 @@ bool MakeIndexWriters( const std::vector<int64>& index_ids, const std::vector<IndexedDBDatabase::IndexKeys>& index_keys, ScopedVector<IndexWriter>* index_writers, - string16* error_message, + base::string16* error_message, bool* completed) { DCHECK_EQ(index_ids.size(), index_keys.size()); *completed = false; diff --git a/content/browser/indexed_db/indexed_db_index_writer.h b/content/browser/indexed_db/indexed_db_index_writer.h index 2ea1c98..8a2cdad 100644 --- a/content/browser/indexed_db/indexed_db_index_writer.h +++ b/content/browser/indexed_db/indexed_db_index_writer.h @@ -34,7 +34,7 @@ class IndexWriter { int64 index_id, bool* can_add_keys, const IndexedDBKey& primary_key, - string16* error_message) const WARN_UNUSED_RESULT; + base::string16* error_message) const WARN_UNUSED_RESULT; void WriteIndexKeys(const IndexedDBBackingStore::RecordIdentifier& record, IndexedDBBackingStore* store, @@ -68,7 +68,7 @@ bool MakeIndexWriters( const std::vector<int64>& index_ids, const std::vector<IndexedDBDatabase::IndexKeys>& index_keys, ScopedVector<IndexWriter>* index_writers, - string16* error_message, + base::string16* error_message, bool* completed) WARN_UNUSED_RESULT; } // namespace content diff --git a/content/browser/indexed_db/indexed_db_leveldb_coding.cc b/content/browser/indexed_db/indexed_db_leveldb_coding.cc index dd3964a..fad767c 100644 --- a/content/browser/indexed_db/indexed_db_leveldb_coding.cc +++ b/content/browser/indexed_db/indexed_db_leveldb_coding.cc @@ -257,7 +257,7 @@ void EncodeVarInt(int64 value, std::string* into) { } while (n); } -void EncodeString(const string16& value, std::string* into) { +void EncodeString(const base::string16& value, std::string* into) { if (value.empty()) return; // Backing store is UTF-16BE, convert from host endianness. @@ -277,7 +277,7 @@ void EncodeBinary(const std::string& value, std::string* into) { DCHECK(into->size() >= value.size()); } -void EncodeStringWithLength(const string16& value, std::string* into) { +void EncodeStringWithLength(const base::string16& value, std::string* into) { EncodeVarInt(value.length(), into); EncodeString(value, into); } @@ -355,7 +355,7 @@ void EncodeIDBKeyPath(const IndexedDBKeyPath& value, std::string* into) { break; } case WebIDBKeyPathTypeArray: { - const std::vector<string16>& array = value.array(); + const std::vector<base::string16>& array = value.array(); size_t count = array.size(); EncodeVarInt(count, into); for (size_t i = 0; i < count; ++i) { @@ -421,7 +421,7 @@ bool DecodeVarInt(StringPiece* slice, int64* value) { return true; } -bool DecodeString(StringPiece* slice, string16* value) { +bool DecodeString(StringPiece* slice, base::string16* value) { if (slice->empty()) { value->clear(); return true; @@ -430,7 +430,7 @@ bool DecodeString(StringPiece* slice, string16* value) { // Backing store is UTF-16BE, convert to host endianness. DCHECK(!(slice->size() % sizeof(char16))); size_t length = slice->size() / sizeof(char16); - string16 decoded; + base::string16 decoded; decoded.reserve(length); const char16* encoded = reinterpret_cast<const char16*>(slice->begin()); for (unsigned i = 0; i < length; ++i) @@ -441,7 +441,7 @@ bool DecodeString(StringPiece* slice, string16* value) { return true; } -bool DecodeStringWithLength(StringPiece* slice, string16* value) { +bool DecodeStringWithLength(StringPiece* slice, base::string16* value) { if (slice->empty()) return false; @@ -510,7 +510,7 @@ bool DecodeIDBKey(StringPiece* slice, scoped_ptr<IndexedDBKey>* value) { return true; } case kIndexedDBKeyStringTypeByte: { - string16 s; + base::string16 s; if (!DecodeStringWithLength(slice, &s)) return false; *value = make_scoped_ptr(new IndexedDBKey(s)); @@ -551,7 +551,7 @@ bool DecodeIDBKeyPath(StringPiece* slice, IndexedDBKeyPath* value) { // always written as typed. if (slice->size() < 3 || (*slice)[0] != kIndexedDBKeyPathTypeCodedByte1 || (*slice)[1] != kIndexedDBKeyPathTypeCodedByte2) { - string16 s; + base::string16 s; if (!DecodeString(slice, &s)) return false; *value = IndexedDBKeyPath(s); @@ -569,7 +569,7 @@ bool DecodeIDBKeyPath(StringPiece* slice, IndexedDBKeyPath* value) { *value = IndexedDBKeyPath(); return true; case WebIDBKeyPathTypeString: { - string16 string; + base::string16 string; if (!DecodeStringWithLength(slice, &string)) return false; DCHECK(slice->empty()); @@ -577,13 +577,13 @@ bool DecodeIDBKeyPath(StringPiece* slice, IndexedDBKeyPath* value) { return true; } case WebIDBKeyPathTypeArray: { - std::vector<string16> array; + std::vector<base::string16> array; int64 count; if (!DecodeVarInt(slice, &count)) return false; DCHECK_GE(count, 0); while (count--) { - string16 string; + base::string16 string; if (!DecodeStringWithLength(slice, &string)) return false; array.push_back(string); @@ -1324,7 +1324,7 @@ bool DatabaseNameKey::Decode(StringPiece* slice, DatabaseNameKey* result) { } std::string DatabaseNameKey::Encode(const std::string& origin_identifier, - const string16& database_name) { + const base::string16& database_name) { std::string ret = KeyPrefix::EncodeEmpty(); ret.push_back(kDatabaseNameTypeByte); EncodeStringWithLength(base::ASCIIToUTF16(origin_identifier), &ret); @@ -1334,7 +1334,7 @@ std::string DatabaseNameKey::Encode(const std::string& origin_identifier, std::string DatabaseNameKey::EncodeMinKeyForOrigin( const std::string& origin_identifier) { - return Encode(origin_identifier, string16()); + return Encode(origin_identifier, base::string16()); } std::string DatabaseNameKey::EncodeStopKeyForOrigin( @@ -1604,8 +1604,9 @@ bool ObjectStoreNamesKey::Decode(StringPiece* slice, return true; } -std::string ObjectStoreNamesKey::Encode(int64 database_id, - const string16& object_store_name) { +std::string ObjectStoreNamesKey::Encode( + int64 database_id, + const base::string16& object_store_name) { KeyPrefix prefix(database_id); std::string ret = prefix.Encode(); ret.push_back(kObjectStoreNamesTypeByte); @@ -1641,7 +1642,7 @@ bool IndexNamesKey::Decode(StringPiece* slice, IndexNamesKey* result) { std::string IndexNamesKey::Encode(int64 database_id, int64 object_store_id, - const string16& index_name) { + const base::string16& index_name) { KeyPrefix prefix(database_id); std::string ret = prefix.Encode(); ret.push_back(kIndexNamesKeyTypeByte); diff --git a/content/browser/indexed_db/indexed_db_leveldb_coding.h b/content/browser/indexed_db/indexed_db_leveldb_coding.h index 8d0c780..d369af0 100644 --- a/content/browser/indexed_db/indexed_db_leveldb_coding.h +++ b/content/browser/indexed_db/indexed_db_leveldb_coding.h @@ -27,8 +27,9 @@ CONTENT_EXPORT void EncodeByte(unsigned char value, std::string* into); CONTENT_EXPORT void EncodeBool(bool value, std::string* into); CONTENT_EXPORT void EncodeInt(int64 value, std::string* into); CONTENT_EXPORT void EncodeVarInt(int64 value, std::string* into); -CONTENT_EXPORT void EncodeString(const string16& value, std::string* into); -CONTENT_EXPORT void EncodeStringWithLength(const string16& value, +CONTENT_EXPORT void EncodeString(const base::string16& value, + std::string* into); +CONTENT_EXPORT void EncodeStringWithLength(const base::string16& value, std::string* into); CONTENT_EXPORT void EncodeBinary(const std::string& value, std::string* into); CONTENT_EXPORT void EncodeDouble(double value, std::string* into); @@ -45,10 +46,10 @@ CONTENT_EXPORT WARN_UNUSED_RESULT bool DecodeInt(base::StringPiece* slice, CONTENT_EXPORT WARN_UNUSED_RESULT bool DecodeVarInt(base::StringPiece* slice, int64* value); CONTENT_EXPORT WARN_UNUSED_RESULT bool DecodeString(base::StringPiece* slice, - string16* value); + base::string16* value); CONTENT_EXPORT WARN_UNUSED_RESULT bool DecodeStringWithLength( base::StringPiece* slice, - string16* value); + base::string16* value); CONTENT_EXPORT WARN_UNUSED_RESULT bool DecodeBinary(base::StringPiece* slice, std::string* value); CONTENT_EXPORT WARN_UNUSED_RESULT bool DecodeDouble(base::StringPiece* slice, @@ -188,18 +189,19 @@ class DatabaseNameKey { public: static bool Decode(base::StringPiece* slice, DatabaseNameKey* result); CONTENT_EXPORT static std::string Encode(const std::string& origin_identifier, - const string16& database_name); + const base::string16& database_name); static std::string EncodeMinKeyForOrigin( const std::string& origin_identifier); static std::string EncodeStopKeyForOrigin( const std::string& origin_identifier); - string16 origin() const { return origin_; } - string16 database_name() const { return database_name_; } + base::string16 origin() const { return origin_; } + base::string16 database_name() const { return database_name_; } int Compare(const DatabaseNameKey& other); private: - string16 origin_; // TODO(jsbell): Store encoded strings, or just pointers. - string16 database_name_; + base::string16 origin_; // TODO(jsbell): Store encoded strings, or just + // pointers. + base::string16 database_name_; }; class DatabaseMetaDataKey { @@ -315,14 +317,15 @@ class ObjectStoreNamesKey { // because a mapping is kept in the IndexedDBDatabase. Can the // mapping become unreliable? Can we remove this? static bool Decode(base::StringPiece* slice, ObjectStoreNamesKey* result); - CONTENT_EXPORT static std::string Encode(int64 database_id, - const string16& object_store_name); + CONTENT_EXPORT static std::string Encode( + int64 database_id, + const base::string16& object_store_name); int Compare(const ObjectStoreNamesKey& other); - string16 object_store_name() const { return object_store_name_; } + base::string16 object_store_name() const { return object_store_name_; } private: // TODO(jsbell): Store the encoded string, or just pointers to it. - string16 object_store_name_; + base::string16 object_store_name_; }; class IndexNamesKey { @@ -333,13 +336,13 @@ class IndexNamesKey { static bool Decode(base::StringPiece* slice, IndexNamesKey* result); CONTENT_EXPORT static std::string Encode(int64 database_id, int64 object_store_id, - const string16& index_name); + const base::string16& index_name); int Compare(const IndexNamesKey& other); - string16 index_name() const { return index_name_; } + base::string16 index_name() const { return index_name_; } private: int64 object_store_id_; - string16 index_name_; + base::string16 index_name_; }; class ObjectStoreDataKey { diff --git a/content/browser/indexed_db/indexed_db_leveldb_coding_unittest.cc b/content/browser/indexed_db/indexed_db_leveldb_coding_unittest.cc index 6d6ab0b..e968142 100644 --- a/content/browser/indexed_db/indexed_db_leveldb_coding_unittest.cc +++ b/content/browser/indexed_db/indexed_db_leveldb_coding_unittest.cc @@ -304,7 +304,7 @@ TEST(IndexedDBLevelDBCodingTest, DecodeVarInt) { } } -static std::string WrappedEncodeString(string16 value) { +static std::string WrappedEncodeString(base::string16 value) { std::string buffer; EncodeString(value, &buffer); return buffer; @@ -321,24 +321,24 @@ TEST(IndexedDBLevelDBCodingTest, EncodeString) { EXPECT_EQ(static_cast<size_t>(6), WrappedEncodeString(ASCIIToUTF16("foo")).size()); EXPECT_EQ(static_cast<size_t>(6), - WrappedEncodeString(string16(test_string_a)).size()); + WrappedEncodeString(base::string16(test_string_a)).size()); EXPECT_EQ(static_cast<size_t>(4), - WrappedEncodeString(string16(test_string_b)).size()); + WrappedEncodeString(base::string16(test_string_b)).size()); } TEST(IndexedDBLevelDBCodingTest, DecodeString) { const char16 test_string_a[] = {'f', 'o', 'o', '\0'}; const char16 test_string_b[] = {0xdead, 0xbeef, '\0'}; - std::vector<string16> test_cases; - test_cases.push_back(string16()); + std::vector<base::string16> test_cases; + test_cases.push_back(base::string16()); test_cases.push_back(ASCIIToUTF16("a")); test_cases.push_back(ASCIIToUTF16("foo")); test_cases.push_back(test_string_a); test_cases.push_back(test_string_b); for (size_t i = 0; i < test_cases.size(); ++i) { - const string16& test_case = test_cases[i]; + const base::string16& test_case = test_cases[i]; std::string v = WrappedEncodeString(test_case); StringPiece slice; @@ -346,7 +346,7 @@ TEST(IndexedDBLevelDBCodingTest, DecodeString) { slice = StringPiece(&*v.begin(), v.size()); } - string16 result; + base::string16 result; EXPECT_TRUE(DecodeString(&slice, &result)); EXPECT_EQ(test_case, result); EXPECT_TRUE(slice.empty()); @@ -360,7 +360,7 @@ TEST(IndexedDBLevelDBCodingTest, DecodeString) { } } -static std::string WrappedEncodeStringWithLength(string16 value) { +static std::string WrappedEncodeStringWithLength(base::string16 value) { std::string buffer; EncodeStringWithLength(value, &buffer); return buffer; @@ -371,13 +371,15 @@ TEST(IndexedDBLevelDBCodingTest, EncodeStringWithLength) { const char16 test_string_b[] = {0xdead, 0xbeef, '\0'}; EXPECT_EQ(static_cast<size_t>(1), - WrappedEncodeStringWithLength(string16()).size()); + WrappedEncodeStringWithLength(base::string16()).size()); EXPECT_EQ(static_cast<size_t>(3), WrappedEncodeStringWithLength(ASCIIToUTF16("a")).size()); EXPECT_EQ(static_cast<size_t>(7), - WrappedEncodeStringWithLength(string16(test_string_a)).size()); + WrappedEncodeStringWithLength( + base::string16(test_string_a)).size()); EXPECT_EQ(static_cast<size_t>(5), - WrappedEncodeStringWithLength(string16(test_string_b)).size()); + WrappedEncodeStringWithLength( + base::string16(test_string_b)).size()); } TEST(IndexedDBLevelDBCodingTest, DecodeStringWithLength) { @@ -390,20 +392,20 @@ TEST(IndexedDBLevelDBCodingTest, DecodeStringWithLength) { long_string[i] = i; long_string[kLongStringLen] = 0; - std::vector<string16> test_cases; + std::vector<base::string16> test_cases; test_cases.push_back(ASCIIToUTF16("")); test_cases.push_back(ASCIIToUTF16("a")); test_cases.push_back(ASCIIToUTF16("foo")); - test_cases.push_back(string16(test_string_a)); - test_cases.push_back(string16(test_string_b)); - test_cases.push_back(string16(long_string)); + test_cases.push_back(base::string16(test_string_a)); + test_cases.push_back(base::string16(test_string_b)); + test_cases.push_back(base::string16(long_string)); for (size_t i = 0; i < test_cases.size(); ++i) { - string16 s = test_cases[i]; + base::string16 s = test_cases[i]; std::string v = WrappedEncodeStringWithLength(s); ASSERT_GT(v.size(), static_cast<size_t>(0)); StringPiece slice(v); - string16 res; + base::string16 res; EXPECT_TRUE(DecodeStringWithLength(&slice, &res)); EXPECT_EQ(s, res); EXPECT_TRUE(slice.empty()); @@ -444,23 +446,23 @@ TEST(IndexedDBLevelDBCodingTest, CompareEncodedStringsWithLength) { const char16 test_string_e[] = {0xd834, 0xdd1e, '\0'}; const char16 test_string_f[] = {0xfffd, '\0'}; - std::vector<string16> test_cases; + std::vector<base::string16> test_cases; test_cases.push_back(ASCIIToUTF16("")); test_cases.push_back(ASCIIToUTF16("a")); test_cases.push_back(ASCIIToUTF16("b")); test_cases.push_back(ASCIIToUTF16("baaa")); test_cases.push_back(ASCIIToUTF16("baab")); test_cases.push_back(ASCIIToUTF16("c")); - test_cases.push_back(string16(test_string_a)); - test_cases.push_back(string16(test_string_b)); - test_cases.push_back(string16(test_string_c)); - test_cases.push_back(string16(test_string_d)); - test_cases.push_back(string16(test_string_e)); - test_cases.push_back(string16(test_string_f)); + test_cases.push_back(base::string16(test_string_a)); + test_cases.push_back(base::string16(test_string_b)); + test_cases.push_back(base::string16(test_string_c)); + test_cases.push_back(base::string16(test_string_d)); + test_cases.push_back(base::string16(test_string_e)); + test_cases.push_back(base::string16(test_string_f)); for (size_t i = 0; i < test_cases.size() - 1; ++i) { - string16 a = test_cases[i]; - string16 b = test_cases[i + 1]; + base::string16 a = test_cases[i]; + base::string16 b = test_cases[i + 1]; EXPECT_LT(a.compare(b), 0); EXPECT_GT(b.compare(a), 0); @@ -630,7 +632,7 @@ TEST(IndexedDBLevelDBCodingTest, EncodeDecodeIDBKeyPath) { } { - key_paths.push_back(IndexedDBKeyPath(string16())); + key_paths.push_back(IndexedDBKeyPath(base::string16())); char expected[] = {0, 0, // Header 1, // Type is string 0 // Length is 0 @@ -661,8 +663,8 @@ TEST(IndexedDBLevelDBCodingTest, EncodeDecodeIDBKeyPath) { } { - std::vector<string16> array; - array.push_back(string16()); + std::vector<base::string16> array; + array.push_back(base::string16()); array.push_back(ASCIIToUTF16("foo")); array.push_back(ASCIIToUTF16("foo.bar")); @@ -700,7 +702,7 @@ TEST(IndexedDBLevelDBCodingTest, DecodeLegacyIDBKeyPath) { std::vector<std::string> encoded_paths; { - key_paths.push_back(IndexedDBKeyPath(string16())); + key_paths.push_back(IndexedDBKeyPath(base::string16())); encoded_paths.push_back(std::string()); } { diff --git a/content/browser/indexed_db/indexed_db_metadata.cc b/content/browser/indexed_db/indexed_db_metadata.cc index 80d3142..47b7219 100644 --- a/content/browser/indexed_db/indexed_db_metadata.cc +++ b/content/browser/indexed_db/indexed_db_metadata.cc @@ -7,7 +7,7 @@ namespace content { IndexedDBObjectStoreMetadata::IndexedDBObjectStoreMetadata( - const string16& name, + const base::string16& name, int64 id, const IndexedDBKeyPath& key_path, bool auto_increment, @@ -23,11 +23,12 @@ IndexedDBObjectStoreMetadata::~IndexedDBObjectStoreMetadata() {} IndexedDBDatabaseMetadata::IndexedDBDatabaseMetadata() : int_version(NO_INT_VERSION) {} -IndexedDBDatabaseMetadata::IndexedDBDatabaseMetadata(const string16& name, - int64 id, - const string16& version, - int64 int_version, - int64 max_object_store_id) +IndexedDBDatabaseMetadata::IndexedDBDatabaseMetadata( + const base::string16& name, + int64 id, + const base::string16& version, + int64 int_version, + int64 max_object_store_id) : name(name), id(id), version(version), diff --git a/content/browser/indexed_db/indexed_db_metadata.h b/content/browser/indexed_db/indexed_db_metadata.h index 4e8562d..00970a6 100644 --- a/content/browser/indexed_db/indexed_db_metadata.h +++ b/content/browser/indexed_db/indexed_db_metadata.h @@ -15,7 +15,7 @@ namespace content { struct IndexedDBIndexMetadata { IndexedDBIndexMetadata() {} - IndexedDBIndexMetadata(const string16& name, + IndexedDBIndexMetadata(const base::string16& name, int64 id, const IndexedDBKeyPath& key_path, bool unique, @@ -25,7 +25,7 @@ struct IndexedDBIndexMetadata { key_path(key_path), unique(unique), multi_entry(multi_entry) {} - string16 name; + base::string16 name; int64 id; IndexedDBKeyPath key_path; bool unique; @@ -36,13 +36,13 @@ struct IndexedDBIndexMetadata { struct CONTENT_EXPORT IndexedDBObjectStoreMetadata { IndexedDBObjectStoreMetadata(); - IndexedDBObjectStoreMetadata(const string16& name, + IndexedDBObjectStoreMetadata(const base::string16& name, int64 id, const IndexedDBKeyPath& key_path, bool auto_increment, int64 max_index_id); ~IndexedDBObjectStoreMetadata(); - string16 name; + base::string16 name; int64 id; IndexedDBKeyPath key_path; bool auto_increment; @@ -64,16 +64,16 @@ struct CONTENT_EXPORT IndexedDBDatabaseMetadata { typedef std::map<int64, IndexedDBObjectStoreMetadata> ObjectStoreMap; IndexedDBDatabaseMetadata(); - IndexedDBDatabaseMetadata(const string16& name, + IndexedDBDatabaseMetadata(const base::string16& name, int64 id, - const string16& version, + const base::string16& version, int64 int_version, int64 max_object_store_id); ~IndexedDBDatabaseMetadata(); - string16 name; + base::string16 name; int64 id; - string16 version; + base::string16 version; int64 int_version; int64 max_object_store_id; |