Backed out changeset 4bcb784492bb (bug 1268313)

--HG--
extra : rebase_source : f2f752ab73f5bbf31a909892a0fac0f42c894430
This commit is contained in:
Carsten "Tomcat" Book 2016-04-29 14:21:18 +02:00
Родитель ba3fe0975c
Коммит de92769e7e
25 изменённых файлов: 149 добавлений и 247 удалений

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

@ -34,8 +34,8 @@ ContentBridgeChild::~ContentBridgeChild()
void
ContentBridgeChild::ActorDestroy(ActorDestroyReason aWhy)
{
RefPtr<Runnable> runnable = NS_NewRunnableMethod(this, &ContentBridgeChild::DeferredDestroy);
MessageLoop::current()->PostTask(runnable.forget());
MessageLoop::current()->PostTask(
NewRunnableMethod(this, &ContentBridgeChild::DeferredDestroy));
}
/*static*/ ContentBridgeChild*

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

@ -37,8 +37,8 @@ ContentBridgeParent::ActorDestroy(ActorDestroyReason aWhy)
if (os) {
os->RemoveObserver(this, "content-child-shutdown");
}
RefPtr<Runnable> runnable = NS_NewRunnableMethod(this, &ContentBridgeParent::DeferredDestroy);
MessageLoop::current()->PostTask(runnable.forget());
MessageLoop::current()->PostTask(
NewRunnableMethod(this, &ContentBridgeParent::DeferredDestroy));
}
/*static*/ ContentBridgeParent*
@ -168,8 +168,8 @@ ContentBridgeParent::NotifyTabDestroyed()
{
int32_t numLiveTabs = ManagedPBrowserParent().Count();
if (numLiveTabs == 1) {
RefPtr<Runnable> runnable = NS_NewRunnableMethod(this, &ContentBridgeParent::Close);
MessageLoop::current()->PostTask(runnable.forget());
MessageLoop::current()->PostTask(
NewRunnableMethod(this, &ContentBridgeParent::Close));
}
}

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

@ -79,12 +79,6 @@ protected:
mIsForBrowser = aIsForBrowser;
}
void Close()
{
// Trick NS_NewRunnableMethod
PContentBridgeParent::Close();
}
protected:
virtual bool
RecvSyncMessage(const nsString& aMsg,

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

@ -2177,10 +2177,9 @@ ContentParent::ActorDestroy(ActorDestroyReason why)
// Destroy any processes created by this ContentParent
for(uint32_t i = 0; i < childIDArray.Length(); i++) {
ContentParent* cp = cpm->GetContentProcessById(childIDArray[i]);
RefPtr<Runnable> runnable =
NS_NewRunnableMethodWithArgs<ShutDownMethod>(cp, &ContentParent::ShutDownProcess,
SEND_SHUTDOWN_MESSAGE);
MessageLoop::current()->PostTask(runnable.forget());
MessageLoop::current()->PostTask(
NewRunnableMethod(cp, &ContentParent::ShutDownProcess,
SEND_SHUTDOWN_MESSAGE));
}
cpm->RemoveContentProcess(this->ChildID());
@ -2261,10 +2260,9 @@ ContentParent::NotifyTabDestroyed(const TabId& aTabId,
if (tabIds.Length() == 1) {
// In the case of normal shutdown, send a shutdown message to child to
// allow it to perform shutdown tasks.
RefPtr<Runnable> runnable =
NS_NewRunnableMethodWithArgs<ShutDownMethod>(this, &ContentParent::ShutDownProcess,
SEND_SHUTDOWN_MESSAGE);
MessageLoop::current()->PostTask(runnable.forget());
MessageLoop::current()->PostTask(
NewRunnableMethod(this, &ContentParent::ShutDownProcess,
SEND_SHUTDOWN_MESSAGE));
}
}

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

@ -204,9 +204,8 @@ PreallocatedProcessManagerImpl::AllocateAfterDelay()
return;
}
RefPtr<Runnable> runnable = NS_NewRunnableMethod(this, &PreallocatedProcessManagerImpl::AllocateOnIdle);
MessageLoop::current()->PostDelayedTask(
runnable.forget(),
NewRunnableMethod(this, &PreallocatedProcessManagerImpl::AllocateOnIdle),
Preferences::GetUint("dom.ipc.processPrelaunch.delayMs",
DEFAULT_ALLOCATE_DELAY));
}
@ -218,8 +217,8 @@ PreallocatedProcessManagerImpl::AllocateOnIdle()
return;
}
RefPtr<Runnable> runnable = NS_NewRunnableMethod(this, &PreallocatedProcessManagerImpl::AllocateNow);
MessageLoop::current()->PostIdleTask(runnable.forget());
MessageLoop::current()->PostIdleTask(
NewRunnableMethod(this, &PreallocatedProcessManagerImpl::AllocateNow));
}
void
@ -244,7 +243,7 @@ PreallocatedProcessManagerImpl::ScheduleDelayedNuwaFork()
return;
}
RefPtr<CancelableTask> task = NS_NewCancelableRunnableMethod(
RefPtr<CancelableTask> task = NewRunnableMethod(
this, &PreallocatedProcessManagerImpl::DelayedNuwaFork);
mPreallocateAppProcessTask = task;
MessageLoop::current()->PostDelayedTask(task.forget(),

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

@ -61,8 +61,7 @@ GMPDecryptorChild::CallOnGMPThread(MethodType aMethod, ParamType&&... aParams)
// Use const reference when we have to.
auto m = &GMPDecryptorChild::CallMethod<
decltype(aMethod), typename AddConstReference<ParamType>::Type...>;
RefPtr<mozilla::Runnable> t =
dont_add_new_uses_of_this::NewRunnableMethod(this, m, aMethod, Forward<ParamType>(aParams)...);
RefPtr<mozilla::Runnable> t = NewRunnableMethod(this, m, aMethod, Forward<ParamType>(aParams)...);
mPlugin->GMPMessageLoop()->PostTask(t.forget());
}
}
@ -171,11 +170,7 @@ GMPDecryptorChild::Decrypted(GMPBuffer* aBuffer, GMPErr aResult)
if (!ON_GMP_THREAD()) {
// We should run this whole method on the GMP thread since the buffer needs
// to be deleted after the SendDecrypted call.
RefPtr<Runnable> t =
NS_NewRunnableMethodWithArgs<GMPBuffer*,
GMPErr>(this,
&GMPDecryptorChild::Decrypted,
aBuffer, aResult);
RefPtr<Runnable> t = NewRunnableMethod(this, &GMPDecryptorChild::Decrypted, aBuffer, aResult);
mPlugin->GMPMessageLoop()->PostTask(t.forget());
return;
}

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

