Bug 784739 - Switch from NULL to nullptr in ipc/glue/. r=ehsan
authorBirunthan Mohanathas <birunthan@mohanathas.com>
Fri, 23 Aug 2013 15:51:58 -0400
changeset 157993 21f216a5e2f1bffee31b16558dc2fad1d5f2760e
parent 157992 b25a650ea03250fd143962d1398eb3716a8a984d
child 157994 4d3ad5e15b8c235532264c5d4a5c95a9f8f8d35f
push id407
push userlsblakk@mozilla.com
push dateTue, 03 Dec 2013 03:32:50 +0000
treeherdermozilla-release@babf8c9ebc52 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs784739
milestone26.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 784739 - Switch from NULL to nullptr in ipc/glue/. r=ehsan
ipc/glue/AsyncChannel.cpp
ipc/glue/BrowserProcessSubThread.cpp
ipc/glue/CrossProcessMutex_windows.cpp
ipc/glue/IPCMessageUtils.h
ipc/glue/ProcessChild.cpp
ipc/glue/Shmem.h
ipc/glue/SyncChannel.cpp
ipc/glue/WindowsMessageLoop.cpp
--- a/ipc/glue/AsyncChannel.cpp
+++ b/ipc/glue/AsyncChannel.cpp
@@ -85,17 +85,17 @@ AsyncChannel::Link::Link(AsyncChannel *a
 
 AsyncChannel::Link::~Link()
 {
     mChan = 0;
 }
 
 AsyncChannel::ProcessLink::ProcessLink(AsyncChannel *aChan)
     : Link(aChan)
-    , mExistingListener(NULL)
+    , mExistingListener(nullptr)
 {
 }
 
 AsyncChannel::ProcessLink::~ProcessLink()
 {
     mIOLoop = 0;
     if (mTransport) {
         mTransport->set_listener(0);
@@ -284,18 +284,18 @@ AsyncChannel::ThreadLink::Unsound_NumQue
     return 0;
 }
 
 AsyncChannel::AsyncChannel(AsyncListener* aListener)
   : mListener(aListener->asWeakPtr()),
     mChannelState(ChannelClosed),
     mWorkerLoop(),
     mChild(false),
-    mChannelErrorTask(NULL),
-    mLink(NULL),
+    mChannelErrorTask(nullptr),
+    mLink(nullptr),
     mWorkerLoopID(-1)
 {
     MOZ_COUNT_CTOR(AsyncChannel);
 }
 
 AsyncChannel::~AsyncChannel()
 {
     MOZ_COUNT_DTOR(AsyncChannel);
@@ -520,17 +520,17 @@ AsyncChannel::SendSpecialMessage(Message
 }
 
 void
 AsyncChannel::OnNotifyMaybeChannelError()
 {
     AssertWorkerThread();
     mMonitor->AssertNotCurrentThreadOwns();
 
-    mChannelErrorTask = NULL;
+    mChannelErrorTask = nullptr;
 
     // OnChannelError holds mMonitor when it posts this task and this
     // task cannot be allowed to run until OnChannelError has
     // exited. We enforce that order by grabbing the mutex here which
     // should only continue once OnChannelError has completed.
     {
         MonitorAutoLock lock(*mMonitor);
         // nothing to do here
@@ -599,17 +599,17 @@ AsyncChannel::Clear()
 
     mWorkerLoop = 0;
 
     delete mLink;
     mLink = 0;
 
     if (mChannelErrorTask) {
         mChannelErrorTask->Cancel();
-        mChannelErrorTask = NULL;
+        mChannelErrorTask = nullptr;
     }
 }
 
 static void
 PrintErrorMessage(bool isChild, const char* channelName, const char* msg)
 {
     printf_stderr("\n###!!! [%s][%s] Error: %s\n\n",
                   isChild ? "Child" : "Parent", channelName, msg);
--- a/ipc/glue/BrowserProcessSubThread.cpp
+++ b/ipc/glue/BrowserProcessSubThread.cpp
@@ -27,60 +27,60 @@ static const char* kBrowserThreadNames[B
 //  "Chrome_HistoryThread",  // HISTORY
 #if defined(OS_LINUX)
   "Gecko_Background_X11Thread",  // BACKGROUND_X11
 #endif
 };
 
 Lock BrowserProcessSubThread::sLock;
 BrowserProcessSubThread* BrowserProcessSubThread::sBrowserThreads[ID_COUNT] = {
-  NULL,  // IO
-//  NULL,  // FILE
-//  NULL,  // DB
-//  NULL,  // HISTORY
+  nullptr,  // IO
+//  nullptr,  // FILE
+//  nullptr,  // DB
+//  nullptr,  // HISTORY
 #if defined(OS_LINUX)
-  NULL,  // BACKGROUND_X11
+  nullptr,  // BACKGROUND_X11
 #endif
 };
 
 BrowserProcessSubThread::BrowserProcessSubThread(ID aId) :
   base::Thread(kBrowserThreadNames[aId]),
   mIdentifier(aId),
-  mNotificationService(NULL)
+  mNotificationService(nullptr)
 {
   AutoLock lock(sLock);
   DCHECK(aId >= 0 && aId < ID_COUNT);
-  DCHECK(sBrowserThreads[aId] == NULL);
+  DCHECK(sBrowserThreads[aId] == nullptr);
   sBrowserThreads[aId] = this;
 }
 
 BrowserProcessSubThread::~BrowserProcessSubThread()
 {
   Stop();
   {AutoLock lock(sLock);
-    sBrowserThreads[mIdentifier] = NULL;
+    sBrowserThreads[mIdentifier] = nullptr;
   }
 
 }
 
 void
 BrowserProcessSubThread::Init()
 {
 #if defined(OS_WIN)
   // Initializes the COM library on the current thread.
-  CoInitialize(NULL);
+  CoInitialize(nullptr);
 #endif
   mNotificationService = new NotificationService();
 }
 
 void
 BrowserProcessSubThread::CleanUp()
 {
   delete mNotificationService;
-  mNotificationService = NULL;
+  mNotificationService = nullptr;
 
 #if defined(OS_WIN)
   // Closes the COM library on the current thread. CoInitialize must
   // be balanced by a corresponding call to CoUninitialize.
   CoUninitialize();
 #endif
 }
 
@@ -89,13 +89,13 @@ MessageLoop*
 BrowserProcessSubThread::GetMessageLoop(ID aId)
 {
   AutoLock lock(sLock);
   DCHECK(aId >= 0 && aId < ID_COUNT);
 
   if (sBrowserThreads[aId])
     return sBrowserThreads[aId]->message_loop();
 
-  return NULL;
+  return nullptr;
 }
 
 } // namespace ipc
 } // namespace mozilla
--- a/ipc/glue/CrossProcessMutex_windows.cpp
+++ b/ipc/glue/CrossProcessMutex_windows.cpp
@@ -14,17 +14,17 @@ using namespace base;
 
 namespace mozilla {
 
 CrossProcessMutex::CrossProcessMutex(const char*)
 {
   // We explicitly share this using DuplicateHandle, we do -not- want this to
   // be inherited by child processes by default! So no security attributes are
   // given.
-  mMutex = ::CreateMutexA(NULL, FALSE, NULL);
+  mMutex = ::CreateMutexA(nullptr, FALSE, nullptr);
   if (!mMutex) {
     NS_RUNTIMEABORT("This shouldn't happen - failed to create mutex!");
   }
   MOZ_COUNT_CTOR(CrossProcessMutex);
 }
 
 CrossProcessMutex::CrossProcessMutex(CrossProcessMutexHandle aHandle)
 {
@@ -61,15 +61,15 @@ CrossProcessMutexHandle
 CrossProcessMutex::ShareToProcess(ProcessHandle aHandle)
 {
   HANDLE newHandle;
   bool succeeded = ::DuplicateHandle(GetCurrentProcessHandle(),
                                      mMutex, aHandle, &newHandle,
                                      0, FALSE, DUPLICATE_SAME_ACCESS);
 
   if (!succeeded) {
-    return NULL;
+    return nullptr;
   }
 
   return newHandle;
 }
 
 }
--- a/ipc/glue/IPCMessageUtils.h
+++ b/ipc/glue/IPCMessageUtils.h
@@ -205,17 +205,17 @@ struct ParamTraits<nsACString>
   typedef nsACString paramType;
 
   static void Write(Message* aMsg, const paramType& aParam)
   {
     bool isVoid = aParam.IsVoid();
     aMsg->WriteBool(isVoid);
 
     if (isVoid)
-      // represents a NULL pointer
+      // represents a nullptr pointer
       return;
 
     uint32_t length = aParam.Length();
     WriteParam(aMsg, length);
     aMsg->WriteBytes(aParam.BeginReading(), length);
   }
 
   static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
@@ -255,17 +255,17 @@ struct ParamTraits<nsAString>
   typedef nsAString paramType;
 
   static void Write(Message* aMsg, const paramType& aParam)
   {
     bool isVoid = aParam.IsVoid();
     aMsg->WriteBool(isVoid);
 
     if (isVoid)
-      // represents a NULL pointer
+      // represents a nullptr pointer
       return;
 
     uint32_t length = aParam.Length();
     WriteParam(aMsg, length);
     aMsg->WriteBytes(aParam.BeginReading(), length * sizeof(PRUnichar));
   }
 
   static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
@@ -576,17 +576,17 @@ struct ParamTraits<mozilla::SerializedSt
       const char** buffer =
         const_cast<const char**>(reinterpret_cast<char**>(&aResult->data));
       // Structured clone data must be 64-bit aligned.
       if (!aMsg->ReadBytes(aIter, buffer, aResult->dataLength,
                            sizeof(uint64_t))) {
         return false;
       }
     } else {
-      aResult->data = NULL;
+      aResult->data = nullptr;
     }
 
     return true;
   }
 
   static void Log(const paramType& aParam, std::wstring* aLog)
   {
     LogParam(aParam.dataLength, aLog);
--- a/ipc/glue/ProcessChild.cpp
+++ b/ipc/glue/ProcessChild.cpp
@@ -22,13 +22,13 @@ ProcessChild::ProcessChild(ProcessHandle
 {
   NS_ABORT_IF_FALSE(mUILoop, "UILoop should be created by now");
   NS_ABORT_IF_FALSE(!gProcessChild, "should only be one ProcessChild");
   gProcessChild = this;
 }
 
 ProcessChild::~ProcessChild()
 {
-  gProcessChild = NULL;
+  gProcessChild = nullptr;
 }
 
 } // namespace ipc
 } // namespace mozilla
--- a/ipc/glue/Shmem.h
+++ b/ipc/glue/Shmem.h
@@ -125,25 +125,25 @@ public:
     return mSegment == aRhs.mSegment && mId == aRhs.mId;
   }
 
   // Returns whether this Shmem is writable by you, and thus whether you can
   // transfer writability to another actor.
   bool
   IsWritable() const
   {
-    return mSegment != NULL;
+    return mSegment != nullptr;
   }
 
   // Returns whether this Shmem is readable by you, and thus whether you can
   // transfer readability to another actor.
   bool
   IsReadable() const
   {
-    return mSegment != NULL;
+    return mSegment != nullptr;
   }
 
   // Return a pointer to the user-visible data segment.
   template<typename T>
   T*
   get() const
   {
     AssertInvariants();
@@ -198,26 +198,26 @@ public:
         size_t aNBytes,
         SharedMemoryType aType,
         bool aUnsafe,
         bool aProtect=false);
 
   // Prepare this to be shared with |aProcess|.  Return an IPC message
   // that contains enough information for the other process to map
   // this segment in OpenExisting() below.  Return a new message if
-  // successful (owned by the caller), NULL if not.
+  // successful (owned by the caller), nullptr if not.
   IPC::Message*
   ShareTo(IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead,
           base::ProcessHandle aProcess,
           int32_t routingId);
 
   // Stop sharing this with |aProcess|.  Return an IPC message that
   // contains enough information for the other process to unmap this
   // segment.  Return a new message if successful (owned by the
-  // caller), NULL if not.
+  // caller), nullptr if not.
   IPC::Message*
   UnshareFrom(IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead,
               base::ProcessHandle aProcess,
               int32_t routingId);
 
   // Return a SharedMemory instance in this process using the
   // descriptor shared to us by the process that created the
   // underlying OS shmem resource.  The contents of the descriptor
--- a/ipc/glue/SyncChannel.cpp
+++ b/ipc/glue/SyncChannel.cpp
@@ -25,27 +25,27 @@ struct RunnableMethodTraits<mozilla::ipc
 namespace mozilla {
 namespace ipc {
 
 const int32_t SyncChannel::kNoTimeout = INT32_MIN;
 
 SyncChannel::SyncChannel(SyncListener* aListener)
   : AsyncChannel(aListener)
 #ifdef OS_WIN
-  , mTopFrame(NULL)
+  , mTopFrame(nullptr)
 #endif
   , mPendingReply(0)
   , mProcessingSyncMessage(false)
   , mNextSeqno(0)
   , mInTimeoutSecondHalf(false)
   , mTimeoutMs(kNoTimeout)
 {
     MOZ_COUNT_CTOR(SyncChannel);
 #ifdef OS_WIN
-    mEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
+    mEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr);
     NS_ASSERTION(mEvent, "CreateEvent failed! Nothing is going to work!");
 #endif
 }
 
 SyncChannel::~SyncChannel()
 {
     MOZ_COUNT_DTOR(SyncChannel);
 #ifdef OS_WIN
--- a/ipc/glue/WindowsMessageLoop.cpp
+++ b/ipc/glue/WindowsMessageLoop.cpp
@@ -93,18 +93,18 @@ enum { WM_XP_THEMECHANGED = 0x031A };
 PRUnichar gAppMessageWindowName[256] = { 0 };
 int32_t gAppMessageWindowNameLength = 0;
 
 nsTArray<HWND>* gNeuteredWindows = nullptr;
 
 typedef nsTArray<nsAutoPtr<DeferredMessage> > DeferredMessageArray;
 DeferredMessageArray* gDeferredMessages = nullptr;
 
-HHOOK gDeferredGetMsgHook = NULL;
-HHOOK gDeferredCallWndProcHook = NULL;
+HHOOK gDeferredGetMsgHook = nullptr;
+HHOOK gDeferredCallWndProcHook = nullptr;
 
 DWORD gUIThreadId = 0;
 
 LRESULT CALLBACK
 DeferredMessageHook(int nCode,
                     WPARAM wParam,
                     LPARAM lParam)
 {
@@ -136,30 +136,30 @@ DeferredMessageHook(int nCode,
     // Run all the deferred messages in order.
     uint32_t count = messages->Length();
     for (uint32_t index = 0; index < count; index++) {
       messages->ElementAt(index)->Run();
     }
   }
 
   // Always call the next hook.
-  return CallNextHookEx(NULL, nCode, wParam, lParam);
+  return CallNextHookEx(nullptr, nCode, wParam, lParam);
 }
 
 void
 ScheduleDeferredMessageRun()
 {
   if (gDeferredMessages &&
       !(gDeferredGetMsgHook && gDeferredCallWndProcHook)) {
     NS_ASSERTION(gDeferredMessages->Length(), "No deferred messages?!");
 
     gDeferredGetMsgHook = ::SetWindowsHookEx(WH_GETMESSAGE, DeferredMessageHook,
-                                             NULL, gUIThreadId);
+                                             nullptr, gUIThreadId);
     gDeferredCallWndProcHook = ::SetWindowsHookEx(WH_CALLWNDPROC,
-                                                  DeferredMessageHook, NULL,
+                                                  DeferredMessageHook, nullptr,
                                                   gUIThreadId);
     NS_ASSERTION(gDeferredGetMsgHook && gDeferredCallWndProcHook,
                  "Failed to set hooks!");
   }
 }
 
 LRESULT
 ProcessOrDeferMessage(HWND hwnd,
@@ -439,19 +439,19 @@ NeuterWindowProcedure(HWND hWnd)
 {
   if (!WindowIsDeferredWindow(hWnd)) {
     // Some other kind of window, skip.
     return false;
   }
 
   NS_ASSERTION(!GetProp(hWnd, kOldWndProcProp), "This should always be null!");
 
-  // It's possible to get NULL out of SetWindowLongPtr, and the only way to know
-  // if that's a valid old value is to use GetLastError. Clear the error here so
-  // we can tell.
+  // It's possible to get nullptr out of SetWindowLongPtr, and the only way to
+  // know if that's a valid old value is to use GetLastError. Clear the error
+  // here so we can tell.
   SetLastError(ERROR_SUCCESS);
 
   LONG_PTR currentWndProc =
     SetWindowLongPtr(hWnd, GWLP_WNDPROC, (LONG_PTR)NeuteredWindowProc);
   if (!currentWndProc) {
     if (ERROR_SUCCESS == GetLastError()) {
       // No error, so we set something and must therefore reset it.
       SetWindowLongPtr(hWnd, GWLP_WNDPROC, currentWndProc);
@@ -503,17 +503,17 @@ CallWindowProcedureHook(int nCode,
 
     if (!gNeuteredWindows->Contains(hWnd) && NeuterWindowProcedure(hWnd)) {
       if (!gNeuteredWindows->AppendElement(hWnd)) {
         NS_ERROR("Out of memory!");
         RestoreWindowProcedure(hWnd);
       }
     }
   }
-  return CallNextHookEx(NULL, nCode, wParam, lParam);
+  return CallNextHookEx(nullptr, nCode, wParam, lParam);
 }
 
 inline void
 AssertWindowIsNotNeutered(HWND hWnd)
 {
 #ifdef DEBUG
   // Make sure our neutered window hook isn't still in place.
   LONG_PTR wndproc = GetWindowLongPtr(hWnd, GWLP_WNDPROC);
@@ -613,17 +613,17 @@ RPCChannel::SyncStackFrame::~SyncStackFr
                "Mismatched static RPC stack frames");
 
   mChannel->mTopFrame = mPrev;
   sStaticTopFrame = mStaticPrev;
 
   if (!mStaticPrev) {
     NS_ASSERTION(gNeuteredWindows, "Bad pointer!");
     delete gNeuteredWindows;
-    gNeuteredWindows = NULL;
+    gNeuteredWindows = nullptr;
   }
 }
 
 SyncChannel::SyncStackFrame* SyncChannel::sStaticTopFrame;
 
 // nsAppShell's notification that gecko events are being processed.
 // If we are here and there is an RPC Incall active, we are spinning
 // a nested gecko event loop. In which case the remote process needs
@@ -682,17 +682,17 @@ RPCChannel::SpinInternalEventLoop()
     {
       MonitorAutoLock lock(*mMonitor);
       if (!Connected()) {
         return;
       }
     }
 
     // Retrieve window or thread messages
-    if (PeekMessageW(&msg, NULL, 0, 0, PM_REMOVE)) {
+    if (PeekMessageW(&msg, nullptr, 0, 0, PM_REMOVE)) {
       // The child UI should have been destroyed before the app is closed, in
       // which case, we should never get this here.
       if (msg.message == WM_QUIT) {
           NS_ERROR("WM_QUIT received in SpinInternalEventLoop!");
       } else {
           TranslateMessage(&msg);
           DispatchMessageW(&msg);
           return;
@@ -732,27 +732,27 @@ SyncChannel::WaitForNotify()
   UINT_PTR timerId = 0;
   TimeoutData timeoutData = { 0 };
 
   if (mTimeoutMs != kNoTimeout) {
     InitTimeoutData(&timeoutData, mTimeoutMs);
 
     // We only do this to ensure that we won't get stuck in
     // MsgWaitForMultipleObjects below.
-    timerId = SetTimer(NULL, 0, mTimeoutMs, NULL);
+    timerId = SetTimer(nullptr, 0, mTimeoutMs, nullptr);
     NS_ASSERTION(timerId, "SetTimer failed!");
   }
 
   // Setup deferred processing of native events while we wait for a response.
   NS_ASSERTION(!SyncChannel::IsPumpingMessages(),
                "Shouldn't be pumping already!");
 
   SyncChannel::SetIsPumpingMessages(true);
   HHOOK windowHook = SetWindowsHookEx(WH_CALLWNDPROC, CallWindowProcedureHook,
-                                      NULL, gUIThreadId);
+                                      nullptr, gUIThreadId);
   NS_ASSERTION(windowHook, "Failed to set hook!");
 
   {
     while (1) {
       MSG msg = { 0 };
       // Don't get wrapped up in here if the child connection dies.
       {
         MonitorAutoLock lock(*mMonitor);
@@ -801,17 +801,17 @@ SyncChannel::WaitForNotify()
       // above. In that case this PeekMessage call won't actually cause any
       // mozilla code (or plugin code) to run.
 
       // If the following PeekMessage call fails to return a message for us (and
       // returns false) and we didn't run any "nonqueued" messages then we must
       // have woken up for a message designated for a window in another thread.
       // If we loop immediately then we could enter a tight loop, so we'll give
       // up our time slice here to let the child process its message.
-      if (!PeekMessageW(&msg, NULL, 0, 0, PM_NOREMOVE) &&
+      if (!PeekMessageW(&msg, nullptr, 0, 0, PM_NOREMOVE) &&
           !haveSentMessagesPending) {
         // Message was for child, we should wait a bit.
         SwitchToThread();
       }
     }
   }
 
   // Unhook the neutered window procedure hook.
@@ -823,17 +823,17 @@ SyncChannel::WaitForNotify()
 
   // Before returning we need to set a hook to run any deferred messages that
   // we received during the IPC call. The hook will unset itself as soon as
   // someone else calls GetMessage, PeekMessage, or runs code that generates
   // a "nonqueued" message.
   ScheduleDeferredMessageRun();
 
   if (timerId) {
-    KillTimer(NULL, timerId);
+    KillTimer(nullptr, timerId);
   }
 
   SyncChannel::SetIsPumpingMessages(false);
 
   return WaitResponse(timedout);
 }
 
 bool
@@ -857,30 +857,30 @@ RPCChannel::WaitForNotify()
   bool timedout = false;
 
   UINT_PTR timerId = 0;
   TimeoutData timeoutData = { 0 };
 
   // windowHook is used as a flag variable for the loop below: if it is set
   // and we start to spin a nested event loop, we need to clear the hook and
   // process deferred/pending messages.
-  // If windowHook is NULL, SyncChannel::IsPumpingMessages should be false.
-  HHOOK windowHook = NULL;
+  // If windowHook is nullptr, SyncChannel::IsPumpingMessages should be false.
+  HHOOK windowHook = nullptr;
 
   while (1) {
     NS_ASSERTION((!!windowHook) == SyncChannel::IsPumpingMessages(),
                  "windowHook out of sync with reality");
 
     if (mTopFrame->mSpinNestedEvents) {
       if (windowHook) {
         UnhookWindowsHookEx(windowHook);
-        windowHook = NULL;
+        windowHook = nullptr;
 
         if (timerId) {
-          KillTimer(NULL, timerId);
+          KillTimer(nullptr, timerId);
           timerId = 0;
         }
 
         // Used by widget to assert on incoming native events
         SyncChannel::SetIsPumpingMessages(false);
 
         // Unhook any neutered windows procedures so messages can be delievered
         // normally.
@@ -894,24 +894,24 @@ RPCChannel::WaitForNotify()
       SpinInternalEventLoop();
       ResetEvent(mEvent);
       return true;
     }
 
     if (!windowHook) {
       SyncChannel::SetIsPumpingMessages(true);
       windowHook = SetWindowsHookEx(WH_CALLWNDPROC, CallWindowProcedureHook,
-                                    NULL, gUIThreadId);
+                                    nullptr, gUIThreadId);
       NS_ASSERTION(windowHook, "Failed to set hook!");
 
       NS_ASSERTION(!timerId, "Timer already initialized?");
 
       if (mTimeoutMs != kNoTimeout) {
         InitTimeoutData(&timeoutData, mTimeoutMs);
-        timerId = SetTimer(NULL, 0, mTimeoutMs, NULL);
+        timerId = SetTimer(nullptr, 0, mTimeoutMs, nullptr);
         NS_ASSERTION(timerId, "SetTimer failed!");
       }
     }
 
     MSG msg = { 0 };
 
     // Don't get wrapped up in here if the child connection dies.
     {
@@ -940,17 +940,17 @@ RPCChannel::WaitForNotify()
     }
 
     // See SyncChannel's WaitForNotify for details.
     bool haveSentMessagesPending =
       (HIWORD(GetQueueStatus(QS_SENDMESSAGE)) & QS_SENDMESSAGE) != 0;
 
     // PeekMessage markes the messages as "old" so that they don't wake up
     // MsgWaitForMultipleObjects every time.
-    if (!PeekMessageW(&msg, NULL, 0, 0, PM_NOREMOVE) &&
+    if (!PeekMessageW(&msg, nullptr, 0, 0, PM_NOREMOVE) &&
         !haveSentMessagesPending) {
       // Message was for child, we should wait a bit.
       SwitchToThread();
     }
   }
 
   if (windowHook) {
     // Unhook the neutered window procedure hook.
@@ -962,17 +962,17 @@ RPCChannel::WaitForNotify()
 
     // Before returning we need to set a hook to run any deferred messages that
     // we received during the IPC call. The hook will unset itself as soon as
     // someone else calls GetMessage, PeekMessage, or runs code that generates
     // a "nonqueued" message.
     ScheduleDeferredMessageRun();
 
     if (timerId) {
-      KillTimer(NULL, timerId);
+      KillTimer(nullptr, timerId);
     }
   }
 
   SyncChannel::SetIsPumpingMessages(false);
 
   return WaitResponse(timedout);
 }
 
@@ -1012,17 +1012,17 @@ DeferredRedrawMessage::Run()
   if (!IsWindow(hWnd)) {
     NS_ERROR("Invalid window!");
     return;
   }
 
 #ifdef DEBUG
   BOOL ret =
 #endif
-  RedrawWindow(hWnd, NULL, NULL, flags);
+  RedrawWindow(hWnd, nullptr, nullptr, flags);
   NS_ASSERTION(ret, "RedrawWindow failed!");
 }
 
 DeferredUpdateMessage::DeferredUpdateMessage(HWND aHWnd)
 {
   mWnd = aHWnd;
   if (!GetUpdateRect(mWnd, &mUpdateRect, FALSE)) {
     memset(&mUpdateRect, 0, sizeof(RECT));
@@ -1055,17 +1055,17 @@ DeferredSettingChangeMessage::DeferredSe
 : DeferredSendMessage(aHWnd, aMessage, aWParam, aLParam)
 {
   NS_ASSERTION(aMessage == WM_SETTINGCHANGE, "Wrong message type!");
   if (aLParam) {
     lParamString = _wcsdup(reinterpret_cast<const wchar_t*>(aLParam));
     lParam = reinterpret_cast<LPARAM>(lParamString);
   }
   else {
-    lParamString = NULL;
+    lParamString = nullptr;
     lParam = 0;
   }
 }
 
 DeferredSettingChangeMessage::~DeferredSettingChangeMessage()
 {
   free(lParamString);
 }
@@ -1080,17 +1080,17 @@ DeferredWindowPosMessage::DeferredWindow
       NCCALCSIZE_PARAMS* arg = reinterpret_cast<NCCALCSIZE_PARAMS*>(aLParam);
       memcpy(&windowPos, arg->lppos, sizeof(windowPos));
 
       NS_ASSERTION(aHWnd == windowPos.hwnd, "Mismatched hwnds!");
     }
     else {
       RECT* arg = reinterpret_cast<RECT*>(aLParam);
       windowPos.hwnd = aHWnd;
-      windowPos.hwndInsertAfter = NULL;
+      windowPos.hwndInsertAfter = nullptr;
       windowPos.x = arg->left;
       windowPos.y = arg->top;
       windowPos.cx = arg->right - arg->left;
       windowPos.cy = arg->bottom - arg->top;
 
       NS_ASSERTION(arg->right >= arg->left && arg->bottom >= arg->top,
                    "Negative width or height!");
     }
@@ -1158,17 +1158,17 @@ DeferredCopyDataMessage::DeferredCopyDat
       memcpy(copyData.lpData, source->lpData, source->cbData);
     }
     else {
       NS_ERROR("Out of memory?!");
       copyData.cbData = 0;
     }
   }
   else {
-    copyData.lpData = NULL;
+    copyData.lpData = nullptr;
   }
 
   lParam = reinterpret_cast<LPARAM>(&copyData);
 }
 
 DeferredCopyDataMessage::~DeferredCopyDataMessage()
 {
   free(copyData.lpData);