Bug 1648010 - Replace uses of NS_LITERAL_STRING/NS_LITERAL_CSTRING macros by _ns literals. r=geckoview-reviewers,jgilbert,agi,hsivonen,froydnj

Differential Revision: https://phabricator.services.mozilla.com/D80860
This commit is contained in:
Simon Giesecke
2020-07-01 08:29:29 +00:00
parent f8f0145474
commit a69d79b6db
1219 changed files with 10215 additions and 12215 deletions

View File

@@ -29,13 +29,13 @@ extern mozilla::LazyLogModule gUrlClassifierDbServiceLog;
#define LOG_ENABLED() \
MOZ_LOG_TEST(gUrlClassifierDbServiceLog, mozilla::LogLevel::Debug)
#define STORE_DIRECTORY NS_LITERAL_CSTRING("safebrowsing")
#define TO_DELETE_DIR_SUFFIX NS_LITERAL_CSTRING("-to_delete")
#define BACKUP_DIR_SUFFIX NS_LITERAL_CSTRING("-backup")
#define UPDATING_DIR_SUFFIX NS_LITERAL_CSTRING("-updating")
#define STORE_DIRECTORY "safebrowsing"_ns
#define TO_DELETE_DIR_SUFFIX "-to_delete"_ns
#define BACKUP_DIR_SUFFIX "-backup"_ns
#define UPDATING_DIR_SUFFIX "-updating"_ns
#define V4_METADATA_SUFFIX NS_LITERAL_CSTRING(".metadata")
#define V2_METADATA_SUFFIX NS_LITERAL_CSTRING(".sbstore")
#define V4_METADATA_SUFFIX ".metadata"_ns
#define V2_METADATA_SUFFIX ".sbstore"_ns
// The amount of time, in milliseconds, that our IO thread will stay alive after
// the last event it processes.
@@ -83,7 +83,7 @@ nsresult Classifier::GetPrivateStoreDirectory(
const nsACString& aProvider, nsIFile** aPrivateStoreDirectory) {
NS_ENSURE_ARG_POINTER(aPrivateStoreDirectory);
if (!StringEndsWith(aTableName, NS_LITERAL_CSTRING("-proto"))) {
if (!StringEndsWith(aTableName, "-proto"_ns)) {
// Only V4 table names (ends with '-proto') would be stored
// to per-provider sub-directory.
nsCOMPtr<nsIFile>(aRootStoreDirectory).forget(aPrivateStoreDirectory);
@@ -137,9 +137,9 @@ Classifier::Classifier()
mUpdateInterrupted(true),
mIsClosed(false) {
// Make a lazy thread for any IO
mUpdateThread = new LazyIdleThread(
DEFAULT_THREAD_TIMEOUT_MS, NS_LITERAL_CSTRING("Classifier Update"),
LazyIdleThread::ShutdownMethod::ManualShutdown);
mUpdateThread =
new LazyIdleThread(DEFAULT_THREAD_TIMEOUT_MS, "Classifier Update"_ns,
LazyIdleThread::ShutdownMethod::ManualShutdown);
}
Classifier::~Classifier() {
@@ -224,13 +224,10 @@ nsresult Classifier::ClearLegacyFiles() {
}
nsTArray<nsLiteralCString> tables = {
NS_LITERAL_CSTRING("test-phish-simple"),
NS_LITERAL_CSTRING("test-malware-simple"),
NS_LITERAL_CSTRING("test-unwanted-simple"),
NS_LITERAL_CSTRING("test-harmful-simple"),
NS_LITERAL_CSTRING("test-track-simple"),
NS_LITERAL_CSTRING("test-trackwhite-simple"),
NS_LITERAL_CSTRING("test-block-simple"),
"test-phish-simple"_ns, "test-malware-simple"_ns,
"test-unwanted-simple"_ns, "test-harmful-simple"_ns,
"test-track-simple"_ns, "test-trackwhite-simple"_ns,
"test-block-simple"_ns,
};
const auto fnFindAndRemove = [](nsIFile* aRootDirectory,
@@ -262,10 +259,8 @@ nsresult Classifier::ClearLegacyFiles() {
for (const auto& table : tables) {
// Remove both .sbstore and .vlpse if .sbstore exists
if (fnFindAndRemove(mRootStoreDirectory,
table + NS_LITERAL_CSTRING(".sbstore"))) {
fnFindAndRemove(mRootStoreDirectory,
table + NS_LITERAL_CSTRING(".vlpset"));
if (fnFindAndRemove(mRootStoreDirectory, table + ".sbstore"_ns)) {
fnFindAndRemove(mRootStoreDirectory, table + ".vlpset"_ns);
}
}
@@ -952,8 +947,7 @@ nsresult Classifier::RegenActiveTables() {
// The extension of V2 and V4 prefix files is .vlpset
// We still check .pset here for legacy load.
nsTArray<nsCString> exts = {NS_LITERAL_CSTRING(".vlpset"),
NS_LITERAL_CSTRING(".pset")};
nsTArray<nsCString> exts = {".vlpset"_ns, ".pset"_ns};
nsTArray<nsCString> foundTables;
nsresult rv = ScanStoreDir(mRootStoreDirectory, exts, foundTables);
Unused << NS_WARN_IF(NS_FAILED(rv));
@@ -986,13 +980,10 @@ nsresult Classifier::RegenActiveTables() {
nsresult Classifier::AddMozEntries(nsTArray<nsCString>& aTables) {
nsTArray<nsLiteralCString> tables = {
NS_LITERAL_CSTRING("moztest-phish-simple"),
NS_LITERAL_CSTRING("moztest-malware-simple"),
NS_LITERAL_CSTRING("moztest-unwanted-simple"),
NS_LITERAL_CSTRING("moztest-harmful-simple"),
NS_LITERAL_CSTRING("moztest-track-simple"),
NS_LITERAL_CSTRING("moztest-trackwhite-simple"),
NS_LITERAL_CSTRING("moztest-block-simple"),
"moztest-phish-simple"_ns, "moztest-malware-simple"_ns,
"moztest-unwanted-simple"_ns, "moztest-harmful-simple"_ns,
"moztest-track-simple"_ns, "moztest-trackwhite-simple"_ns,
"moztest-block-simple"_ns,
};
for (const auto& table : tables) {
@@ -1576,7 +1567,7 @@ RefPtr<LookupCache> Classifier::GetLookupCache(const nsACString& aTable,
}
}
if (StringEndsWith(aTable, NS_LITERAL_CSTRING("-proto"))) {
if (StringEndsWith(aTable, "-proto"_ns)) {
cache = new LookupCacheV4(aTable, provider, rootStoreDirectory);
} else {
cache = new LookupCacheV2(aTable, provider, rootStoreDirectory);