Line data Source code
1 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /* vim: set ts=8 sts=2 et sw=2 tw=99: */
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 include_gfx_ipc_VsyncBridgeChild_h
7 : #define include_gfx_ipc_VsyncBridgeChild_h
8 :
9 : #include "mozilla/RefPtr.h"
10 : #include "mozilla/gfx/PVsyncBridgeChild.h"
11 :
12 : namespace mozilla {
13 : namespace gfx {
14 :
15 : class VsyncIOThreadHolder;
16 :
17 : class VsyncBridgeChild final : public PVsyncBridgeChild
18 : {
19 : friend class NotifyVsyncTask;
20 :
21 : public:
22 0 : NS_INLINE_DECL_THREADSAFE_REFCOUNTING(VsyncBridgeChild)
23 :
24 : static RefPtr<VsyncBridgeChild> Create(RefPtr<VsyncIOThreadHolder> aThread,
25 : const uint64_t& aProcessToken,
26 : Endpoint<PVsyncBridgeChild>&& aEndpoint);
27 :
28 : void Close();
29 :
30 : void ActorDestroy(ActorDestroyReason aWhy) override;
31 : void DeallocPVsyncBridgeChild() override;
32 : void ProcessingError(Result aCode, const char* aReason) override;
33 :
34 : void NotifyVsync(TimeStamp aTimeStamp, const uint64_t& aLayersId);
35 :
36 : virtual void HandleFatalError(const char* aName, const char* aMsg) const override;
37 :
38 : private:
39 : VsyncBridgeChild(RefPtr<VsyncIOThreadHolder>, const uint64_t& aProcessToken);
40 : ~VsyncBridgeChild();
41 :
42 : void Open(Endpoint<PVsyncBridgeChild>&& aEndpoint);
43 :
44 : void NotifyVsyncImpl(TimeStamp aTimeStamp, const uint64_t& aLayersId);
45 :
46 : bool IsOnVsyncIOThread() const;
47 :
48 : private:
49 : RefPtr<VsyncIOThreadHolder> mThread;
50 : MessageLoop* mLoop;
51 : uint64_t mProcessToken;
52 : };
53 :
54 : } // namespace gfx
55 : } // namespace mozilla
56 :
57 : #endif // include_gfx_ipc_VsyncBridgeChild_h
|