Bug 1266401 - stop constructing temporary strings in Android's appshell; r=snorp

We don't have to construct temporary strings to get at the raw
characters of a string.
This commit is contained in:
Nathan Froyd 2016-04-21 12:52:42 -04:00
Родитель 00e18217e5
Коммит 745c937285
2 изменённых файлов: 13 добавлений и 14 удалений

Просмотреть файл

@ -483,9 +483,9 @@ public:
double Z() { return mZ; }
double W() { return mW; }
const nsIntRect& Rect() { return mRect; }
nsAString& Characters() { return mCharacters; }
nsAString& CharactersExtra() { return mCharactersExtra; }
nsAString& Data() { return mData; }
nsString& Characters() { return mCharacters; }
nsString& CharactersExtra() { return mCharactersExtra; }
nsString& Data() { return mData; }
int MetaState() { return mMetaState; }
Modifiers DOMModifiers() const;
bool IsAltPressed() const { return (mMetaState & AMETA_ALT_MASK) != 0; }

Просмотреть файл

@ -730,9 +730,8 @@ nsAppShell::LegacyGeckoEvent::Run()
mozilla::services::GetObserverService();
const NS_ConvertUTF16toUTF8 topic(curEvent->Characters());
const nsPromiseFlatString& data = PromiseFlatString(curEvent->CharactersExtra());
obsServ->NotifyObservers(nullptr, topic.get(), data.get());
obsServ->NotifyObservers(nullptr, topic.get(), curEvent->CharactersExtra().get());
break;
}
@ -748,8 +747,8 @@ nsAppShell::LegacyGeckoEvent::Run()
break;
obs->StopSession(
nsString(curEvent->Characters()).get(),
nsString(curEvent->CharactersExtra()).get(),
curEvent->Characters().get(),
curEvent->CharactersExtra().get(),
curEvent->Time()
);
break;
@ -767,7 +766,7 @@ nsAppShell::LegacyGeckoEvent::Run()
break;
obs->StartSession(
nsString(curEvent->Characters()).get(),
curEvent->Characters().get(),
curEvent->Time()
);
break;
@ -785,10 +784,10 @@ nsAppShell::LegacyGeckoEvent::Run()
break;
obs->AddEvent(
nsString(curEvent->Data()).get(),
nsString(curEvent->Characters()).get(),
curEvent->Data().get(),
curEvent->Characters().get(),
curEvent->Time(),
nsString(curEvent->CharactersExtra()).get()
curEvent->CharactersExtra().get()
);
break;
}
@ -829,7 +828,7 @@ nsAppShell::LegacyGeckoEvent::Run()
nsCOMPtr<nsIURI> visitedURI;
if (history &&
NS_SUCCEEDED(NS_NewURI(getter_AddRefs(visitedURI),
nsString(curEvent->Characters())))) {
curEvent->Characters()))) {
history->NotifyVisited(visitedURI);
}
#endif
@ -884,7 +883,7 @@ nsAppShell::LegacyGeckoEvent::Run()
if (observer) {
observer->Observe(nullptr, NS_ConvertUTF16toUTF8(curEvent->CharactersExtra()).get(),
nsString(curEvent->Data()).get());
curEvent->Data().get());
} else {
ALOG("Call_Observer event: Observer was not found!");
}
@ -918,7 +917,7 @@ nsAppShell::LegacyGeckoEvent::Run()
if (os) {
os->NotifyObservers(nullptr,
NS_NETWORK_LINK_TOPIC,
nsString(curEvent->Characters()).get());
curEvent->Characters().get());
}
break;
}