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,
|
2015-03-27 21:52:19 +03:00
|
|
|
public VsyncObserver
|
2015-01-14 02:37:00 +03:00
|
|
|
{
|
|
|
|
friend class mozilla::ipc::BackgroundParentImpl;
|
|
|
|
|
|
|
|
private:
|
|
|
|
static already_AddRefed<VsyncParent> Create();
|
|
|
|
|
|
|
|
VsyncParent();
|
|
|
|
virtual ~VsyncParent();
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool NotifyVsync(TimeStamp aTimeStamp) override;
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult RecvRequestVsyncRate() override;
|
2015-01-14 02:37:00 +03:00
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult RecvObserve() override;
|
|
|
|
virtual mozilla::ipc::IPCResult RecvUnobserve() override;
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void ActorDestroy(ActorDestroyReason aActorDestroyReason) override;
|
2015-01-14 02:37:00 +03:00
|
|
|
|
|
|
|
void DispatchVsyncEvent(TimeStamp aTimeStamp);
|
|
|
|
|
|
|
|
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
|