Bug 1344629 - Part 6: Rewrite unnecessary uses of nsLiteralString. r=dbaron
There's an antipattern where nsLiteralString is used as an unnecessary intermediary in converting from CharT* to CharT*,
e.g. CallAFunctionThatTakesACharPointer(NS_LITERAL_CSTRING("foo").get());
or
NS_NAMED_LITERAL_STRING(foo, "abc");
CallAFunctionThatTakesACharPointer(foo.get());
This patch rewrites the callsites that can be trivially changed to use char*/char16_t*.
I'd somewhat like to remove nsTLiteralString::get() altogether, but in code that's less straightforward than these examples, get() is useful enough to keep.
MozReview-Commit-ID: Kh1rUziVllo
This commit is contained in:
@@ -5057,16 +5057,16 @@ nsWindow::ProcessMessage(UINT msg, WPARAM& wParam, LPARAM& lParam,
|
||||
// Windows won't let us do that. Bug 212316.
|
||||
nsCOMPtr<nsIObserverService> obsServ =
|
||||
mozilla::services::GetObserverService();
|
||||
NS_NAMED_LITERAL_STRING(context, "shutdown-persist");
|
||||
NS_NAMED_LITERAL_STRING(syncShutdown, "syncShutdown");
|
||||
obsServ->NotifyObservers(nullptr, "quit-application-granted", syncShutdown.get());
|
||||
const char16_t* context = u"shutdown-persist";
|
||||
const char16_t* syncShutdown = u"syncShutdown";
|
||||
obsServ->NotifyObservers(nullptr, "quit-application-granted", syncShutdown);
|
||||
obsServ->NotifyObservers(nullptr, "quit-application-forced", nullptr);
|
||||
obsServ->NotifyObservers(nullptr, "quit-application", nullptr);
|
||||
obsServ->NotifyObservers(nullptr, "profile-change-net-teardown", context.get());
|
||||
obsServ->NotifyObservers(nullptr, "profile-change-teardown", context.get());
|
||||
obsServ->NotifyObservers(nullptr, "profile-before-change", context.get());
|
||||
obsServ->NotifyObservers(nullptr, "profile-before-change-qm", context.get());
|
||||
obsServ->NotifyObservers(nullptr, "profile-before-change-telemetry", context.get());
|
||||
obsServ->NotifyObservers(nullptr, "profile-change-net-teardown", context);
|
||||
obsServ->NotifyObservers(nullptr, "profile-change-teardown", context);
|
||||
obsServ->NotifyObservers(nullptr, "profile-before-change", context);
|
||||
obsServ->NotifyObservers(nullptr, "profile-before-change-qm", context);
|
||||
obsServ->NotifyObservers(nullptr, "profile-before-change-telemetry", context);
|
||||
// Then a controlled but very quick exit.
|
||||
_exit(0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user