зеркало из 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();
|
||||
}
|
||||
|
||||
WorkletJSContext* GetAsWorkletJSContext() override { return this; }
|
||||
|
||||
CycleCollectedJSRuntime* CreateRuntime(JSContext* aCx) override
|
||||
{
|
||||
return new WorkletJSRuntime(aCx);
|
||||
|
@ -426,8 +428,8 @@ WorkletThread::GetWorkletLoadInfo() const
|
|||
/* static */ bool
|
||||
WorkletThread::IsOnWorkletThread()
|
||||
{
|
||||
const char* threadName = PR_GetThreadName(PR_GetCurrentThread());
|
||||
return threadName && !strcmp(threadName, "worklet");
|
||||
CycleCollectedJSContext* ccjscx = CycleCollectedJSContext::Get();
|
||||
return ccjscx && ccjscx->GetAsWorkletJSContext();
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
|
|
|
@ -32,6 +32,7 @@ class CycleCollectedJSRuntime;
|
|||
|
||||
namespace dom {
|
||||
class Exception;
|
||||
class WorkletJSContext;
|
||||
} // namespace dom
|
||||
|
||||
// Contains various stats about the cycle collection.
|
||||
|
@ -130,6 +131,8 @@ public:
|
|||
FinalizeNow,
|
||||
};
|
||||
|
||||
virtual dom::WorkletJSContext* GetAsWorkletJSContext() { return nullptr; }
|
||||
|
||||
CycleCollectedJSRuntime* Runtime() const
|
||||
{
|
||||
MOZ_ASSERT(mRuntime);
|
||||
|
|
Загрузка…
Ссылка в новой задаче