зеркало из https://github.com/mozilla/gecko-dev.git
bug 1328964 add CycleCollectedJSContext::GetAsWorkletJSContext() and use it in IsOnWorkletThread() r=smaug
MozReview-Commit-ID: BUujWXYho1G --HG-- extra : rebase_source : 78bb6736f74bb59913bc9499fcfdf7b0baa7870d
This commit is contained in:
Родитель
233abfb95a
Коммит
ad9f69cbf9
|
@ -170,6 +170,8 @@ public:
|
||||||
nsCycleCollector_shutdown();
|
nsCycleCollector_shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WorkletJSContext* GetAsWorkletJSContext() override { return this; }
|
||||||
|
|
||||||
CycleCollectedJSRuntime* CreateRuntime(JSContext* aCx) override
|
CycleCollectedJSRuntime* CreateRuntime(JSContext* aCx) override
|
||||||
{
|
{
|
||||||
return new WorkletJSRuntime(aCx);
|
return new WorkletJSRuntime(aCx);
|
||||||
|
@ -426,8 +428,8 @@ WorkletThread::GetWorkletLoadInfo() const
|
||||||
/* static */ bool
|
/* static */ bool
|
||||||
WorkletThread::IsOnWorkletThread()
|
WorkletThread::IsOnWorkletThread()
|
||||||
{
|
{
|
||||||
const char* threadName = PR_GetThreadName(PR_GetCurrentThread());
|
CycleCollectedJSContext* ccjscx = CycleCollectedJSContext::Get();
|
||||||
return threadName && !strcmp(threadName, "worklet");
|
return ccjscx && ccjscx->GetAsWorkletJSContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */ void
|
/* static */ void
|
||||||
|
|
|
@ -32,6 +32,7 @@ class CycleCollectedJSRuntime;
|
||||||
|
|
||||||
namespace dom {
|
namespace dom {
|
||||||
class Exception;
|
class Exception;
|
||||||
|
class WorkletJSContext;
|
||||||
} // namespace dom
|
} // namespace dom
|
||||||
|
|
||||||
// Contains various stats about the cycle collection.
|
// Contains various stats about the cycle collection.
|
||||||
|
@ -130,6 +131,8 @@ public:
|
||||||
FinalizeNow,
|
FinalizeNow,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
virtual dom::WorkletJSContext* GetAsWorkletJSContext() { return nullptr; }
|
||||||
|
|
||||||
CycleCollectedJSRuntime* Runtime() const
|
CycleCollectedJSRuntime* Runtime() const
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(mRuntime);
|
MOZ_ASSERT(mRuntime);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче