Bug 939182 - Prevent mock timers from interfering with the message pump machinery, r=bsmedberg.

--HG--
extra : transplant_source : %2AEm%1D%2C%0Abd%83%B6%BEO%96%D4%BB%13%29%82%9D4
This commit is contained in:
Ben Turner 2013-12-09 11:57:29 -08:00
Родитель 057f369312
Коммит ae412f7c08
2 изменённых файлов: 11 добавлений и 3 удалений

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

@ -18,6 +18,7 @@
#include "nsServiceManagerUtils.h"
#include "nsString.h"
#include "nsThreadUtils.h"
#include "nsTimerImpl.h"
#include "nsXULAppAPI.h"
#include "prthread.h"
@ -32,6 +33,8 @@
using base::TimeTicks;
using namespace mozilla::ipc;
NS_DEFINE_NAMED_CID(NS_TIMER_CID);
static mozilla::DebugOnly<MessagePump::Delegate*> gFirstDelegate;
namespace mozilla {
@ -81,7 +84,7 @@ MessagePump::Run(MessagePump::Delegate* aDelegate)
mThread = NS_GetCurrentThread();
MOZ_ASSERT(mThread);
mDelayedWorkTimer = do_CreateInstance(NS_TIMER_CONTRACTID);
mDelayedWorkTimer = do_CreateInstance(kNS_TIMER_CID);
MOZ_ASSERT(mDelayedWorkTimer);
base::ScopedNSAutoreleasePool autoReleasePool;
@ -172,7 +175,7 @@ MessagePump::ScheduleDelayedWork(const base::TimeTicks& aDelayedTime)
#endif
if (!mDelayedWorkTimer) {
mDelayedWorkTimer = do_CreateInstance(NS_TIMER_CONTRACTID);
mDelayedWorkTimer = do_CreateInstance(kNS_TIMER_CID);
if (!mDelayedWorkTimer) {
// Called before XPCOM has started up? We can't do this correctly.
NS_WARNING("Delayed task might not run!");
@ -287,7 +290,7 @@ MessagePumpForNonMainThreads::Run(base::MessagePump::Delegate* aDelegate)
mThread = NS_GetCurrentThread();
MOZ_ASSERT(mThread);
mDelayedWorkTimer = do_CreateInstance(NS_TIMER_CONTRACTID);
mDelayedWorkTimer = do_CreateInstance(kNS_TIMER_CID);
MOZ_ASSERT(mDelayedWorkTimer);
if (NS_FAILED(mDelayedWorkTimer->SetTarget(mThread))) {

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

@ -103,6 +103,11 @@ IPDL_SOURCES = [
'URIParams.ipdlh',
]
LOCAL_INCLUDES += [
'/xpcom/threads',
]
include('/ipc/chromium/chromium-config.mozbuild')
FINAL_LIBRARY = 'xul'