RemoteWorkerOp.cpp (900B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 #include "RemoteWorkerOp.h" 6 7 namespace mozilla::dom::remoteworker { 8 9 WorkerPrivateAccessibleState::~WorkerPrivateAccessibleState() { 10 // We should now only be performing state transitions on the main thread, so 11 // we should assert we're only releasing on the main thread. 12 MOZ_ASSERT(!mWorkerPrivate || NS_IsMainThread()); 13 // mWorkerPrivate can be safely released on the main thread. 14 if (!mWorkerPrivate || NS_IsMainThread()) { 15 return; 16 } 17 // But as a backstop, do proxy the release to the main thread. 18 NS_ReleaseOnMainThread( 19 "RemoteWorkerChild::WorkerPrivateAccessibleState::mWorkerPrivate", 20 mWorkerPrivate.forget()); 21 } 22 23 } // namespace mozilla::dom::remoteworker