@ -73,8 +73,7 @@ public:
// main thread tries to do a sync call back to the calling thread.
MOZ_ASSERT(!IsOnChildMainThread());
RefPtr<mozilla::Runnable> runnable = NS_NewRunnableMethod(this, &SyncRunnable::Run);
mMessageLoop->PostTask(runnable.forget());
mMessageLoop->PostTask(NewRunnableMethod(this, &SyncRunnable::Run));
MonitorAutoLock lock(mMonitor);
while (!mDone) {
lock.Wait();
@ -122,8 +121,7 @@ RunOnMainThread(GMPTask* aTask)
}
RefPtr<Runnable> r = new Runnable(aTask);
RefPtr<mozilla::Runnable> runnable = NS_NewRunnableMethod(r, &Runnable::Run);
sMainLoop->PostTask(runnable.forget());
sMainLoop->PostTask(NewRunnableMethod(r.get(), &Runnable::Run));
return GMPNoErr;
}
@ -255,8 +253,8 @@ GMPThreadImpl::Post(GMPTask* aTask)
}
RefPtr<Runnable> r = new Runnable(aTask);
RefPtr<mozilla::Runnable> runnable = NS_NewRunnableMethod(r, &Runnable::Run);
mThread.message_loop()->PostTask(runnable.forget());
mThread.message_loop()->PostTask(NewRunnableMethod(r.get(), &Runnable::Run));
}
void

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

