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 GMPStorageParent_h_
7 : #define GMPStorageParent_h_
8 :
9 : #include "mozilla/gmp/PGMPStorageParent.h"
10 : #include "GMPStorage.h"
11 :
12 : namespace mozilla {
13 : namespace gmp {
14 :
15 : class GMPParent;
16 :
17 : class GMPStorageParent : public PGMPStorageParent {
18 : public:
19 0 : NS_INLINE_DECL_REFCOUNTING(GMPStorageParent)
20 : GMPStorageParent(const nsCString& aNodeId,
21 : GMPParent* aPlugin);
22 :
23 : nsresult Init();
24 : void Shutdown();
25 :
26 : protected:
27 : mozilla::ipc::IPCResult RecvOpen(const nsCString& aRecordName) override;
28 : mozilla::ipc::IPCResult RecvRead(const nsCString& aRecordName) override;
29 : mozilla::ipc::IPCResult RecvWrite(const nsCString& aRecordName,
30 : InfallibleTArray<uint8_t>&& aBytes) override;
31 : mozilla::ipc::IPCResult RecvClose(const nsCString& aRecordName) override;
32 : void ActorDestroy(ActorDestroyReason aWhy) override;
33 :
34 : private:
35 0 : ~GMPStorageParent() {}
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 gmp
46 : } // namespace mozilla
47 :
48 : #endif // GMPStorageParent_h_
|