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

Unified Diff: content/browser/dom_storage/session_storage_database.cc

Issue 2121513002: Replace string::find(prefix) == 0 pattern with base::StartsWith(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix typos Created 4 years, 5 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/content/browser/dom_storage/session_storage_database.cc b/content/browser/dom_storage/session_storage_database.cc
index 3a9457121d297554867fd5309ba3558dcfe9e76d..f3ac14da3c9d91dd2d5afa57c0191e325f769b2b 100644
--- a/content/browser/dom_storage/session_storage_database.cc
+++ b/content/browser/dom_storage/session_storage_database.cc
@@ -298,7 +298,8 @@ bool SessionStorageDatabase::ReadNamespacesAndOrigins(
std::string current_namespace_id;
for (it->Next(); it->Valid(); it->Next()) {
std::string key = it->key().ToString();
- if (key.find(namespace_prefix) != 0) {
+ if (!base::StartsWith(key, namespace_prefix,
+ base::CompareCase::SENSITIVE)) {
// Iterated past the "namespace-" keys.
break;
}
@@ -497,7 +498,8 @@ bool SessionStorageDatabase::GetAreasInNamespace(
// Skip the dummy entry "namespace-<namespaceid>-" and iterate the origins.
for (it->Next(); it->Valid(); it->Next()) {
std::string key = it->key().ToString();
- if (key.find(namespace_start_key) != 0) {
+ if (!base::StartsWith(key, namespace_start_key,
+ base::CompareCase::SENSITIVE)) {
// Iterated past the origins for this namespace.
break;
}
@@ -549,7 +551,7 @@ bool SessionStorageDatabase::DeleteAreaHelper(
if (!it->Valid())
return true;
std::string key = it->key().ToString();
- if (key.find(namespace_start_key) != 0)
+ if (!base::StartsWith(key, namespace_start_key, base::CompareCase::SENSITIVE))
batch->Delete(namespace_start_key);
return true;
}
@@ -608,7 +610,7 @@ bool SessionStorageDatabase::ReadMap(const std::string& map_id,
// Skip the dummy entry "map-<mapid>-".
for (it->Next(); it->Valid(); it->Next()) {
std::string key = it->key().ToString();
- if (key.find(map_start_key) != 0) {
+ if (!base::StartsWith(key, map_start_key, base::CompareCase::SENSITIVE)) {
// Iterated past the keys in this map.
break;
}

Powered by Google App Engine
This is Rietveld 408576698