Line data Source code
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 {
16 : namespace gmp {
17 :
18 0 : class GMPStorage {
19 : public:
20 0 : NS_INLINE_DECL_THREADSAFE_REFCOUNTING(GMPStorage)
21 :
22 : virtual GMPErr Open(const nsCString& aRecordName) = 0;
23 : virtual bool IsOpen(const nsCString& aRecordName) const = 0;
24 : virtual GMPErr Read(const nsCString& aRecordName,
25 : nsTArray<uint8_t>& aOutBytes) = 0;
26 : virtual GMPErr Write(const nsCString& aRecordName,
27 : const nsTArray<uint8_t>& aBytes) = 0;
28 : virtual void Close(const nsCString& aRecordName) = 0;
29 : protected:
30 0 : virtual ~GMPStorage() {}
31 : };
32 :
33 : already_AddRefed<GMPStorage> CreateGMPMemoryStorage();
34 : already_AddRefed<GMPStorage> CreateGMPDiskStorage(const nsCString& aNodeId,
35 : const nsString& aGMPName);
36 :
37 : } // namespace gmp
38 : } // namespace mozilla
39 :
40 : #endif
|