Backed out changeset af51821b2fc5 (bug 1268313) for causing very frequent bc7 memory leak

This commit is contained in:
Carsten "Tomcat" Book
2016-04-29 14:22:04 +02:00
parent d10653e369
commit 70be75ac0e
8 changed files with 21 additions and 41 deletions

View File

@@ -1580,7 +1580,7 @@ ContentChild::RecvPBrowserConstructor(PBrowserChild* aActor,
hasRunOnce = true; hasRunOnce = true;
MOZ_ASSERT(!sFirstIdleTask); MOZ_ASSERT(!sFirstIdleTask);
RefPtr<CancelableRunnable> firstIdleTask = NewCancelableRunnableFunction(FirstIdle); RefPtr<CancelableRunnable> firstIdleTask = NewRunnableFunction(FirstIdle);
sFirstIdleTask = firstIdleTask; sFirstIdleTask = firstIdleTask;
MessageLoop::current()->PostIdleTask(firstIdleTask.forget()); MessageLoop::current()->PostIdleTask(firstIdleTask.forget());

View File

@@ -3299,9 +3299,9 @@ PluginInstanceChild::RecvAsyncSetWindow(const gfxSurfaceType& aSurfaceType,
// RPC call, and both Flash and Java don't expect to receive setwindow calls // RPC call, and both Flash and Java don't expect to receive setwindow calls
// at arbitrary times. // at arbitrary times.
mCurrentAsyncSetWindowTask = mCurrentAsyncSetWindowTask =
NewCancelableRunnableMethod<PluginInstanceChild, NewRunnableMethod<PluginInstanceChild,
void (PluginInstanceChild::*)(const gfxSurfaceType&, const NPRemoteWindow&, bool), void (PluginInstanceChild::*)(const gfxSurfaceType&, const NPRemoteWindow&, bool),
const gfxSurfaceType&, const NPRemoteWindow&, bool> const gfxSurfaceType&, const NPRemoteWindow&, bool>
(this, &PluginInstanceChild::DoAsyncSetWindow, (this, &PluginInstanceChild::DoAsyncSetWindow,
aSurfaceType, aWindow, true); aSurfaceType, aWindow, true);
RefPtr<Runnable> addrefedTask = mCurrentAsyncSetWindowTask; RefPtr<Runnable> addrefedTask = mCurrentAsyncSetWindowTask;
@@ -4223,7 +4223,7 @@ PluginInstanceChild::AsyncShowPluginFrame(void)
} }
mCurrentInvalidateTask = mCurrentInvalidateTask =
NewCancelableRunnableMethod(this, &PluginInstanceChild::InvalidateRectDelayed); NewRunnableMethod(this, &PluginInstanceChild::InvalidateRectDelayed);
RefPtr<Runnable> addrefedTask = mCurrentInvalidateTask; RefPtr<Runnable> addrefedTask = mCurrentInvalidateTask;
MessageLoop::current()->PostTask(addrefedTask.forget()); MessageLoop::current()->PostTask(addrefedTask.forget());
} }

View File

