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;
|
|
|
|
void DeallocPVsyncBridgeChild() override;
|
|
|
|
void ProcessingError(Result aCode, const char* aReason) override;
|
|
|
|
|
2016-07-19 21:56:07 +03:00
|
|
|
void NotifyVsync(TimeStamp aTimeStamp, const uint64_t& aLayersId);
|
|
|
|
|
2016-11-01 19:10:42 +03:00
|
|
|
virtual void HandleFatalError(const char* aName, 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);
|
|
|
|
~VsyncBridgeChild();
|
|
|
|
|
|
|
|
void Open(Endpoint<PVsyncBridgeChild>&& aEndpoint);
|
|
|
|
|
2016-07-19 21:56:07 +03:00
|
|
|
void NotifyVsyncImpl(TimeStamp aTimeStamp, const uint64_t& aLayersId);
|
|
|
|
|
|
|
|
bool IsOnVsyncIOThread() const;
|
|
|
|
|
2016-07-19 21:56:06 +03:00
|
|
|
private:
|
|
|
|
RefPtr<VsyncIOThreadHolder> mThread;
|
|
|
|
MessageLoop* mLoop;
|
|
|
|
uint64_t mProcessToken;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace gfx
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // include_gfx_ipc_VsyncBridgeChild_h
|