@ -15,7 +15,7 @@
_func(__VA_ARGS__); \
} else { \
mPlugin->GMPMessageLoop()->PostTask( \
dont_add_new_uses_of_this::NewRunnableMethod(this, &GMPStorageChild::_func, ##__VA_ARGS__) \
NewRunnableMethod(this, &GMPStorageChild::_func, ##__VA_ARGS__) \
); \
} \
} while(false)

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

@ -226,8 +226,7 @@ GMPVideoDecoderChild::Alloc(size_t aSize,
rv = CallNeedShmem(aSize, aMem);
--mNeedShmemIntrCount;
if (mPendingDecodeComplete) {
RefPtr<Runnable> runnable = NS_NewRunnableMethod(this, &GMPVideoDecoderChild::RecvDecodingComplete);
mPlugin->GMPMessageLoop()->PostTask(runnable.forget());
mPlugin->GMPMessageLoop()->PostTask(NewRunnableMethod(this, &GMPVideoDecoderChild::RecvDecodingComplete));
}
#else
#ifdef GMP_SAFE_SHMEM

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

@ -207,8 +207,7 @@ GMPVideoEncoderChild::Alloc(size_t aSize,
rv = CallNeedShmem(aSize, aMem);
--mNeedShmemIntrCount;
if (mPendingEncodeComplete) {
RefPtr<Runnable> runnable = NS_NewRunnableMethod(this, &GMPVideoEncoderChild::RecvEncodingComplete);
mPlugin->GMPMessageLoop()->PostTask(runnable.forget());
mPlugin->GMPMessageLoop()->PostTask(NewRunnableMethod(this, &GMPVideoEncoderChild::RecvEncodingComplete));
}
#else
#ifdef GMP_SAFE_SHMEM

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

@ -198,12 +198,11 @@ MediaSystemResourceManager::Acquire(MediaSystemResourceClient* aClient)
return;
}
aClient->mResourceState = MediaSystemResourceClient::RESOURCE_STATE_WAITING;
RefPtr<Runnable> runnable =
NS_NewRunnableMethodWithArgs<uint32_t>(
ImageBridgeChild::GetSingleton()->GetMessageLoop()->PostTask(
NewRunnableMethod(
this,
&MediaSystemResourceManager::DoAcquire,
aClient->mId);
ImageBridgeChild::GetSingleton()->GetMessageLoop()->PostTask(runnable.forget());
aClient->mId));
}
bool
@ -242,12 +241,11 @@ MediaSystemResourceManager::AcquireSyncNoWait(MediaSystemResourceClient* aClient
aClient->mResourceState = MediaSystemResourceClient::RESOURCE_STATE_WAITING;
}
RefPtr<Runnable> runnable =
NS_NewRunnableMethodWithArgs<uint32_t>(
ImageBridgeChild::GetSingleton()->GetMessageLoop()->PostTask(
NewRunnableMethod(
this,
&MediaSystemResourceManager::DoAcquire,
aClient->mId);
ImageBridgeChild::GetSingleton()->GetMessageLoop()->PostTask(runnable.forget());
aClient->mId));
// should stop the thread until done.
while (!done) {
@ -310,12 +308,11 @@ MediaSystemResourceManager::ReleaseResource(MediaSystemResourceClient* aClient)
aClient->mResourceState = MediaSystemResourceClient::RESOURCE_STATE_END;
RefPtr<Runnable> runnable =
NS_NewRunnableMethodWithArgs<uint32_t>(
ImageBridgeChild::GetSingleton()->GetMessageLoop()->PostTask(
NewRunnableMethod(
this,
&MediaSystemResourceManager::DoRelease,
aClient->mId);
ImageBridgeChild::GetSingleton()->GetMessageLoop()->PostTask(runnable.forget());
aClient->mId));
}
}
@ -339,13 +336,12 @@ void
MediaSystemResourceManager::HandleAcquireResult(uint32_t aId, bool aSuccess)
{
if (!InImageBridgeChildThread()) {
RefPtr<Runnable> runnable =
NS_NewRunnableMethodWithArgs<uint32_t, bool>(
ImageBridgeChild::GetSingleton()->GetMessageLoop()->PostTask(
NewRunnableMethod(
this,
&MediaSystemResourceManager::HandleAcquireResult,
aId,
aSuccess);
ImageBridgeChild::GetSingleton()->GetMessageLoop()->PostTask(runnable.forget());
aSuccess));
return;
}

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

@ -1335,8 +1335,8 @@ APZCTreeManager::ClearTree()
// Ensure that no references to APZCs are alive in any lingering input
// blocks. This breaks cycles from InputBlockState::mTargetApzc back to
// the InputQueue.
RefPtr<Runnable> runnable = NS_NewRunnableMethod(mInputQueue.get(), &InputQueue::Clear);
APZThreadUtils::RunOnControllerThread(runnable.forget());
APZThreadUtils::RunOnControllerThread(NewRunnableMethod(
mInputQueue.get(), &InputQueue::Clear));
MutexAutoLock lock(mTreeLock);

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

@ -516,9 +516,9 @@ public:
// is this one, then the SetState(NOTHING) in UpdateAnimation will
// stomp on the SetState(SNAP_BACK) it does.
mDeferredTasks.AppendElement(
NS_NewRunnableMethodWithArg<AsyncPanZoomController*>(mOverscrollHandoffChain.get(),
&OverscrollHandoffChain::SnapBackOverscrolledApzc,
&mApzc));
NewRunnableMethod(mOverscrollHandoffChain.get(),
&OverscrollHandoffChain::SnapBackOverscrolledApzc,
&mApzc));
return false;
}
@ -568,13 +568,11 @@ public:
// called after mMonitor is released.
APZC_LOG("%p fling went into overscroll, handing off with velocity %s\n", &mApzc, Stringify(velocity).c_str());
mDeferredTasks.AppendElement(
NS_NewRunnableMethodWithArgs<ParentLayerPoint,
RefPtr<const OverscrollHandoffChain>,
RefPtr<const AsyncPanZoomController>>(&mApzc,
&AsyncPanZoomController::HandleFlingOverscroll,
velocity,
mOverscrollHandoffChain,
mScrolledApzc));
NewRunnableMethod(&mApzc,
&AsyncPanZoomController::HandleFlingOverscroll,
velocity,
mOverscrollHandoffChain,
mScrolledApzc));
// If there is a remaining velocity on this APZC, continue this fling
// as well. (This fling and the handed-off fling will run concurrently.)
@ -702,7 +700,9 @@ public:
// The scroll snapping is done in a deferred task, otherwise the state
// change to NOTHING caused by the overscroll animation ending would
// clobber a possible state change to SMOOTH_SCROLL in ScrollSnap().
mDeferredTasks.AppendElement(NS_NewRunnableMethod(&mApzc, &AsyncPanZoomController::ScrollSnap));
mDeferredTasks.AppendElement(
NewRunnableMethod(&mApzc,
&AsyncPanZoomController::ScrollSnap));
return false;
}
return true;
@ -819,9 +819,9 @@ public:
// the lock ordering. Instead we schedule HandleSmoothScrollOverscroll() to be
// called after mMonitor is released.
mDeferredTasks.AppendElement(
NS_NewRunnableMethodWithArgs<ParentLayerPoint>(&mApzc,
&AsyncPanZoomController::HandleSmoothScrollOverscroll,
velocity));
NewRunnableMethod(&mApzc,
&AsyncPanZoomController::HandleSmoothScrollOverscroll,
velocity));
return false;
}
@ -2172,14 +2172,11 @@ nsEventStatus AsyncPanZoomController::GenerateSingleTap(const ScreenIntPoint& aP
// the single tap message before the corresponding touch-up. To avoid that we
// schedule the singletap message to run on the next spin of the event loop.
// See bug 965381 for the issue this was causing.
RefPtr<Runnable> runnable =
NS_NewRunnableMethodWithArgs<CSSPoint,
mozilla::Modifiers,
ScrollableLayerGuid>(controller, &GeckoContentController::HandleSingleTap,
geckoScreenPoint, aModifiers,
GetGuid());
controller->PostDelayedTask(runnable.forget(), 0);
controller->PostDelayedTask(
NewRunnableMethod(controller.get(), &GeckoContentController::HandleSingleTap,
geckoScreenPoint, aModifiers,
GetGuid()),
0);
return nsEventStatus_eConsumeNoDefault;
}
}

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

