ClientSourceOpChild.h (1376B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 #ifndef _mozilla_dom_ClientSourceOpChild_h 7 #define _mozilla_dom_ClientSourceOpChild_h 8 9 #include "ClientOpPromise.h" 10 #include "mozilla/dom/FlippedOnce.h" 11 #include "mozilla/dom/PClientSourceOpChild.h" 12 13 namespace mozilla::dom { 14 15 class ClientSource; 16 17 class ClientSourceOpChild final : public PClientSourceOpChild { 18 public: 19 void Init(const ClientOpConstructorArgs& aArgs); 20 21 // Deletes "this" after initialization (or immediately if already 22 // initialized.) It's UB to use "this" after calling ScheduleDeletion. 23 void ScheduleDeletion(); 24 25 private: 26 ~ClientSourceOpChild(); 27 28 void Cleanup(); 29 30 ClientSource* GetSource() const; 31 32 template <typename Method, typename... Args> 33 void DoSourceOp(Method aMethod, Args&&... aArgs); 34 35 // PClientSourceOpChild interface 36 void ActorDestroy(ActorDestroyReason aReason) override; 37 38 MozPromiseRequestHolder<ClientOpPromise> mPromiseRequestHolder; 39 FlippedOnce<false> mDeletionRequested; 40 FlippedOnce<false> mInitialized; 41 }; 42 43 } // namespace mozilla::dom 44 45 #endif // _mozilla_dom_ClientSourceOpChild_h