GMPStorageParent.h (1431B)
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 5 6 #ifndef GMPStorageParent_h_ 7 #define GMPStorageParent_h_ 8 9 #include "GMPStorage.h" 10 #include "mozilla/gmp/PGMPStorageParent.h" 11 12 namespace mozilla::gmp { 13 14 class GMPParent; 15 16 class GMPStorageParent : public PGMPStorageParent { 17 friend class PGMPStorageParent; 18 19 public: 20 NS_INLINE_DECL_REFCOUNTING(GMPStorageParent) 21 GMPStorageParent(const nsACString& aNodeId, GMPParent* aPlugin); 22 23 nsresult Init(); 24 void Shutdown(); 25 26 protected: 27 mozilla::ipc::IPCResult RecvOpen(const nsACString& aRecordName) override; 28 mozilla::ipc::IPCResult RecvRead(const nsACString& aRecordName) override; 29 mozilla::ipc::IPCResult RecvWrite(const nsACString& aRecordName, 30 nsTArray<uint8_t>&& aBytes) override; 31 mozilla::ipc::IPCResult RecvClose(const nsACString& aRecordName) override; 32 void ActorDestroy(ActorDestroyReason aWhy) override; 33 34 private: 35 ~GMPStorageParent() = default; 36 37 RefPtr<GMPStorage> mStorage; 38 39 const nsCString mNodeId; 40 RefPtr<GMPParent> mPlugin; 41 // True after Shutdown(), or if Init() has not completed successfully. 42 bool mShutdown; 43 }; 44 45 } // namespace mozilla::gmp 46 47 #endif // GMPStorageParent_h_