@@ -498,7 +498,7 @@ void GestureEventListener::CancelLongTapTimeoutTask()
void GestureEventListener::CreateLongTapTimeoutTask() void GestureEventListener::CreateLongTapTimeoutTask()
{ {
RefPtr<CancelableRunnable> task = RefPtr<CancelableRunnable> task =
NewCancelableRunnableMethod(this, &GestureEventListener::HandleInputTimeoutLongTap); NewRunnableMethod(this, &GestureEventListener::HandleInputTimeoutLongTap);
mLongTapTimeoutTask = task; mLongTapTimeoutTask = task;
mAsyncPanZoomController->PostDelayedTask( mAsyncPanZoomController->PostDelayedTask(
@@ -525,8 +525,8 @@ void GestureEventListener::CreateMaxTapTimeoutTask()
TouchBlockState* block = mAsyncPanZoomController->GetInputQueue()->CurrentTouchBlock(); TouchBlockState* block = mAsyncPanZoomController->GetInputQueue()->CurrentTouchBlock();
RefPtr<CancelableRunnable> task = RefPtr<CancelableRunnable> task =
NewCancelableRunnableMethod(this, &GestureEventListener::HandleInputTimeoutMaxTap, NewRunnableMethod(this, &GestureEventListener::HandleInputTimeoutMaxTap,
block->IsDuringFastFling()); block->IsDuringFastFling());
mMaxTapTimeoutTask = task; mMaxTapTimeoutTask = task;
mAsyncPanZoomController->PostDelayedTask( mAsyncPanZoomController->PostDelayedTask(

View File

@@ -94,7 +94,7 @@ ActiveElementManager::TriggerElementActivation()
// bug properly should make this unnecessary. // bug properly should make this unnecessary.
MOZ_ASSERT(mSetActiveTask == nullptr); MOZ_ASSERT(mSetActiveTask == nullptr);
RefPtr<CancelableRunnable> task = NewCancelableRunnableMethod( RefPtr<CancelableRunnable> task = NewRunnableMethod(
this, &ActiveElementManager::SetActiveTask, mTarget); this, &ActiveElementManager::SetActiveTask, mTarget);
mSetActiveTask = task; mSetActiveTask = task;
MessageLoop::current()->PostDelayedTask(task.forget(), sActivationDelayMs); MessageLoop::current()->PostDelayedTask(task.forget(), sActivationDelayMs);

View File

@@ -427,8 +427,8 @@ CompositorVsyncScheduler::PostCompositeTask(TimeStamp aCompositeTimestamp)
MonitorAutoLock lock(mCurrentCompositeTaskMonitor); MonitorAutoLock lock(mCurrentCompositeTaskMonitor);
if (mCurrentCompositeTask == nullptr) { if (mCurrentCompositeTask == nullptr) {
RefPtr<CancelableRunnable> task = RefPtr<CancelableRunnable> task =
NewCancelableRunnableMethod(this, &CompositorVsyncScheduler::Composite, NewRunnableMethod(this, &CompositorVsyncScheduler::Composite,
aCompositeTimestamp); aCompositeTimestamp);
mCurrentCompositeTask = task; mCurrentCompositeTask = task;
ScheduleTask(task.forget(), 0); ScheduleTask(task.forget(), 0);
} }
@@ -481,7 +481,7 @@ CompositorVsyncScheduler::SetNeedsComposite()
if (!CompositorBridgeParent::IsInCompositorThread()) { if (!CompositorBridgeParent::IsInCompositorThread()) {
MonitorAutoLock lock(mSetNeedsCompositeMonitor); MonitorAutoLock lock(mSetNeedsCompositeMonitor);
RefPtr<CancelableRunnable> task = RefPtr<CancelableRunnable> task =
NewCancelableRunnableMethod(this, &CompositorVsyncScheduler::SetNeedsComposite); NewRunnableMethod(this, &CompositorVsyncScheduler::SetNeedsComposite);
mSetNeedsCompositeTask = task; mSetNeedsCompositeTask = task;
ScheduleTask(task.forget(), 0); ScheduleTask(task.forget(), 0);
return; return;
@@ -1365,7 +1365,7 @@ CompositorBridgeParent::ScheduleRotationOnCompositorThread(const TargetConfig& a
if (mForceCompositionTask != nullptr) { if (mForceCompositionTask != nullptr) {
mForceCompositionTask->Cancel(); mForceCompositionTask->Cancel();
} }
RefPtr<CancelableRunnable> task = NewCancelableRunnableMethod(this, &CompositorBridgeParent::ForceComposition); RefPtr<CancelableRunnable> task = NewRunnableMethod(this, &CompositorBridgeParent::ForceComposition);
mForceCompositionTask = task; mForceCompositionTask = task;
ScheduleTask(task.forget(), gfxPrefs::OrientationSyncMillis()); ScheduleTask(task.forget(), gfxPrefs::OrientationSyncMillis());
} }

View File

@@ -128,11 +128,11 @@ SoftwareDisplay::ScheduleNextVsync(mozilla::TimeStamp aVsyncTimestamp)
nextVsync = mozilla::TimeStamp::Now(); nextVsync = mozilla::TimeStamp::Now();
} }
mCurrentVsyncTask = NewCancelableRunnableMethod(this, mCurrentVsyncTask = NewRunnableMethod(this,
&SoftwareDisplay::NotifyVsync, &SoftwareDisplay::NotifyVsync,
nextVsync); nextVsync);
RefPtr<mozilla::Runnable> addrefedTask = mCurrentVsyncTask; RefPtr<mozilla::CancelableRunnable> addrefedTask = mCurrentVsyncTask;
mVsyncThread->message_loop()->PostDelayedTask( mVsyncThread->message_loop()->PostDelayedTask(
addrefedTask.forget(), addrefedTask.forget(),
delay.ToMilliseconds()); delay.ToMilliseconds());

View File

@@ -305,19 +305,9 @@ class RunnableMethod : public mozilla::CancelableRunnable,
template <class T, class Method, typename... Args> template <class T, class Method, typename... Args>
inline already_AddRefed<mozilla::CancelableRunnable> inline already_AddRefed<mozilla::CancelableRunnable>
NewCancelableRunnableMethod(T* object, Method method, Args&&... args) {
typedef mozilla::Tuple<typename mozilla::Decay<Args>::Type...> ArgsTuple;
RefPtr<mozilla::CancelableRunnable> t =
new RunnableMethod<T, Method, ArgsTuple>(object, method,
mozilla::MakeTuple(mozilla::Forward<Args>(args)...));
return t.forget();
}
template <class T, class Method, typename... Args>
inline already_AddRefed<mozilla::Runnable>
NewRunnableMethod(T* object, Method method, Args&&... args) { NewRunnableMethod(T* object, Method method, Args&&... args) {
typedef mozilla::Tuple<typename mozilla::Decay<Args>::Type...> ArgsTuple; typedef mozilla::Tuple<typename mozilla::Decay<Args>::Type...> ArgsTuple;
RefPtr<mozilla::Runnable> t = RefPtr<mozilla::CancelableRunnable> t =
new RunnableMethod<T, Method, ArgsTuple>(object, method, new RunnableMethod<T, Method, ArgsTuple>(object, method,
mozilla::MakeTuple(mozilla::Forward<Args>(args)...)); mozilla::MakeTuple(mozilla::Forward<Args>(args)...));
return t.forget(); return t.forget();
@@ -352,7 +342,7 @@ class RunnableFunction : public mozilla::CancelableRunnable {
template <class Function, typename... Args> template <class Function, typename... Args>
inline already_AddRefed<mozilla::CancelableRunnable> inline already_AddRefed<mozilla::CancelableRunnable>
NewCancelableRunnableFunction(Function function, Args&&... args) { NewRunnableFunction(Function function, Args&&... args) {
typedef mozilla::Tuple<typename mozilla::Decay<Args>::Type...> ArgsTuple; typedef mozilla::Tuple<typename mozilla::Decay<Args>::Type...> ArgsTuple;
RefPtr<mozilla::CancelableRunnable> t = RefPtr<mozilla::CancelableRunnable> t =
new RunnableFunction<Function, ArgsTuple>(function, new RunnableFunction<Function, ArgsTuple>(function,
@@ -360,14 +350,4 @@ NewCancelableRunnableFunction(Function function, Args&&... args) {
return t.forget(); return t.forget();
} }
template <class Function, typename... Args>
inline already_AddRefed<mozilla::Runnable>
NewRunnableFunction(Function function, Args&&... args) {
typedef mozilla::Tuple<typename mozilla::Decay<Args>::Type...> ArgsTuple;
RefPtr<mozilla::Runnable> t =
new RunnableFunction<Function, ArgsTuple>(function,
mozilla::MakeTuple(mozilla::Forward<Args>(args)...));
return t.forget();
}
#endif // BASE_TASK_H_ #endif // BASE_TASK_H_

View File

@@ -502,11 +502,11 @@ MessageChannel::MessageChannel(MessageListener *aListener)
mIsSyncWaitingOnNonMainThread = false; mIsSyncWaitingOnNonMainThread = false;
#endif #endif
mDequeueOneTask = new RefCountedTask(NewCancelableRunnableMethod( mDequeueOneTask = new RefCountedTask(NewRunnableMethod(
this, this,
&MessageChannel::OnMaybeDequeueOne)); &MessageChannel::OnMaybeDequeueOne));
mOnChannelConnectedTask = new RefCountedTask(NewCancelableRunnableMethod( mOnChannelConnectedTask = new RefCountedTask(NewRunnableMethod(
this, this,
&MessageChannel::DispatchOnChannelConnected)); &MessageChannel::DispatchOnChannelConnected));
@@ -2091,7 +2091,7 @@ MessageChannel::OnNotifyMaybeChannelError()
if (IsOnCxxStack()) { if (IsOnCxxStack()) {
mChannelErrorTask = mChannelErrorTask =
NewCancelableRunnableMethod(this, &MessageChannel::OnNotifyMaybeChannelError); NewRunnableMethod(this, &MessageChannel::OnNotifyMaybeChannelError);
RefPtr<Runnable> task = mChannelErrorTask; RefPtr<Runnable> task = mChannelErrorTask;
// 10 ms delay is completely arbitrary // 10 ms delay is completely arbitrary
mWorkerLoop->PostDelayedTask(task.forget(), 10); mWorkerLoop->PostDelayedTask(task.forget(), 10);
@@ -2111,7 +2111,7 @@ MessageChannel::PostErrorNotifyTask()
// This must be the last code that runs on this thread! // This must be the last code that runs on this thread!
mChannelErrorTask = mChannelErrorTask =
NewCancelableRunnableMethod(this, &MessageChannel::OnNotifyMaybeChannelError); NewRunnableMethod(this, &MessageChannel::OnNotifyMaybeChannelError);
RefPtr<Runnable> task = mChannelErrorTask; RefPtr<Runnable> task = mChannelErrorTask;
mWorkerLoop->PostTask(task.forget()); mWorkerLoop->PostTask(task.forget());
} }