2017-10-28 02:10:06 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2016-07-19 21:56:06 +03:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#ifndef include_gfx_ipc_VsyncBridgeChild_h
|
|
|
|
#define include_gfx_ipc_VsyncBridgeChild_h
|
|
|
|
|
|
|
|
#include "mozilla/RefPtr.h"
|
|
|
|
#include "mozilla/gfx/PVsyncBridgeChild.h"
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace gfx {
|
|
|
|
|
|
|
|
class VsyncIOThreadHolder;
|
|
|
|
|
|
|
|
class VsyncBridgeChild final : public PVsyncBridgeChild {
|
2016-07-19 21:56:07 +03:00
|
|
|
friend class NotifyVsyncTask;
|
|
|
|
|
2016-07-19 21:56:06 +03:00
|
|
|
public:
|
|
|
|
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(VsyncBridgeChild)
|
|
|
|
|
|
|
|
static RefPtr<VsyncBridgeChild> Create(
|
|
|
|
RefPtr<VsyncIOThreadHolder> aThread, const uint64_t& aProcessToken,
|
|
|
|
Endpoint<PVsyncBridgeChild>&& aEndpoint);
|
|
|
|
|
|
|
|
void Close();
|
|
|
|
|
|
|
|
void ActorDestroy(ActorDestroyReason aWhy) override;
|
2019-05-21 20:04:21 +03:00
|
|
|
void ActorDealloc() override;
|
2016-07-19 21:56:06 +03:00
|
|
|
void ProcessingError(Result aCode, const char* aReason) override;
|
|
|
|
|
2018-12-08 02:27:28 +03:00
|
|
|
void NotifyVsync(const VsyncEvent& aVsync, const layers::LayersId& aLayersId);
|
2016-07-19 21:56:07 +03:00
|
|
|
|
2019-04-11 15:36:51 +03:00
|
|
|
void HandleFatalError(const char* aMsg) const override;
|
2016-10-04 11:31:27 +03:00
|
|
|
|
2016-07-19 21:56:06 +03:00
|
|
|
private:
|
|
|
|
VsyncBridgeChild(RefPtr<VsyncIOThreadHolder>, const uint64_t& aProcessToken);
|
2019-04-11 15:36:51 +03:00
|
|
|
virtual ~VsyncBridgeChild();
|
2016-07-19 21:56:06 +03:00
|
|
|
|
|
|
|
void Open(Endpoint<PVsyncBridgeChild>&& aEndpoint);
|
|
|
|
|
2018-12-08 02:27:28 +03:00
|
|
|
void NotifyVsyncImpl(const VsyncEvent& aVsync,
|
|
|
|
const layers::LayersId& aLayersId);
|
2016-07-19 21:56:07 +03:00
|
|
|
|
|
|
|
bool IsOnVsyncIOThread() const;
|
|
|
|
|
2016-07-19 21:56:06 +03:00
|
|
|
private:
|
|
|
|
RefPtr<VsyncIOThreadHolder> mThread;
|
|
|
|
uint64_t mProcessToken;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace gfx
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // include_gfx_ipc_VsyncBridgeChild_h
|