SharedWorkerOp.h (1141B)
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 #ifndef mozilla_dom_sharedworkerop_h__ 6 #define mozilla_dom_sharedworkerop_h__ 7 8 #include "mozilla/SchedulerGroup.h" 9 #include "mozilla/dom/RemoteWorkerOp.h" 10 #include "mozilla/dom/SharedWorkerOpArgs.h" 11 12 namespace mozilla::dom { 13 14 using remoteworker::RemoteWorkerState; 15 16 class SharedWorkerOp : public RemoteWorkerOp { 17 public: 18 NS_INLINE_DECL_THREADSAFE_REFCOUNTING(SharedWorkerOp, override) 19 20 explicit SharedWorkerOp(SharedWorkerOpArgs&& aArgs); 21 22 bool MaybeStart(RemoteWorkerChild* aOwner, 23 RemoteWorkerState& aState) override; 24 25 void StartOnMainThread(RefPtr<RemoteWorkerChild>& aOwner) final; 26 27 void Start(RemoteWorkerNonLifeCycleOpControllerChild* aOwner, 28 RemoteWorkerState& aState) final; 29 30 void Cancel() override; 31 32 private: 33 ~SharedWorkerOp(); 34 35 bool IsTerminationOp() const; 36 37 SharedWorkerOpArgs mOpArgs; 38 39 #ifdef DEBUG 40 bool mStarted = false; 41 #endif 42 }; 43 44 } // namespace mozilla::dom 45 46 #endif