RemoteWorkerNonLifeCycleOpControllerChild.h (1734B)
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_RemoteWorkerNonLifeCycleOpControllerChild_h 6 #define mozilla_dom_RemoteWorkerNonLifeCycleOpControllerChild_h 7 8 #include "mozilla/DataMutex.h" 9 #include "mozilla/dom/PRemoteWorkerNonLifeCycleOpControllerChild.h" 10 #include "mozilla/dom/RemoteWorkerOp.h" 11 #include "mozilla/dom/ServiceWorkerOpArgs.h" 12 #include "mozilla/dom/SharedWorkerOpArgs.h" 13 #include "nsISupportsImpl.h" 14 15 using mozilla::ipc::IPCResult; 16 17 namespace mozilla::dom { 18 19 using remoteworker::RemoteWorkerState; 20 21 class ServiceWorkerOp; 22 23 class RemoteWorkerNonLifeCycleOpControllerChild final 24 : public PRemoteWorkerNonLifeCycleOpControllerChild { 25 friend class PRemoteWorkerNonLifeCycleOpControllerChild; 26 friend class ServiceWorkerOp; 27 28 public: 29 NS_INLINE_DECL_THREADSAFE_REFCOUNTING( 30 RemoteWorkerNonLifeCycleOpControllerChild, final) 31 32 static RefPtr<RemoteWorkerNonLifeCycleOpControllerChild> Create(); 33 34 RemoteWorkerNonLifeCycleOpControllerChild(); 35 36 IPCResult RecvExecOp(SharedWorkerOpArgs&& aOpArgs); 37 38 IPCResult RecvExecServiceWorkerOp(ServiceWorkerOpArgs&& aOpArgs, 39 ExecServiceWorkerOpResolver&& aResolve); 40 41 IPCResult RecvShutdown(); 42 43 void TransistionStateToCanceled(); 44 void TransistionStateToKilled(); 45 46 void ErrorPropagation(nsresult aError); 47 48 private: 49 void StartOp(RefPtr<RemoteWorkerOp>&& aOp); 50 ~RemoteWorkerNonLifeCycleOpControllerChild(); 51 52 DataMutex<RemoteWorkerState> mState; 53 }; 54 55 } // namespace mozilla::dom 56 57 #endif // mozilla_dom_RemoteWorkerNonLifeCycleOpControllerChild_h