зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1368296 - Renaming WorkerProxyToMainThreadRunnable::RunBackOnWorkerThread to RunBackOnWorkerThreadForCleanup and improving the description for this method, r=asuth
This commit is contained in:
Родитель
bf0d0e8855
Коммит
31b48170ed
|
@ -3622,7 +3622,7 @@ private:
|
|||
}
|
||||
|
||||
void
|
||||
RunBackOnWorkerThread() override
|
||||
RunBackOnWorkerThreadForCleanup() override
|
||||
{}
|
||||
};
|
||||
|
||||
|
|
|
@ -337,12 +337,12 @@ public:
|
|||
mWorkerPrivate->AssertIsOnWorkerThread();
|
||||
|
||||
if (NS_WARN_IF(!PreDispatch(aCx))) {
|
||||
RunBackOnWorkerThread();
|
||||
RunBackOnWorkerThreadForCleanup();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (NS_WARN_IF(!WorkerProxyToMainThreadRunnable::Dispatch())) {
|
||||
// RunBackOnWorkerThread() will be called by
|
||||
// RunBackOnWorkerThreadForCleanup() will be called by
|
||||
// WorkerProxyToMainThreadRunnable::Dispatch().
|
||||
return false;
|
||||
}
|
||||
|
@ -421,7 +421,7 @@ protected:
|
|||
}
|
||||
|
||||
void
|
||||
RunBackOnWorkerThread() override
|
||||
RunBackOnWorkerThreadForCleanup() override
|
||||
{
|
||||
mWorkerPrivate->AssertIsOnWorkerThread();
|
||||
ReleaseData();
|
||||
|
|
|
@ -677,13 +677,13 @@ WorkerProxyToMainThreadRunnable::Dispatch()
|
|||
mWorkerPrivate->AssertIsOnWorkerThread();
|
||||
|
||||
if (NS_WARN_IF(!HoldWorker())) {
|
||||
RunBackOnWorkerThread();
|
||||
RunBackOnWorkerThreadForCleanup();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (NS_WARN_IF(NS_FAILED(mWorkerPrivate->DispatchToMainThread(this)))) {
|
||||
ReleaseWorker();
|
||||
RunBackOnWorkerThread();
|
||||
RunBackOnWorkerThreadForCleanup();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -715,7 +715,8 @@ WorkerProxyToMainThreadRunnable::PostDispatchOnMainThread()
|
|||
MOZ_ASSERT(aRunnable);
|
||||
}
|
||||
|
||||
// We must call RunBackOnWorkerThread() also if the runnable is canceled.
|
||||
// We must call RunBackOnWorkerThreadForCleanup() also if the runnable is
|
||||
// canceled.
|
||||
nsresult
|
||||
Cancel() override
|
||||
{
|
||||
|
@ -730,7 +731,7 @@ WorkerProxyToMainThreadRunnable::PostDispatchOnMainThread()
|
|||
aWorkerPrivate->AssertIsOnWorkerThread();
|
||||
|
||||
if (mRunnable) {
|
||||
mRunnable->RunBackOnWorkerThread();
|
||||
mRunnable->RunBackOnWorkerThreadForCleanup();
|
||||
|
||||
// Let's release the worker thread.
|
||||
mRunnable->ReleaseWorker();
|
||||
|
|
|
@ -415,6 +415,12 @@ private:
|
|||
// This runnable is an helper class for dispatching something from a worker
|
||||
// thread to the main-thread and back to the worker-thread. During this
|
||||
// operation, this class will keep the worker alive.
|
||||
// The purpose of RunBackOnWorkerThreadForCleanup() must be used, as the name
|
||||
// says, only to release resources, no JS has to be executed, no timers, or
|
||||
// other things. The reason of such limitations is that, in order to execute
|
||||
// this method in any condition (also when the worker is shutting down), a
|
||||
// Control Runnable is used, and, this could generate a reordering of existing
|
||||
// runnables.
|
||||
class WorkerProxyToMainThreadRunnable : public Runnable
|
||||
{
|
||||
protected:
|
||||
|
@ -426,7 +432,7 @@ protected:
|
|||
virtual void RunOnMainThread() = 0;
|
||||
|
||||
// After this second method is called on the worker-thread.
|
||||
virtual void RunBackOnWorkerThread() = 0;
|
||||
virtual void RunBackOnWorkerThreadForCleanup() = 0;
|
||||
|
||||
public:
|
||||
bool Dispatch();
|
||||
|
|
Загрузка…
Ссылка в новой задаче