diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-29 19:21:31 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-29 19:21:31 +0000 |
commit | 8275835e508fb36328dd79c338d31bbf98eadf56 (patch) | |
tree | f78d6d976f6bad03de09a82d550943068db096a3 /webkit/dom_storage | |
parent | 460d2fd0876fddb9e6a2a17cba9c70beb93dfa03 (diff) | |
download | chromium_src-8275835e508fb36328dd79c338d31bbf98eadf56.zip chromium_src-8275835e508fb36328dd79c338d31bbf98eadf56.tar.gz chromium_src-8275835e508fb36328dd79c338d31bbf98eadf56.tar.bz2 |
Replace string16 with base::string16 in src/webkit
BUG=
Review URL: https://codereview.chromium.org/13219005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@191421 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/dom_storage')
20 files changed, 117 insertions, 111 deletions
diff --git a/webkit/dom_storage/dom_storage_area.cc b/webkit/dom_storage/dom_storage_area.cc index 3700238..08bb6bf 100644 --- a/webkit/dom_storage/dom_storage_area.cc +++ b/webkit/dom_storage/dom_storage_area.cc @@ -118,15 +118,15 @@ NullableString16 DomStorageArea::Key(unsigned index) { return map_->Key(index); } -NullableString16 DomStorageArea::GetItem(const string16& key) { +NullableString16 DomStorageArea::GetItem(const base::string16& key) { if (is_shutdown_) return NullableString16(true); InitialImportIfNeeded(); return map_->GetItem(key); } -bool DomStorageArea::SetItem(const string16& key, - const string16& value, +bool DomStorageArea::SetItem(const base::string16& key, + const base::string16& value, NullableString16* old_value) { if (is_shutdown_) return false; @@ -141,7 +141,8 @@ bool DomStorageArea::SetItem(const string16& key, return success; } -bool DomStorageArea::RemoveItem(const string16& key, string16* old_value) { +bool DomStorageArea::RemoveItem(const base::string16& key, + base::string16* old_value) { if (is_shutdown_) return false; InitialImportIfNeeded(); diff --git a/webkit/dom_storage/dom_storage_area.h b/webkit/dom_storage/dom_storage_area.h index d804b41..0c0a76b 100644 --- a/webkit/dom_storage/dom_storage_area.h +++ b/webkit/dom_storage/dom_storage_area.h @@ -53,10 +53,10 @@ class WEBKIT_STORAGE_EXPORT DomStorageArea unsigned Length(); NullableString16 Key(unsigned index); - NullableString16 GetItem(const string16& key); - bool SetItem(const string16& key, const string16& value, + NullableString16 GetItem(const base::string16& key); + bool SetItem(const base::string16& key, const base::string16& value, NullableString16* old_value); - bool RemoveItem(const string16& key, string16* old_value); + bool RemoveItem(const base::string16& key, base::string16* old_value); bool Clear(); void FastClear(); diff --git a/webkit/dom_storage/dom_storage_area_unittest.cc b/webkit/dom_storage/dom_storage_area_unittest.cc index 6667312..6a051bc 100644 --- a/webkit/dom_storage/dom_storage_area_unittest.cc +++ b/webkit/dom_storage/dom_storage_area_unittest.cc @@ -32,10 +32,10 @@ class DomStorageAreaTest : public testing::Test { } const GURL kOrigin; - const string16 kKey; - const string16 kValue; - const string16 kKey2; - const string16 kValue2; + const base::string16 kKey; + const base::string16 kValue; + const base::string16 kKey2; + const base::string16 kValue2; // Method used in the CommitTasks test case. void InjectedCommitSequencingTask(DomStorageArea* area) { @@ -58,8 +58,8 @@ class DomStorageAreaTest : public testing::Test { public: VerifyChangesCommittedDatabase() {} virtual ~VerifyChangesCommittedDatabase() { - const string16 kKey(ASCIIToUTF16("key")); - const string16 kValue(ASCIIToUTF16("value")); + const base::string16 kKey(ASCIIToUTF16("key")); + const base::string16 kValue(ASCIIToUTF16("value")); ValuesMap values; ReadAllValues(&values); EXPECT_EQ(1u, values.size()); @@ -74,7 +74,7 @@ class DomStorageAreaTest : public testing::Test { TEST_F(DomStorageAreaTest, DomStorageAreaBasics) { scoped_refptr<DomStorageArea> area( new DomStorageArea(1, std::string(), kOrigin, NULL, NULL)); - string16 old_value; + base::string16 old_value; NullableString16 old_nullable_value; scoped_refptr<DomStorageArea> copy; diff --git a/webkit/dom_storage/dom_storage_cached_area.cc b/webkit/dom_storage/dom_storage_cached_area.cc index 30d6291..af5e1f4 100644 --- a/webkit/dom_storage/dom_storage_cached_area.cc +++ b/webkit/dom_storage/dom_storage_cached_area.cc @@ -34,14 +34,14 @@ NullableString16 DomStorageCachedArea::GetKey( } NullableString16 DomStorageCachedArea::GetItem( - int connection_id, const string16& key) { + int connection_id, const base::string16& key) { PrimeIfNeeded(connection_id); return map_->GetItem(key); } bool DomStorageCachedArea::SetItem( - int connection_id, const string16& key, - const string16& value, const GURL& page_url) { + int connection_id, const base::string16& key, + const base::string16& value, const GURL& page_url) { // A quick check to reject obviously overbudget items to avoid // the priming the cache. if (key.length() + value.length() > dom_storage::kPerAreaQuota) @@ -62,9 +62,9 @@ bool DomStorageCachedArea::SetItem( } void DomStorageCachedArea::RemoveItem( - int connection_id, const string16& key, const GURL& page_url) { + int connection_id, const base::string16& key, const GURL& page_url) { PrimeIfNeeded(connection_id); - string16 unused; + base::string16 unused; if (!map_->RemoveItem(key, &unused)) return; @@ -101,7 +101,8 @@ void DomStorageCachedArea::ApplyMutation( // We have to retain local additions which happened after this // clear operation from another process. - std::map<string16, int>::iterator iter = ignore_key_mutations_.begin(); + std::map<base::string16, int>::iterator iter = + ignore_key_mutations_.begin(); while (iter != ignore_key_mutations_.end()) { NullableString16 value = old->GetItem(iter->first); if (!value.is_null()) { @@ -119,7 +120,7 @@ void DomStorageCachedArea::ApplyMutation( if (new_value.is_null()) { // It's a remove item event. - string16 unused; + base::string16 unused; map_->RemoveItem(key.string(), &unused); return; } @@ -198,21 +199,23 @@ void DomStorageCachedArea::OnLoadComplete(bool success) { } void DomStorageCachedArea::OnSetItemComplete( - const string16& key, bool success) { + const base::string16& key, bool success) { if (!success) { Reset(); return; } - std::map<string16, int>::iterator found = ignore_key_mutations_.find(key); + std::map<base::string16, int>::iterator found = + ignore_key_mutations_.find(key); DCHECK(found != ignore_key_mutations_.end()); if (--found->second == 0) ignore_key_mutations_.erase(found); } void DomStorageCachedArea::OnRemoveItemComplete( - const string16& key, bool success) { + const base::string16& key, bool success) { DCHECK(success); - std::map<string16, int>::iterator found = ignore_key_mutations_.find(key); + std::map<base::string16, int>::iterator found = + ignore_key_mutations_.find(key); DCHECK(found != ignore_key_mutations_.end()); if (--found->second == 0) ignore_key_mutations_.erase(found); diff --git a/webkit/dom_storage/dom_storage_cached_area.h b/webkit/dom_storage/dom_storage_cached_area.h index ae45a9c..81e8467 100644 --- a/webkit/dom_storage/dom_storage_cached_area.h +++ b/webkit/dom_storage/dom_storage_cached_area.h @@ -35,10 +35,12 @@ class WEBKIT_STORAGE_EXPORT DomStorageCachedArea : unsigned GetLength(int connection_id); NullableString16 GetKey(int connection_id, unsigned index); - NullableString16 GetItem(int connection_id, const string16& key); - bool SetItem(int connection_id, const string16& key, const string16& value, + NullableString16 GetItem(int connection_id, const base::string16& key); + bool SetItem(int connection_id, + const base::string16& key, + const base::string16& value, const GURL& page_url); - void RemoveItem(int connection_id, const string16& key, + void RemoveItem(int connection_id, const base::string16& key, const GURL& page_url); void Clear(int connection_id, const GURL& page_url); @@ -67,16 +69,16 @@ class WEBKIT_STORAGE_EXPORT DomStorageCachedArea : // mutation events from other processes from overwriting local // changes made after the mutation. void OnLoadComplete(bool success); - void OnSetItemComplete(const string16& key, bool success); + void OnSetItemComplete(const base::string16& key, bool success); void OnClearComplete(bool success); - void OnRemoveItemComplete(const string16& key, bool success); + void OnRemoveItemComplete(const base::string16& key, bool success); - bool should_ignore_key_mutation(const string16& key) const { + bool should_ignore_key_mutation(const base::string16& key) const { return ignore_key_mutations_.find(key) != ignore_key_mutations_.end(); } bool ignore_all_mutations_; - std::map<string16, int> ignore_key_mutations_; + std::map<base::string16, int> ignore_key_mutations_; int64 namespace_id_; GURL origin_; diff --git a/webkit/dom_storage/dom_storage_cached_area_unittest.cc b/webkit/dom_storage/dom_storage_cached_area_unittest.cc index 61b3cfe..d55d73f 100644 --- a/webkit/dom_storage/dom_storage_cached_area_unittest.cc +++ b/webkit/dom_storage/dom_storage_cached_area_unittest.cc @@ -30,8 +30,8 @@ class MockProxy : public DomStorageProxy { *values = load_area_return_values_; } - virtual void SetItem(int connection_id, const string16& key, - const string16& value, const GURL& page_url, + virtual void SetItem(int connection_id, const base::string16& key, + const base::string16& value, const GURL& page_url, const CompletionCallback& callback) OVERRIDE { pending_callbacks_.push_back(callback); observed_set_item_ = true; @@ -41,7 +41,7 @@ class MockProxy : public DomStorageProxy { observed_page_url_ = page_url; } - virtual void RemoveItem(int connection_id, const string16& key, + virtual void RemoveItem(int connection_id, const base::string16& key, const GURL& page_url, const CompletionCallback& callback) OVERRIDE { pending_callbacks_.push_back(callback); @@ -93,8 +93,8 @@ class MockProxy : public DomStorageProxy { bool observed_remove_item_; bool observed_clear_area_; int observed_connection_id_; - string16 observed_key_; - string16 observed_value_; + base::string16 observed_key_; + base::string16 observed_value_; GURL observed_page_url_; private: @@ -114,8 +114,8 @@ class DomStorageCachedAreaTest : public testing::Test { const int64 kNamespaceId; const GURL kOrigin; - const string16 kKey; - const string16 kValue; + const base::string16 kKey; + const base::string16 kValue; const GURL kPageUrl; virtual void SetUp() { @@ -131,7 +131,7 @@ class DomStorageCachedAreaTest : public testing::Test { } bool IsIgnoringKeyMutations(DomStorageCachedArea* cached_area, - const string16& key) { + const base::string16& key) { return cached_area->should_ignore_key_mutation(key); } diff --git a/webkit/dom_storage/dom_storage_context.cc b/webkit/dom_storage/dom_storage_context.cc index 45aae74..8065ec6 100644 --- a/webkit/dom_storage/dom_storage_context.cc +++ b/webkit/dom_storage/dom_storage_context.cc @@ -210,8 +210,8 @@ void DomStorageContext::RemoveEventObserver(EventObserver* observer) { void DomStorageContext::NotifyItemSet( const DomStorageArea* area, - const string16& key, - const string16& new_value, + const base::string16& key, + const base::string16& new_value, const NullableString16& old_value, const GURL& page_url) { FOR_EACH_OBSERVER( @@ -221,8 +221,8 @@ void DomStorageContext::NotifyItemSet( void DomStorageContext::NotifyItemRemoved( const DomStorageArea* area, - const string16& key, - const string16& old_value, + const base::string16& key, + const base::string16& old_value, const GURL& page_url) { FOR_EACH_OBSERVER( EventObserver, event_observers_, diff --git a/webkit/dom_storage/dom_storage_context.h b/webkit/dom_storage/dom_storage_context.h index 20ae0ed..33ae2c5 100644 --- a/webkit/dom_storage/dom_storage_context.h +++ b/webkit/dom_storage/dom_storage_context.h @@ -68,14 +68,14 @@ class WEBKIT_STORAGE_EXPORT DomStorageContext public: virtual void OnDomStorageItemSet( const DomStorageArea* area, - const string16& key, - const string16& new_value, + const base::string16& key, + const base::string16& new_value, const NullableString16& old_value, // may be null on initial insert const GURL& page_url) = 0; virtual void OnDomStorageItemRemoved( const DomStorageArea* area, - const string16& key, - const string16& old_value, + const base::string16& key, + const base::string16& old_value, const GURL& page_url) = 0; virtual void OnDomStorageAreaCleared( const DomStorageArea* area, @@ -131,14 +131,14 @@ class WEBKIT_STORAGE_EXPORT DomStorageContext void RemoveEventObserver(EventObserver* observer); void NotifyItemSet( const DomStorageArea* area, - const string16& key, - const string16& new_value, + const base::string16& key, + const base::string16& new_value, const NullableString16& old_value, const GURL& page_url); void NotifyItemRemoved( const DomStorageArea* area, - const string16& key, - const string16& old_value, + const base::string16& key, + const base::string16& old_value, const GURL& page_url); void NotifyAreaCleared( const DomStorageArea* area, diff --git a/webkit/dom_storage/dom_storage_context_unittest.cc b/webkit/dom_storage/dom_storage_context_unittest.cc index f2bebc1..ec1d910 100644 --- a/webkit/dom_storage/dom_storage_context_unittest.cc +++ b/webkit/dom_storage/dom_storage_context_unittest.cc @@ -31,8 +31,8 @@ class DomStorageContextTest : public testing::Test { } const GURL kOrigin; - const string16 kKey; - const string16 kValue; + const base::string16 kKey; + const base::string16 kValue; const bool kDontIncludeFileInfo; const bool kDoIncludeFileInfo; @@ -205,8 +205,8 @@ TEST_F(DomStorageContextTest, DeleteSessionStorage) { DomStorageNamespace* dom_namespace = context_->GetStorageNamespace(kSessionStorageNamespaceId); DomStorageArea* area = dom_namespace->OpenStorageArea(kOrigin); - const string16 kKey(ASCIIToUTF16("foo")); - const string16 kValue(ASCIIToUTF16("bar")); + const base::string16 kKey(ASCIIToUTF16("foo")); + const base::string16 kValue(ASCIIToUTF16("bar")); NullableString16 old_nullable_value; area->SetItem(kKey, kValue, &old_nullable_value); dom_namespace->CloseStorageArea(area); diff --git a/webkit/dom_storage/dom_storage_database.cc b/webkit/dom_storage/dom_storage_database.cc index a49e93b..85f4218 100644 --- a/webkit/dom_storage/dom_storage_database.cc +++ b/webkit/dom_storage/dom_storage_database.cc @@ -72,8 +72,8 @@ void DomStorageDatabase::ReadAllValues(ValuesMap* result) { DCHECK(statement.is_valid()); while (statement.Step()) { - string16 key = statement.ColumnString16(0); - string16 value; + base::string16 key = statement.ColumnString16(0); + base::string16 value; statement.ColumnBlobAsString16(1, &value); (*result)[key] = NullableString16(value, false); } @@ -105,7 +105,7 @@ bool DomStorageDatabase::CommitChanges(bool clear_all_first, ValuesMap::const_iterator it = changes.begin(); for(; it != changes.end(); ++it) { sql::Statement statement; - string16 key = it->first; + base::string16 key = it->first; NullableString16 value = it->second; if (value.is_null()) { statement.Assign(db_->GetCachedStatement(SQL_FROM_HERE, @@ -284,7 +284,7 @@ bool DomStorageDatabase::UpgradeVersion1To2() { // the data into the new V2 table. ValuesMap values; while (statement.Step()) { - string16 key = statement.ColumnString16(0); + base::string16 key = statement.ColumnString16(0); NullableString16 value(statement.ColumnString16(1), false); values[key] = value; } diff --git a/webkit/dom_storage/dom_storage_database_unittest.cc b/webkit/dom_storage/dom_storage_database_unittest.cc index 7e50cc7..e39f5f7 100644 --- a/webkit/dom_storage/dom_storage_database_unittest.cc +++ b/webkit/dom_storage/dom_storage_database_unittest.cc @@ -54,8 +54,8 @@ void CreateInvalidValueColumnTable(sql::Connection* db) { } void InsertDataV1(sql::Connection* db, - const string16& key, - const string16& value) { + const base::string16& key, + const base::string16& value) { sql::Statement statement(db->GetCachedStatement(SQL_FROM_HERE, "INSERT INTO ItemTable VALUES (?,?)")); statement.BindString16(0, key); @@ -72,7 +72,7 @@ void CheckValuesMatch(DomStorageDatabase* db, ValuesMap::const_iterator it = values_read.begin(); for (; it != values_read.end(); ++it) { - string16 key = it->first; + base::string16 key = it->first; NullableString16 value = it->second; NullableString16 expected_value = expected.find(key)->second; EXPECT_EQ(expected_value.string(), value.string()); @@ -81,7 +81,7 @@ void CheckValuesMatch(DomStorageDatabase* db, } void CreateMapWithValues(ValuesMap* values) { - string16 kCannedKeys[] = { + base::string16 kCannedKeys[] = { ASCIIToUTF16("test"), ASCIIToUTF16("company"), ASCIIToUTF16("date"), @@ -91,7 +91,7 @@ void CreateMapWithValues(ValuesMap* values) { NullableString16(ASCIIToUTF16("123"), false), NullableString16(ASCIIToUTF16("Google"), false), NullableString16(ASCIIToUTF16("18-01-2012"), false), - NullableString16(string16(), false) + NullableString16(base::string16(), false) }; for (unsigned i = 0; i < sizeof(kCannedKeys) / sizeof(kCannedKeys[0]); i++) (*values)[kCannedKeys[i]] = kCannedValues[i]; @@ -259,7 +259,7 @@ TEST(DomStorageDatabaseTest, WriteWithClear) { } TEST(DomStorageDatabaseTest, UpgradeFromV1ToV2WithData) { - const string16 kCannedKey = ASCIIToUTF16("foo"); + const base::string16 kCannedKey = ASCIIToUTF16("foo"); const NullableString16 kCannedValue(ASCIIToUTF16("bar"), false); ValuesMap expected; expected[kCannedKey] = kCannedValue; @@ -281,7 +281,7 @@ TEST(DomStorageDatabaseTest, TestSimpleRemoveOneValue) { DomStorageDatabase db; ASSERT_TRUE(db.LazyOpen(true)); - const string16 kCannedKey = ASCIIToUTF16("test"); + const base::string16 kCannedKey = ASCIIToUTF16("test"); const NullableString16 kCannedValue(ASCIIToUTF16("data"), false); ValuesMap expected; expected[kCannedKey] = kCannedValue; diff --git a/webkit/dom_storage/dom_storage_host.cc b/webkit/dom_storage/dom_storage_host.cc index ca0ac80..a8637e0 100644 --- a/webkit/dom_storage/dom_storage_host.cc +++ b/webkit/dom_storage/dom_storage_host.cc @@ -80,7 +80,7 @@ NullableString16 DomStorageHost::GetAreaKey(int connection_id, unsigned index) { } NullableString16 DomStorageHost::GetAreaItem(int connection_id, - const string16& key) { + const base::string16& key) { DomStorageArea* area = GetOpenArea(connection_id); if (!area) return NullableString16(true); @@ -88,8 +88,8 @@ NullableString16 DomStorageHost::GetAreaItem(int connection_id, } bool DomStorageHost::SetAreaItem( - int connection_id, const string16& key, - const string16& value, const GURL& page_url, + int connection_id, const base::string16& key, + const base::string16& value, const GURL& page_url, NullableString16* old_value) { DomStorageArea* area = GetOpenArea(connection_id); if (!area) { @@ -106,8 +106,8 @@ bool DomStorageHost::SetAreaItem( } bool DomStorageHost::RemoveAreaItem( - int connection_id, const string16& key, const GURL& page_url, - string16* old_value) { + int connection_id, const base::string16& key, const GURL& page_url, + base::string16* old_value) { DomStorageArea* area = GetOpenArea(connection_id); if (!area) return false; diff --git a/webkit/dom_storage/dom_storage_host.h b/webkit/dom_storage/dom_storage_host.h index 54a18a4..ccdfab3 100644 --- a/webkit/dom_storage/dom_storage_host.h +++ b/webkit/dom_storage/dom_storage_host.h @@ -38,13 +38,13 @@ class WEBKIT_STORAGE_EXPORT DomStorageHost { bool ExtractAreaValues(int connection_id, ValuesMap* map); unsigned GetAreaLength(int connection_id); NullableString16 GetAreaKey(int connection_id, unsigned index); - NullableString16 GetAreaItem(int connection_id, const string16& key); - bool SetAreaItem(int connection_id, const string16& key, - const string16& value, const GURL& page_url, + NullableString16 GetAreaItem(int connection_id, const base::string16& key); + bool SetAreaItem(int connection_id, const base::string16& key, + const base::string16& value, const GURL& page_url, NullableString16* old_value); - bool RemoveAreaItem(int connection_id, const string16& key, + bool RemoveAreaItem(int connection_id, const base::string16& key, const GURL& page_url, - string16* old_value); + base::string16* old_value); bool ClearArea(int connection_id, const GURL& page_url); bool HasAreaOpen(int namespace_id, const GURL& origin) const; diff --git a/webkit/dom_storage/dom_storage_map.cc b/webkit/dom_storage/dom_storage_map.cc index 6c086b6..fa8eb09 100644 --- a/webkit/dom_storage/dom_storage_map.cc +++ b/webkit/dom_storage/dom_storage_map.cc @@ -8,7 +8,7 @@ namespace { -size_t size_of_item(const string16& key, const string16& value) { +size_t size_of_item(const base::string16& key, const base::string16& value) { return (key.length() + value.length()) * sizeof(char16); } @@ -54,7 +54,7 @@ NullableString16 DomStorageMap::Key(unsigned index) { return NullableString16(key_iterator_->first, false); } -NullableString16 DomStorageMap::GetItem(const string16& key) const { +NullableString16 DomStorageMap::GetItem(const base::string16& key) const { ValuesMap::const_iterator found = values_.find(key); if (found == values_.end()) return NullableString16(true); @@ -62,7 +62,7 @@ NullableString16 DomStorageMap::GetItem(const string16& key) const { } bool DomStorageMap::SetItem( - const string16& key, const string16& value, + const base::string16& key, const base::string16& value, NullableString16* old_value) { ValuesMap::const_iterator found = values_.find(key); if (found == values_.end()) @@ -87,8 +87,8 @@ bool DomStorageMap::SetItem( } bool DomStorageMap::RemoveItem( - const string16& key, - string16* old_value) { + const base::string16& key, + base::string16* old_value) { ValuesMap::iterator found = values_.find(key); if (found == values_.end()) return false; diff --git a/webkit/dom_storage/dom_storage_map.h b/webkit/dom_storage/dom_storage_map.h index 3a1d6f8..97d704e 100644 --- a/webkit/dom_storage/dom_storage_map.h +++ b/webkit/dom_storage/dom_storage_map.h @@ -25,10 +25,10 @@ class WEBKIT_STORAGE_EXPORT DomStorageMap unsigned Length() const; NullableString16 Key(unsigned index); - NullableString16 GetItem(const string16& key) const; - bool SetItem(const string16& key, const string16& value, + NullableString16 GetItem(const base::string16& key) const; + bool SetItem(const base::string16& key, const base::string16& value, NullableString16* old_value); - bool RemoveItem(const string16& key, string16* old_value); + bool RemoveItem(const base::string16& key, base::string16* old_value); // Swaps this instances values_ with |map|. // Note: to grandfather in pre-existing files that are overbudget, diff --git a/webkit/dom_storage/dom_storage_map_unittest.cc b/webkit/dom_storage/dom_storage_map_unittest.cc index 89edbc3..8339a54 100644 --- a/webkit/dom_storage/dom_storage_map_unittest.cc +++ b/webkit/dom_storage/dom_storage_map_unittest.cc @@ -9,20 +9,20 @@ namespace dom_storage { TEST(DomStorageMapTest, DomStorageMapBasics) { - const string16 kKey(ASCIIToUTF16("key")); - const string16 kValue(ASCIIToUTF16("value")); + const base::string16 kKey(ASCIIToUTF16("key")); + const base::string16 kValue(ASCIIToUTF16("value")); const size_t kValueBytes = kValue.size() * sizeof(char16); const size_t kItemBytes = (kKey.size() + kValue.size()) * sizeof(char16); - const string16 kKey2(ASCIIToUTF16("key2")); + const base::string16 kKey2(ASCIIToUTF16("key2")); const size_t kKey2Bytes = kKey2.size() * sizeof(char16); - const string16 kValue2(ASCIIToUTF16("value2")); + const base::string16 kValue2(ASCIIToUTF16("value2")); const size_t kItem2Bytes = (kKey2.size() + kValue2.size()) * sizeof(char16); const size_t kQuota = 1024; // 1K quota for this test. scoped_refptr<DomStorageMap> map(new DomStorageMap(kQuota)); - string16 old_value; + base::string16 old_value; NullableString16 old_nullable_value; ValuesMap swap; scoped_refptr<DomStorageMap> copy; @@ -83,15 +83,15 @@ TEST(DomStorageMapTest, DomStorageMapBasics) { } TEST(DomStorageMapTest, EnforcesQuota) { - const string16 kKey = ASCIIToUTF16("test_key"); - const string16 kValue = ASCIIToUTF16("test_value"); - const string16 kKey2 = ASCIIToUTF16("test_key_2"); + const base::string16 kKey = ASCIIToUTF16("test_key"); + const base::string16 kValue = ASCIIToUTF16("test_value"); + const base::string16 kKey2 = ASCIIToUTF16("test_key_2"); // A 50 byte quota is too small to hold both keys, so we // should see the DomStorageMap enforcing it. const size_t kQuota = 50; - string16 old_value; + base::string16 old_value; NullableString16 old_nullable_value; scoped_refptr<DomStorageMap> map(new DomStorageMap(kQuota)); @@ -115,9 +115,9 @@ TEST(DomStorageMapTest, EnforcesQuota) { // When overbudget, a new value of greater size than the existing value can // not be set, but a new value of lesser or equal size can be set. EXPECT_TRUE(map->SetItem(kKey, kValue, &old_nullable_value)); - EXPECT_FALSE(map->SetItem(kKey, string16(kValue + kValue), + EXPECT_FALSE(map->SetItem(kKey, base::string16(kValue + kValue), &old_nullable_value)); - EXPECT_TRUE(map->SetItem(kKey, string16(), &old_nullable_value)); + EXPECT_TRUE(map->SetItem(kKey, base::string16(), &old_nullable_value)); EXPECT_EQ(kValue, old_nullable_value.string()); } diff --git a/webkit/dom_storage/dom_storage_proxy.h b/webkit/dom_storage/dom_storage_proxy.h index 867d3bb..9091ca2 100644 --- a/webkit/dom_storage/dom_storage_proxy.h +++ b/webkit/dom_storage/dom_storage_proxy.h @@ -22,11 +22,11 @@ class DomStorageProxy : public base::RefCounted<DomStorageProxy> { virtual void LoadArea(int connection_id, ValuesMap* values, const CompletionCallback& callback) = 0; - virtual void SetItem(int connection_id, const string16& key, - const string16& value, const GURL& page_url, + virtual void SetItem(int connection_id, const base::string16& key, + const base::string16& value, const GURL& page_url, const CompletionCallback& callback) = 0; - virtual void RemoveItem(int connection_id, const string16& key, + virtual void RemoveItem(int connection_id, const base::string16& key, const GURL& page_url, const CompletionCallback& callback) = 0; diff --git a/webkit/dom_storage/dom_storage_types.h b/webkit/dom_storage/dom_storage_types.h index 180fb80..1f663b4 100644 --- a/webkit/dom_storage/dom_storage_types.h +++ b/webkit/dom_storage/dom_storage_types.h @@ -35,7 +35,7 @@ const int64 kInvalidSessionStorageNamespaceId = kLocalStorageNamespaceId; // Value to indicate an area that not be opened. const int kInvalidAreaId = -1; -typedef std::map<string16, NullableString16> ValuesMap; +typedef std::map<base::string16, NullableString16> ValuesMap; struct WEBKIT_STORAGE_EXPORT LocalStorageUsageInfo { GURL origin; diff --git a/webkit/dom_storage/session_storage_database.cc b/webkit/dom_storage/session_storage_database.cc index 2e873d7..699221f 100644 --- a/webkit/dom_storage/session_storage_database.cc +++ b/webkit/dom_storage/session_storage_database.cc @@ -521,16 +521,16 @@ bool SessionStorageDatabase::ReadMap(const std::string& map_id, break; } // Key is of the form "map-<mapid>-<key>". - string16 key16 = UTF8ToUTF16(key.substr(map_start_key.length())); + base::string16 key16 = UTF8ToUTF16(key.substr(map_start_key.length())); if (only_keys) { (*result)[key16] = NullableString16(true); } else { // Convert the raw data stored in std::string (it->value()) to raw data - // stored in string16. + // stored in base::string16. size_t len = it->value().size() / sizeof(char16); const char16* data_ptr = reinterpret_cast<const char16*>(it->value().data()); - (*result)[key16] = NullableString16(string16(data_ptr, len), false); + (*result)[key16] = NullableString16(base::string16(data_ptr, len), false); } } return true; @@ -546,7 +546,7 @@ void SessionStorageDatabase::WriteValuesToMap(const std::string& map_id, if (value.is_null()) { batch->Delete(key); } else { - // Convert the raw data stored in string16 to raw data stored in + // Convert the raw data stored in base::string16 to raw data stored in // std::string. const char* data = reinterpret_cast<const char*>(value.string().data()); size_t size = value.string().size() * 2; diff --git a/webkit/dom_storage/session_storage_database_unittest.cc b/webkit/dom_storage/session_storage_database_unittest.cc index d570f3f6..414d7d4 100644 --- a/webkit/dom_storage/session_storage_database_unittest.cc +++ b/webkit/dom_storage/session_storage_database_unittest.cc @@ -68,9 +68,9 @@ class SessionStorageDatabaseTest : public testing::Test { const std::string kNamespace1; const std::string kNamespace2; const std::string kNamespaceClone; - const string16 kKey1; - const string16 kKey2; - const string16 kKey3; + const base::string16 kKey1; + const base::string16 kKey2; + const base::string16 kKey3; const NullableString16 kValue1; const NullableString16 kValue2; const NullableString16 kValue3; @@ -302,8 +302,8 @@ void SessionStorageDatabaseTest::DumpData() const { for (it->SeekToFirst(); it->Valid(); it->Next()) { int64 dummy_map_id; if (IsMapValueKey(it->key().ToString(), &dummy_map_id)) { - // Convert the value back to string16. - string16 value; + // Convert the value back to base::string16. + base::string16 value; size_t len = it->value().size() / sizeof(char16); value.resize(len); value.assign(reinterpret_cast<const char16*>(it->value().data()), len); @@ -328,7 +328,7 @@ void SessionStorageDatabaseTest::CompareValuesMaps( const ValuesMap& map2) const { ASSERT_EQ(map2.size(), map1.size()); for (ValuesMap::const_iterator it = map1.begin(); it != map1.end(); ++it) { - string16 key = it->first; + base::string16 key = it->first; ASSERT_TRUE(map2.find(key) != map2.end()); NullableString16 val1 = it->second; NullableString16 val2 = map2.find(key)->second; @@ -698,7 +698,7 @@ TEST_F(SessionStorageDatabaseTest, WriteRawBytes) { // Write data which is not valid utf8 and contains null bytes. unsigned char raw_data[10] = {255, 0, 0, 0, 1, 2, 3, 4, 5, 0}; ValuesMap changes; - string16 string_with_raw_data; + base::string16 string_with_raw_data; string_with_raw_data.assign(reinterpret_cast<char16*>(raw_data), 5); changes[kKey1] = NullableString16(string_with_raw_data, false); EXPECT_TRUE(db_->CommitAreaChanges(kNamespace1, kOrigin1, false, changes)); |