@ -570,9 +570,8 @@ InputQueue::ScheduleMainThreadTimeout(const RefPtr<AsyncPanZoomController>& aTar
CancelableBlockState* aBlock) {
INPQ_LOG("scheduling main thread timeout for target %p\n", aTarget.get());
aBlock->StartContentResponseTimer();
RefPtr<Runnable> runnable =
NS_NewRunnableMethodWithArgs<uint64_t>(this, &InputQueue::MainThreadTimeout, aBlock->GetBlockId());
aTarget->PostDelayedTask(runnable.forget(),
aTarget->PostDelayedTask(
NewRunnableMethod(this, &InputQueue::MainThreadTimeout, aBlock->GetBlockId()),
gfxPrefs::APZContentResponseTimeout());
}

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

@ -688,7 +688,7 @@ public:
}
APZCCH_LOG("Got refresh, sending target APZCs for input block %" PRIu64 "\n", mInputBlockId);
SendLayersDependentApzcTargetConfirmation(mPresShell, mInputBlockId, Move(mTargets));
SendLayersDependentApzcTargetConfirmation(mPresShell, mInputBlockId, mTargets);
if (!mPresShell->RemovePostRefreshObserver(this)) {
MOZ_ASSERT_UNREACHABLE("Unable to unregister post-refresh observer! Leaking it instead of leaving garbage registered");
@ -719,7 +719,7 @@ SendSetTargetAPZCNotificationHelper(nsIWidget* aWidget,
if (waitForRefresh) {
APZCCH_LOG("At least one target got a new displayport, need to wait for refresh\n");
waitForRefresh = aShell->AddPostRefreshObserver(
new DisplayportSetListener(aShell, aInputBlockId, Move(aTargets)));
new DisplayportSetListener(aShell, aInputBlockId, aTargets));
}
if (!waitForRefresh) {
APZCCH_LOG("Sending target APZCs for input block %" PRIu64 "\n", aInputBlockId);
@ -770,7 +770,7 @@ APZCCallbackHelper::SendSetTargetAPZCNotification(nsIWidget* aWidget,
aWidget,
shell,
aInputBlockId,
Move(targets),
targets,
waitForRefresh);
}
}
@ -790,7 +790,7 @@ APZCCallbackHelper::SendSetAllowedTouchBehaviorNotification(
widget::ContentHelper::GetAllowedTouchBehavior(
aWidget, aEvent.mTouches[i]->mRefPoint));
}
aCallback(aInputBlockId, Move(flags));
aCallback(aInputBlockId, flags);
}
void

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

@ -141,9 +141,9 @@ public:
/* Figure out the allowed touch behaviors of each touch point in |aEvent|
* and send that information to the provided callback. */
static void SendSetAllowedTouchBehaviorNotification(nsIWidget* aWidget,
const WidgetTouchEvent& aEvent,
uint64_t aInputBlockId,
const SetAllowedTouchBehaviorCallback& aCallback);
const WidgetTouchEvent& aEvent,
uint64_t aInputBlockId,
const SetAllowedTouchBehaviorCallback& aCallback);
/* Notify content of a mouse scroll testing event. */
static void NotifyMozMouseScrollEvent(const FrameMetrics::ViewID& aScrollId, const nsString& aEvent);

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

