Bug 1307812: Re-work IsEmptyMSG() to avoid taking the address of a temporary. r=masayuki

--HG--
extra : rebase_source : 2d5c3223f56165b3059c9c75cd8ecdeef0e7ce34
This commit is contained in:
David Major 2016-10-06 09:22:18 -05:00
Родитель f30bf023b4
Коммит fcbab1c99e
2 изменённых файлов: 7 добавлений и 14 удалений

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

@ -1191,6 +1191,7 @@ VirtualKey::FillKbdState(PBYTE aKbdState,
uint8_t NativeKey::sDispatchedKeyOfAppCommand = 0;
NativeKey* NativeKey::sLatestInstance = nullptr;
const MSG NativeKey::sEmptyMSG = {};
LazyLogModule sNativeKeyLogger("NativeKeyWidgets");
@ -1200,8 +1201,8 @@ NativeKey::NativeKey(nsWindowBase* aWidget,
HKL aOverrideKeyboardLayout,
nsTArray<FakeCharMsg>* aFakeCharMsgs)
: mLastInstance(sLatestInstance)
, mRemovingMsg(EmptyMSG())
, mReceivedMsg(EmptyMSG())
, mRemovingMsg(sEmptyMSG)
, mReceivedMsg(sEmptyMSG)
, mWidget(aWidget)
, mDispatcher(aWidget->GetTextEventDispatcher())
, mMsg(aMessage)
@ -2910,7 +2911,7 @@ NativeKey::GetFollowingCharMessage(MSG& aCharMsg)
AutoRestore<MSG> saveLastRemovingMsg(mRemovingMsg);
mRemovingMsg = nextKeyMsg;
mReceivedMsg = EmptyMSG();
mReceivedMsg = sEmptyMSG;
AutoRestore<MSG> ensureToClearRecivedMsg(mReceivedMsg);
// On Metrofox, PeekMessage() sometimes returns WM_NULL even if we specify

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

@ -588,19 +588,11 @@ private:
*/
static NativeKey* sLatestInstance;
static const MSG EmptyMSG()
{
static bool sInitialized = false;
static MSG sEmptyMSG;
if (!sInitialized) {
memset(&sEmptyMSG, 0, sizeof(sEmptyMSG));
sInitialized = true;
}
return sEmptyMSG;
}
static const MSG sEmptyMSG;
static bool IsEmptyMSG(const MSG& aMSG)
{
return !memcmp(&aMSG, &EmptyMSG(), sizeof(MSG));
return !memcmp(&aMSG, &sEmptyMSG, sizeof(MSG));
}
bool IsAnotherInstanceRemovingCharMessage() const