bug 1476514 rename WorkletImpl::TerminateThread to NotifyWorkletFinished r=baku
authorKarl Tomlinson <karlt+@karlt.net>
Wed, 28 Nov 2018 23:45:04 +0000
changeset 507903 704371789faab7c03f3128976d8dc001608f35d5
parent 507902 80f561f7ac764d3a3b181aff4ef01dcdf4b38c67
child 507904 ef4fa2ede44ceb17477001e90a1e0a833887782a
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1476514
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
bug 1476514 rename WorkletImpl::TerminateThread to NotifyWorkletFinished r=baku This is more appropriate when WorkletImpl will not necessarily create a thread. Differential Revision: https://phabricator.services.mozilla.com/D13212
dom/worklet/Worklet.cpp
dom/worklet/WorkletImpl.cpp
dom/worklet/WorkletImpl.h
--- a/dom/worklet/Worklet.cpp
+++ b/dom/worklet/Worklet.cpp
@@ -431,17 +431,17 @@ ExecutionRunnable::RunOnMainThread()
 
 // ---------------------------------------------------------------------------
 // Worklet
 
 NS_IMPL_CYCLE_COLLECTION_CLASS(Worklet)
 
 NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(Worklet)
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mWindow)
-  tmp->mImpl->TerminateThread();
+  tmp->mImpl->NotifyWorkletFinished();
   NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
 NS_IMPL_CYCLE_COLLECTION_UNLINK_END
 
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(Worklet)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mWindow)
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
 
 NS_IMPL_CYCLE_COLLECTION_TRACE_WRAPPERCACHE(Worklet)
@@ -464,17 +464,17 @@ Worklet::Worklet(nsPIDOMWindowInner* aWi
 
 #ifdef RELEASE_OR_BETA
   MOZ_CRASH("This code should not go to release/beta yet!");
 #endif
 }
 
 Worklet::~Worklet()
 {
-  mImpl->TerminateThread();
+  mImpl->NotifyWorkletFinished();
 }
 
 JSObject*
 Worklet::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
 {
   return mImpl->WrapWorklet(aCx, this, aGivenProto);
 }
 
--- a/dom/worklet/WorkletImpl.cpp
+++ b/dom/worklet/WorkletImpl.cpp
@@ -87,25 +87,24 @@ WorkletImpl::GetOrCreateThread()
     // Thread creation. FIXME: this will change.
     mWorkletThread = dom::WorkletThread::Create();
   }
 
   return mWorkletThread;
 }
 
 void
-WorkletImpl::TerminateThread()
+WorkletImpl::NotifyWorkletFinished()
 {
   MOZ_ASSERT(NS_IsMainThread());
-  if (!mWorkletThread) {
-    return;
+
+  if (mWorkletThread) {
+    mWorkletThread->Terminate();
+    mWorkletThread = nullptr;
   }
-
-  mWorkletThread->Terminate();
-  mWorkletThread = nullptr;
   mWorkletLoadInfo.mPrincipal = nullptr;
 }
 
 nsresult
 WorkletImpl::DispatchRunnable(already_AddRefed<nsIRunnable> aRunnable)
 {
   // TODO: bug 1492011 re ConsoleWorkletRunnable.
   MOZ_ASSERT(mWorkletThread);
--- a/dom/worklet/WorkletImpl.h
+++ b/dom/worklet/WorkletImpl.h
@@ -70,17 +70,17 @@ public:
 
   // Methods for parent thread only:
 
   virtual JSObject*
   WrapWorklet(JSContext* aCx, dom::Worklet* aWorklet,
               JS::Handle<JSObject*> aGivenProto);
 
   dom::WorkletThread* GetOrCreateThread();
-  void TerminateThread();
+  void NotifyWorkletFinished();
 
   // Execution thread only.
   already_AddRefed<dom::WorkletGlobalScope> CreateGlobalScope(JSContext* aCx);
 
   // Any thread.
 
   const WorkletLoadInfo& LoadInfo() const { return mWorkletLoadInfo; }