@ -36,8 +36,8 @@ ChromeProcessController::ChromeProcessController(nsIWidget* aWidget,
MOZ_ASSERT(aAPZEventState);
MOZ_ASSERT(aAPZCTreeManager);
RefPtr<Runnable> runnable = NS_NewRunnableMethod(this, &ChromeProcessController::InitializeRoot);
mUILoop->PostTask(runnable.forget());
mUILoop->PostTask(
NewRunnableMethod(this, &ChromeProcessController::InitializeRoot));
}
ChromeProcessController::~ChromeProcessController() {}
@ -71,8 +71,8 @@ void
ChromeProcessController::Destroy()
{
if (MessageLoop::current() != mUILoop) {
RefPtr<Runnable> runnable = NS_NewRunnableMethod(this, &ChromeProcessController::Destroy);
mUILoop->PostTask(runnable.forget());
mUILoop->PostTask(
NewRunnableMethod(this, &ChromeProcessController::Destroy));
return;
}
@ -121,12 +121,9 @@ ChromeProcessController::HandleDoubleTap(const mozilla::CSSPoint& aPoint,
const ScrollableLayerGuid& aGuid)
{
if (MessageLoop::current() != mUILoop) {
RefPtr<Runnable> runnable =
NS_NewRunnableMethodWithArgs<CSSPoint,
Modifiers,
ScrollableLayerGuid>(this, &ChromeProcessController::HandleDoubleTap,
aPoint, aModifiers, aGuid);
mUILoop->PostTask(runnable.forget());
mUILoop->PostTask(
NewRunnableMethod(this, &ChromeProcessController::HandleDoubleTap,
aPoint, aModifiers, aGuid));
return;
}
@ -161,12 +158,9 @@ ChromeProcessController::HandleSingleTap(const CSSPoint& aPoint,
const ScrollableLayerGuid& aGuid)
{
if (MessageLoop::current() != mUILoop) {
RefPtr<Runnable> runnable =
NS_NewRunnableMethodWithArgs<CSSPoint,
Modifiers,
ScrollableLayerGuid>(this, &ChromeProcessController::HandleSingleTap,
aPoint, aModifiers, aGuid);
mUILoop->PostTask(runnable.forget());
mUILoop->PostTask(
NewRunnableMethod(this, &ChromeProcessController::HandleSingleTap,
aPoint, aModifiers, aGuid));
return;
}
@ -179,13 +173,9 @@ ChromeProcessController::HandleLongTap(const mozilla::CSSPoint& aPoint, Modifier
uint64_t aInputBlockId)
{
if (MessageLoop::current() != mUILoop) {
RefPtr<Runnable> runnable =
NS_NewRunnableMethodWithArgs<mozilla::CSSPoint,
Modifiers,
ScrollableLayerGuid,
uint64_t>(this, &ChromeProcessController::HandleLongTap,
aPoint, aModifiers, aGuid, aInputBlockId);
mUILoop->PostTask(runnable.forget());
mUILoop->PostTask(
NewRunnableMethod(this, &ChromeProcessController::HandleLongTap,
aPoint, aModifiers, aGuid, aInputBlockId));
return;
}
@ -199,12 +189,9 @@ ChromeProcessController::NotifyAPZStateChange(const ScrollableLayerGuid& aGuid,
int aArg)
{
if (MessageLoop::current() != mUILoop) {
RefPtr<Runnable> runnable =
NS_NewRunnableMethodWithArgs<ScrollableLayerGuid,
APZStateChange,
int>(this, &ChromeProcessController::NotifyAPZStateChange,
aGuid, aChange, aArg);
mUILoop->PostTask(runnable.forget());
mUILoop->PostTask(
NewRunnableMethod(this, &ChromeProcessController::NotifyAPZStateChange,
aGuid, aChange, aArg));
return;
}
@ -215,11 +202,8 @@ void
ChromeProcessController::NotifyMozMouseScrollEvent(const FrameMetrics::ViewID& aScrollId, const nsString& aEvent)
{
if (MessageLoop::current() != mUILoop) {
RefPtr<Runnable> runnable =
NS_NewRunnableMethodWithArgs<FrameMetrics::ViewID,
nsString>(this, &ChromeProcessController::NotifyMozMouseScrollEvent,
aScrollId, aEvent);
mUILoop->PostTask(runnable.forget());
mUILoop->PostTask(
NewRunnableMethod(this, &ChromeProcessController::NotifyMozMouseScrollEvent, aScrollId, aEvent));
return;
}

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

@ -362,7 +362,7 @@ CompositorVsyncScheduler::SetDisplay(bool aDisplayEnable)
MOZ_ASSERT(NS_IsMainThread());
MonitorAutoLock lock(mSetDisplayMonitor);
RefPtr<CancelableRunnable> task =
NS_NewCancelableRunnableMethodWithArgs<bool>(this, &CompositorVsyncScheduler::SetDisplay, aDisplayEnable);
NewRunnableMethod(this, &CompositorVsyncScheduler::SetDisplay, aDisplayEnable);
mSetDisplayTask = task;
ScheduleTask(task.forget(), 0);
return;
@ -982,8 +982,7 @@ CompositorBridgeParent::ActorDestroy(ActorDestroyReason why)
// We must keep the compositor parent alive untill the code handling message
// reception is finished on this thread.
mSelfRef = this;
RefPtr<Runnable> runnable = NS_NewRunnableMethod(this, &CompositorBridgeParent::DeferredDestroy);
MessageLoop::current()->PostTask(runnable.forget());
MessageLoop::current()->PostTask(NewRunnableMethod(this,&CompositorBridgeParent::DeferredDestroy));
}
@ -991,16 +990,14 @@ void
CompositorBridgeParent::ScheduleRenderOnCompositorThread()
{
MOZ_ASSERT(CompositorLoop());
RefPtr<Runnable> runnable = NS_NewRunnableMethod(this, &CompositorBridgeParent::ScheduleComposition);
CompositorLoop()->PostTask(runnable.forget());
CompositorLoop()->PostTask(NewRunnableMethod(this, &CompositorBridgeParent::ScheduleComposition));
}
void
CompositorBridgeParent::InvalidateOnCompositorThread()
{
MOZ_ASSERT(CompositorLoop());
RefPtr<Runnable> runnable = NS_NewRunnableMethod(this, &CompositorBridgeParent::Invalidate);
CompositorLoop()->PostTask(runnable.forget());
CompositorLoop()->PostTask(NewRunnableMethod(this, &CompositorBridgeParent::Invalidate));
}
void
@ -1091,8 +1088,7 @@ CompositorBridgeParent::SchedulePauseOnCompositorThread()
MonitorAutoLock lock(mPauseCompositionMonitor);
MOZ_ASSERT(CompositorLoop());
RefPtr<Runnable> runnable = NS_NewRunnableMethod(this, &CompositorBridgeParent::PauseComposition);
CompositorLoop()->PostTask(runnable.forget());
CompositorLoop()->PostTask(NewRunnableMethod(this, &CompositorBridgeParent::PauseComposition));
// Wait until the pause has actually been processed by the compositor thread
lock.Wait();
@ -1104,8 +1100,7 @@ CompositorBridgeParent::ScheduleResumeOnCompositorThread()
MonitorAutoLock lock(mResumeCompositionMonitor);
MOZ_ASSERT(CompositorLoop());
RefPtr<Runnable> runnable = NS_NewRunnableMethod(this, &CompositorBridgeParent::ResumeComposition);
CompositorLoop()->PostTask(runnable.forget());
CompositorLoop()->PostTask(NewRunnableMethod(this, &CompositorBridgeParent::ResumeComposition));
// Wait until the resume has actually been processed by the compositor thread
lock.Wait();
@ -1119,10 +1114,7 @@ CompositorBridgeParent::ScheduleResumeOnCompositorThread(int width, int height)
MonitorAutoLock lock(mResumeCompositionMonitor);
MOZ_ASSERT(CompositorLoop());
RefPtr<Runnable> runnable =
NS_NewRunnableMethodWithArgs<int, int>(this, &CompositorBridgeParent::ResumeCompositionAndResize,
width, height);
CompositorLoop()->PostTask(runnable.forget());
CompositorLoop()->PostTask(NewRunnableMethod(this, &CompositorBridgeParent::ResumeCompositionAndResize, width, height));
// Wait until the resume has actually been processed by the compositor thread
lock.Wait();
@ -2115,13 +2107,11 @@ CompositorBridgeParent::ResetCompositor(const nsTArray<LayersBackend>& aBackendH
{
MonitorAutoLock lock(mResetCompositorMonitor);
RefPtr<Runnable> runnable =
NS_NewRunnableMethodWithArgs<StoreCopyPassByConstLRef<nsTArray<LayersBackend>>,
Maybe<TextureFactoryIdentifier>*>(this,
&CompositorBridgeParent::ResetCompositorTask,
aBackendHints,
&newIdentifier);
CompositorLoop()->PostTask(runnable.forget());
CompositorLoop()->PostTask(
NewRunnableMethod(this,
&CompositorBridgeParent::ResetCompositorTask,
aBackendHints,
&newIdentifier));
mResetCompositorMonitor.Wait();
}
@ -2289,8 +2279,8 @@ CrossProcessCompositorBridgeParent::ActorDestroy(ActorDestroyReason aWhy)
// We must keep this object alive untill the code handling message
// reception is finished on this thread.
RefPtr<Runnable> runnable = NS_NewRunnableMethod(this, &CrossProcessCompositorBridgeParent::DeferredDestroy);
MessageLoop::current()->PostTask(runnable.forget());
MessageLoop::current()->PostTask(
NewRunnableMethod(this, &CrossProcessCompositorBridgeParent::DeferredDestroy));
}
PLayerTransactionParent*
@ -2535,8 +2525,7 @@ void
CompositorBridgeParent::ScheduleShowAllPluginWindows()
{
MOZ_ASSERT(CompositorLoop());
RefPtr<Runnable> runnable = NS_NewRunnableMethod(this, &CompositorBridgeParent::ShowAllPluginWindows);
CompositorLoop()->PostTask(runnable.forget());
CompositorLoop()->PostTask(NewRunnableMethod(this, &CompositorBridgeParent::ShowAllPluginWindows));
}
void
@ -2551,8 +2540,7 @@ void
CompositorBridgeParent::ScheduleHideAllPluginWindows()
{
MOZ_ASSERT(CompositorLoop());
RefPtr<Runnable> runnable = NS_NewRunnableMethod(this, &CompositorBridgeParent::HideAllPluginWindows);
CompositorLoop()->PostTask(runnable.forget());
CompositorLoop()->PostTask(NewRunnableMethod(this, &CompositorBridgeParent::HideAllPluginWindows));
}
void

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

@ -58,12 +58,9 @@ RemoteContentController::HandleDoubleTap(const CSSPoint& aPoint,
if (MessageLoop::current() != mUILoop) {
// We have to send this message from the "UI thread" (main
// thread).
RefPtr<Runnable> runnable =
NS_NewRunnableMethodWithArgs<CSSPoint,
Modifiers,
ScrollableLayerGuid>(this, &RemoteContentController::HandleDoubleTap,
aPoint, aModifiers, aGuid);
mUILoop->PostTask(runnable.forget());
mUILoop->PostTask(
NewRunnableMethod(this, &RemoteContentController::HandleDoubleTap,
aPoint, aModifiers, aGuid));
return;
}
if (CanSend()) {
@ -80,12 +77,9 @@ RemoteContentController::HandleSingleTap(const CSSPoint& aPoint,
if (MessageLoop::current() != mUILoop) {
// We have to send this message from the "UI thread" (main
// thread).
RefPtr<Runnable> runnable =
NS_NewRunnableMethodWithArgs<CSSPoint,
Modifiers,
ScrollableLayerGuid>(this, &RemoteContentController::HandleSingleTap,
aPoint, aModifiers, aGuid);
mUILoop->PostTask(runnable.forget());
mUILoop->PostTask(
NewRunnableMethod(this, &RemoteContentController::HandleSingleTap,
aPoint, aModifiers, aGuid));
return;
}
@ -116,13 +110,9 @@ RemoteContentController::HandleLongTap(const CSSPoint& aPoint,
if (MessageLoop::current() != mUILoop) {
// We have to send this message from the "UI thread" (main
// thread).
RefPtr<Runnable> runnable =
NS_NewRunnableMethodWithArgs<CSSPoint,
Modifiers,
ScrollableLayerGuid,
uint64_t>(this, &RemoteContentController::HandleLongTap,
aPoint, aModifiers, aGuid, aInputBlockId);
mUILoop->PostTask(runnable.forget());
mUILoop->PostTask(
NewRunnableMethod(this, &RemoteContentController::HandleLongTap,
aPoint, aModifiers, aGuid, aInputBlockId));
return;
}
if (CanSend()) {
@ -160,12 +150,9 @@ RemoteContentController::NotifyAPZStateChange(const ScrollableLayerGuid& aGuid,
int aArg)
{
if (MessageLoop::current() != mUILoop) {
RefPtr<Runnable> runnable =
NS_NewRunnableMethodWithArgs<ScrollableLayerGuid,
APZStateChange,
int>(this, &RemoteContentController::NotifyAPZStateChange,
aGuid, aChange, aArg);
mUILoop->PostTask(runnable.forget());
mUILoop->PostTask(
NewRunnableMethod(this, &RemoteContentController::NotifyAPZStateChange,
aGuid, aChange, aArg));
return;
}
if (CanSend()) {
@ -178,11 +165,9 @@ RemoteContentController::NotifyMozMouseScrollEvent(const FrameMetrics::ViewID& a
const nsString& aEvent)
{
if (MessageLoop::current() != mUILoop) {
RefPtr<Runnable> runnable =
NS_NewRunnableMethodWithArgs<FrameMetrics::ViewID,
nsString>(this, &RemoteContentController::NotifyMozMouseScrollEvent,
aScrollId, aEvent);
mUILoop->PostTask(runnable.forget());
mUILoop->PostTask(
NewRunnableMethod(this, &RemoteContentController::NotifyMozMouseScrollEvent,
aScrollId, aEvent));
return;
}
@ -232,13 +217,9 @@ RemoteContentController::RecvContentReceivedInputBlock(const ScrollableLayerGuid
return false;
}
if (RefPtr<APZCTreeManager> apzcTreeManager = GetApzcTreeManager()) {
RefPtr<Runnable> runnable =
NS_NewRunnableMethodWithArgs<uint64_t,
bool>(apzcTreeManager,
&APZCTreeManager::ContentReceivedInputBlock,
aInputBlockId, aPreventDefault);
APZThreadUtils::RunOnControllerThread(runnable.forget());
APZThreadUtils::RunOnControllerThread(NewRunnableMethod(
apzcTreeManager.get(), &APZCTreeManager::ContentReceivedInputBlock,
aInputBlockId, aPreventDefault));
}
return true;
}
@ -250,12 +231,10 @@ RemoteContentController::RecvStartScrollbarDrag(const AsyncDragMetrics& aDragMet
ScrollableLayerGuid guid(mLayersId, aDragMetrics.mPresShellId,
aDragMetrics.mViewId);
RefPtr<Runnable> runnable =
NS_NewRunnableMethodWithArgs<ScrollableLayerGuid,
AsyncDragMetrics>(apzcTreeManager,
&APZCTreeManager::StartScrollbarDrag,
guid, aDragMetrics);
APZThreadUtils::RunOnControllerThread(runnable.forget());
APZThreadUtils::RunOnControllerThread(
NewRunnableMethod(apzcTreeManager.get(),
&APZCTreeManager::StartScrollbarDrag,
guid, aDragMetrics));
}
return true;
}
@ -275,12 +254,9 @@ RemoteContentController::RecvSetTargetAPZC(const uint64_t& aInputBlockId,
// need a local var to disambiguate between the SetTargetAPZC overloads.
void (APZCTreeManager::*setTargetApzcFunc)(uint64_t, const nsTArray<ScrollableLayerGuid>&)
= &APZCTreeManager::SetTargetAPZC;
RefPtr<Runnable> runnable =
NS_NewRunnableMethodWithArgs<uint64_t,
StoreCopyPassByRRef<nsTArray<ScrollableLayerGuid>>>(apzcTreeManager, setTargetApzcFunc,
aInputBlockId, aTargets);
APZThreadUtils::RunOnControllerThread(runnable.forget());
APZThreadUtils::RunOnControllerThread(NewRunnableMethod(
apzcTreeManager.get(), setTargetApzcFunc,
aInputBlockId, aTargets));
}
return true;
}
@ -290,12 +266,9 @@ RemoteContentController::RecvSetAllowedTouchBehavior(const uint64_t& aInputBlock
nsTArray<TouchBehaviorFlags>&& aFlags)
{
if (RefPtr<APZCTreeManager> apzcTreeManager = GetApzcTreeManager()) {
RefPtr<Runnable> runnable =
NS_NewRunnableMethodWithArgs<uint64_t,
StoreCopyPassByRRef<nsTArray<TouchBehaviorFlags>>>(apzcTreeManager,
&APZCTreeManager::SetAllowedTouchBehavior,
aInputBlockId, Move(aFlags));
APZThreadUtils::RunOnControllerThread(runnable.forget());
APZThreadUtils::RunOnControllerThread(NewRunnableMethod(
apzcTreeManager.get(), &APZCTreeManager::SetAllowedTouchBehavior,
aInputBlockId, Move(aFlags)));
}
return true;
}

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

@ -45,8 +45,8 @@ SoftwareDisplay::EnableVsync()
}
mVsyncEnabled = true;
RefPtr<mozilla::Runnable> runnable = NS_NewRunnableMethod(this, &SoftwareDisplay::EnableVsync);
mVsyncThread->message_loop()->PostTask(runnable.forget());
mVsyncThread->message_loop()->PostTask(
NewRunnableMethod(this, &SoftwareDisplay::EnableVsync));
return;
}
@ -64,8 +64,8 @@ SoftwareDisplay::DisableVsync()
}
mVsyncEnabled = false;
RefPtr<mozilla::Runnable> runnable = NS_NewRunnableMethod(this, &SoftwareDisplay::DisableVsync);
mVsyncThread->message_loop()->PostTask(runnable.forget());
mVsyncThread->message_loop()->PostTask(
NewRunnableMethod(this, &SoftwareDisplay::DisableVsync));
return;
}

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

@ -112,8 +112,8 @@ void
VRManagerParent::ActorDestroy(ActorDestroyReason why)
{
UnregisterFromManager();
RefPtr<Runnable> runnable = NS_NewRunnableMethod(this, &VRManagerParent::DeferredDestroy);
MessageLoop::current()->PostTask(runnable.forget());
MessageLoop::current()->PostTask(
NewRunnableMethod(this, &VRManagerParent::DeferredDestroy));
}
mozilla::ipc::IToplevelProtocol*

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

@ -303,9 +303,6 @@ class RunnableMethod : public mozilla::CancelableRunnable,
Params params_;
};
namespace dont_add_new_uses_of_this {
// Don't add new uses of this!!!!
template <class T, class Method, typename... Args>
inline already_AddRefed<mozilla::Runnable>
NewRunnableMethod(T* object, Method method, Args&&... args) {
@ -316,8 +313,6 @@ NewRunnableMethod(T* object, Method method, Args&&... args) {
return t.forget();
}
} // namespace dont_add_new_uses_of_this
// RunnableFunction and NewRunnableFunction implementation ---------------------
template <class Function, class Params>

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

@ -966,10 +966,9 @@ void nsBaseWidget::ConfigureAPZCTreeManager()
bool aPreventDefault)
{
MOZ_ASSERT(NS_IsMainThread());
RefPtr<Runnable> runnable =
NS_NewRunnableMethodWithArgs<uint64_t, bool>(treeManager, &APZCTreeManager::ContentReceivedInputBlock,
aInputBlockId, aPreventDefault);
APZThreadUtils::RunOnControllerThread(runnable.forget());
APZThreadUtils::RunOnControllerThread(NewRunnableMethod(
treeManager.get(), &APZCTreeManager::ContentReceivedInputBlock,
aInputBlockId, aPreventDefault));
});
mAPZEventState = new APZEventState(this, mozilla::Move(callback));
@ -977,12 +976,9 @@ void nsBaseWidget::ConfigureAPZCTreeManager()
const nsTArray<TouchBehaviorFlags>& aFlags)
{
MOZ_ASSERT(NS_IsMainThread());
RefPtr<Runnable> runnable =
NS_NewRunnableMethodWithArgs<uint64_t,
StoreCopyPassByLRef<nsTArray<TouchBehaviorFlags>>>(treeManager,
&APZCTreeManager::SetAllowedTouchBehavior,
aInputBlockId, aFlags);
APZThreadUtils::RunOnControllerThread(runnable.forget());
APZThreadUtils::RunOnControllerThread(NewRunnableMethod(
treeManager.get(), &APZCTreeManager::SetAllowedTouchBehavior,
aInputBlockId, aFlags));
};
mRootContentController = CreateRootContentController();
@ -1013,12 +1009,8 @@ nsBaseWidget::SetConfirmedTargetAPZC(uint64_t aInputBlockId,
// Need to specifically bind this since it's overloaded.
void (APZCTreeManager::*setTargetApzcFunc)(uint64_t, const nsTArray<ScrollableLayerGuid>&)
= &APZCTreeManager::SetTargetAPZC;
RefPtr<Runnable> runnable =
NS_NewRunnableMethodWithArgs<uint64_t,
StoreCopyPassByRRef<nsTArray<ScrollableLayerGuid>>>(mAPZC,
setTargetApzcFunc,
aInputBlockId, aTargets);
APZThreadUtils::RunOnControllerThread(runnable.forget());
APZThreadUtils::RunOnControllerThread(NewRunnableMethod(
mAPZC.get(), setTargetApzcFunc, aInputBlockId, aTargets));
}
void
@ -1936,11 +1928,8 @@ nsBaseWidget::StartAsyncScrollbarDrag(const AsyncDragMetrics& aDragMetrics)
int layersId = mCompositorBridgeParent->RootLayerTreeId();;
ScrollableLayerGuid guid(layersId, aDragMetrics.mPresShellId, aDragMetrics.mViewId);
RefPtr<Runnable> runnable =
NS_NewRunnableMethodWithArgs<ScrollableLayerGuid,
AsyncDragMetrics>(mAPZC, &APZCTreeManager::StartScrollbarDrag,
guid, aDragMetrics);
APZThreadUtils::RunOnControllerThread(runnable.forget());
APZThreadUtils::RunOnControllerThread(
NewRunnableMethod(mAPZC.get(), &APZCTreeManager::StartScrollbarDrag, guid, aDragMetrics));
}
already_AddRefed<nsIScreen>

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

@ -74,8 +74,8 @@ FdWatcher::Init()
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
os->AddObserver(this, "xpcom-shutdown", /* ownsWeak = */ false);
RefPtr<Runnable> runnable = NS_NewRunnableMethod(this, &FdWatcher::StartWatching);
XRE_GetIOMessageLoop()->PostTask(runnable.forget());
XRE_GetIOMessageLoop()->PostTask(
NewRunnableMethod(this, &FdWatcher::StartWatching));
}
// Implementations may call this function multiple times if they ensure that

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

@ -89,9 +89,8 @@ public:
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(!strcmp(aTopic, "xpcom-shutdown"));
RefPtr<mozilla::Runnable> runnable =
NS_NewRunnableMethod(this, &FdWatcher::StopWatching);
XRE_GetIOMessageLoop()->PostTask(runnable.forget());
XRE_GetIOMessageLoop()->PostTask(
NewRunnableMethod(this, &FdWatcher::StopWatching));
return NS_OK;
}