2015-01-13 23:37:00 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* 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_VsyncChild_h
|
|
|
|
#define mozilla_layout_ipc_VsyncChild_h
|
|
|
|
|
|
|
|
#include "mozilla/layout/PVsyncChild.h"
|
2015-01-29 21:19:00 +00:00
|
|
|
#include "nsISupportsImpl.h"
|
2015-07-29 00:52:52 +00:00
|
|
|
#include "mozilla/nsRefPtr.h"
|
2015-01-13 23:37:00 +00:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
|
|
|
|
class VsyncObserver;
|
|
|
|
|
|
|
|
namespace ipc {
|
|
|
|
class BackgroundChildImpl;
|
2015-07-13 15:25:42 +00:00
|
|
|
} // namespace ipc
|
2015-01-13 23:37:00 +00:00
|
|
|
|
|
|
|
namespace layout {
|
|
|
|
|
|
|
|
// The PVsyncChild actor receives a vsync event from the main process and
|
|
|
|
// delivers it to the child process. Currently this is restricted to the main
|
|
|
|
// thread only. The actor will stay alive until the process dies or its
|
|
|
|
// PVsyncParent actor dies.
|
2015-03-21 16:28:04 +00:00
|
|
|
class VsyncChild final : public PVsyncChild
|
2015-01-13 23:37:00 +00:00
|
|
|
{
|
2015-01-29 21:19:00 +00:00
|
|
|
NS_INLINE_DECL_REFCOUNTING(VsyncChild)
|
|
|
|
|
2015-01-13 23:37:00 +00:00
|
|
|
friend class mozilla::ipc::BackgroundChildImpl;
|
|
|
|
|
|
|
|
public:
|
|
|
|
// Hide the SendObserve/SendUnobserve in PVsyncChild. We add an flag
|
|
|
|
// mObservingVsync to handle the race problem of unobserving vsync event.
|
|
|
|
bool SendObserve();
|
|
|
|
bool SendUnobserve();
|
|
|
|
|
|
|
|
// Bind a VsyncObserver into VsyncChild after ipc channel connected.
|
|
|
|
void SetVsyncObserver(VsyncObserver* aVsyncObserver);
|
|
|
|
|
|
|
|
private:
|
|
|
|
VsyncChild();
|
|
|
|
virtual ~VsyncChild();
|
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual bool RecvNotify(const TimeStamp& aVsyncTimestamp) override;
|
|
|
|
virtual void ActorDestroy(ActorDestroyReason aActorDestroyReason) override;
|
2015-01-13 23:37:00 +00:00
|
|
|
|
|
|
|
bool mObservingVsync;
|
2015-01-29 21:19:00 +00:00
|
|
|
bool mIsShutdown;
|
2015-01-13 23:37:00 +00:00
|
|
|
|
|
|
|
// The content side vsync observer.
|
|
|
|
nsRefPtr<VsyncObserver> mObserver;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace layout
|
2015-07-13 15:25:42 +00:00
|
|
|
} // namespace mozilla
|
2015-01-13 23:37:00 +00:00
|
|
|
|
|
|
|
#endif // mozilla_layout_ipc_VsyncChild_h
|