2017-10-27 20:33:53 +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: */
|
2015-01-14 02:37:00 +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 mozilla_layout_ipc_VsyncParent_h
|
|
|
|
#define mozilla_layout_ipc_VsyncParent_h
|
|
|
|
|
|
|
|
#include "mozilla/layout/PVsyncParent.h"
|
|
|
|
#include "mozilla/VsyncDispatcher.h"
|
|
|
|
#include "nsCOMPtr.h"
|
2015-10-18 08:24:48 +03:00
|
|
|
#include "mozilla/RefPtr.h"
|
2015-01-14 02:37:00 +03:00
|
|
|
|
|
|
|
class nsIThread;
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
|
|
|
|
namespace ipc {
|
|
|
|
class BackgroundParentImpl;
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace ipc
|
2015-01-14 02:37:00 +03:00
|
|
|
|
|
|
|
namespace layout {
|
|
|
|
|
|
|
|
// Use PBackground thread in the main process to send vsync notifications to
|
|
|
|
// content process. This actor will be released when its parent protocol calls
|
|
|
|
// DeallocPVsyncParent().
|
2015-03-21 19:28:04 +03:00
|
|
|
class VsyncParent final : public PVsyncParent, public VsyncObserver {
|
2015-01-14 02:37:00 +03:00
|
|
|
friend class mozilla::ipc::BackgroundParentImpl;
|
2019-02-06 18:57:37 +03:00
|
|
|
friend class PVsyncParent;
|
2015-01-14 02:37:00 +03:00
|
|
|
|
|
|
|
private:
|
|
|
|
static already_AddRefed<VsyncParent> Create();
|
|
|
|
|
|
|
|
VsyncParent();
|
|
|
|
virtual ~VsyncParent();
|
|
|
|
|
2018-12-08 02:27:28 +03:00
|
|
|
virtual bool NotifyVsync(const VsyncEvent& aVsync) override;
|
2019-02-06 18:58:43 +03:00
|
|
|
mozilla::ipc::IPCResult RecvRequestVsyncRate();
|
2015-01-14 02:37:00 +03:00
|
|
|
|
2019-02-06 18:58:43 +03:00
|
|
|
mozilla::ipc::IPCResult RecvObserve();
|
|
|
|
mozilla::ipc::IPCResult RecvUnobserve();
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void ActorDestroy(ActorDestroyReason aActorDestroyReason) override;
|
2015-01-14 02:37:00 +03:00
|
|
|
|
2018-12-08 02:27:28 +03:00
|
|
|
void DispatchVsyncEvent(const VsyncEvent& aVsync);
|
2015-01-14 02:37:00 +03:00
|
|
|
|
|
|
|
bool mObservingVsync;
|
|
|
|
bool mDestroyed;
|
|
|
|
nsCOMPtr<nsIThread> mBackgroundThread;
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<RefreshTimerVsyncDispatcher> mVsyncDispatcher;
|
2015-01-14 02:37:00 +03:00
|
|
|
};
|
|
|
|
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace layout
|
|
|
|
} // namespace mozilla
|
2015-01-14 02:37:00 +03:00
|
|
|
|
|
|
|
#endif // mozilla_layout_ipc_VsyncParent_h
|