GMPStorage.h (1382B)
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 GMPStorage_h_ 7 #define GMPStorage_h_ 8 9 #include "gmp-storage.h" 10 #include "mozilla/AlreadyAddRefed.h" 11 #include "nsISupportsImpl.h" 12 #include "nsString.h" 13 #include "nsTArray.h" 14 15 namespace mozilla::gmp { 16 17 class GMPStorage { 18 public: 19 NS_INLINE_DECL_THREADSAFE_REFCOUNTING(GMPStorage) 20 21 virtual GMPErr Open(const nsACString& aRecordName) = 0; 22 virtual bool IsOpen(const nsACString& aRecordName) const = 0; 23 virtual GMPErr Read(const nsACString& aRecordName, 24 nsTArray<uint8_t>& aOutBytes) = 0; 25 virtual GMPErr Write(const nsACString& aRecordName, 26 const nsTArray<uint8_t>& aBytes) = 0; 27 virtual void Close(const nsACString& aRecordName) = 0; 28 29 protected: 30 virtual ~GMPStorage() = default; 31 }; 32 33 already_AddRefed<GMPStorage> CreateGMPMemoryStorage(const nsACString& aNodeId, 34 const nsAString& aGMPName); 35 already_AddRefed<GMPStorage> CreateGMPDiskStorage(const nsACString& aNodeId, 36 const nsAString& aGMPName); 37 38 } // namespace mozilla::gmp 39 40 #endif