mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 973767. Put the compositor into test mode via an IPDL transaction. r=mattwoodrow
--HG-- extra : rebase_source : d40cf8624f93b85298cc501ff315522220522fb6
This commit is contained in:
parent
a6743fa666
commit
860f3a36ae
@ -3,13 +3,14 @@
|
||||
* 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/. */
|
||||
|
||||
#include "mozilla/layers/CompositorParent.h"
|
||||
#include "nsDOMWindowUtils.h"
|
||||
|
||||
#include "mozilla/layers/CompositorChild.h"
|
||||
#include "mozilla/layers/LayerTransactionChild.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsDOMClassInfoID.h"
|
||||
#include "nsError.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsDOMWindowUtils.h"
|
||||
#include "nsQueryContentEventResult.h"
|
||||
#include "CompositionStringSynthesizer.h"
|
||||
#include "nsGlobalWindow.h"
|
||||
@ -2548,7 +2549,14 @@ nsDOMWindowUtils::AdvanceTimeAndRefresh(int64_t aMilliseconds)
|
||||
|
||||
nsRefreshDriver* driver = GetPresContext()->RefreshDriver();
|
||||
driver->AdvanceTimeAndRefresh(aMilliseconds);
|
||||
CompositorParent::SetTimeAndSampleAnimations(driver->MostRecentRefresh(), true);
|
||||
|
||||
nsIWidget* widget = GetWidget();
|
||||
if (widget) {
|
||||
CompositorChild* compositor = widget->GetRemoteRenderer();
|
||||
if (compositor) {
|
||||
compositor->SendSetTestSampleTime(driver->MostRecentRefresh());
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -2560,9 +2568,19 @@ nsDOMWindowUtils::RestoreNormalRefresh()
|
||||
return NS_ERROR_DOM_SECURITY_ERR;
|
||||
}
|
||||
|
||||
// Kick the compositor out of test mode before the refresh driver, so that
|
||||
// the refresh driver doesn't send an update that gets ignored by the
|
||||
// compositor.
|
||||
nsIWidget* widget = GetWidget();
|
||||
if (widget) {
|
||||
CompositorChild* compositor = widget->GetRemoteRenderer();
|
||||
if (compositor) {
|
||||
compositor->SendLeaveTestMode();
|
||||
}
|
||||
}
|
||||
|
||||
nsRefreshDriver* driver = GetPresContext()->RefreshDriver();
|
||||
driver->RestoreNormalRefresh();
|
||||
CompositorParent::SetTimeAndSampleAnimations(driver->MostRecentRefresh(), false);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -10,9 +10,13 @@
|
||||
|
||||
#include "nsIDOMWindowUtils.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/BasicEvents.h"
|
||||
|
||||
class nsGlobalWindow;
|
||||
class nsIPresShell;
|
||||
class nsIWidget;
|
||||
class nsPresContext;
|
||||
class nsPoint;
|
||||
|
||||
class nsDOMWindowUtils MOZ_FINAL : public nsIDOMWindowUtils,
|
||||
public nsSupportsWeakReference
|
||||
|
@ -373,6 +373,28 @@ CompositorParent::RecvStopFrameTimeRecording(const uint32_t& aStartIndex,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
CompositorParent::RecvSetTestSampleTime(const TimeStamp& aTime)
|
||||
{
|
||||
if (aTime.IsNull()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
mIsTesting = true;
|
||||
mTestTime = aTime;
|
||||
if (mCompositionManager) {
|
||||
mCompositionManager->TransformShadowTree(aTime);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
CompositorParent::RecvLeaveTestMode()
|
||||
{
|
||||
mIsTesting = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
CompositorParent::ActorDestroy(ActorDestroyReason why)
|
||||
{
|
||||
@ -863,21 +885,6 @@ CompositorParent* CompositorParent::RemoveCompositor(uint64_t id)
|
||||
return retval;
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
CompositorParent::SetTimeAndSampleAnimations(TimeStamp aTime, bool aIsTesting)
|
||||
{
|
||||
if (!sCompositorMap) {
|
||||
return;
|
||||
}
|
||||
for (CompositorMap::iterator it = sCompositorMap->begin(); it != sCompositorMap->end(); ++it) {
|
||||
it->second->mIsTesting = aIsTesting;
|
||||
it->second->mTestTime = aTime;
|
||||
if (it->second->mCompositionManager) {
|
||||
it->second->mCompositionManager->TransformShadowTree(aTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
CompositorParent::RecvNotifyChildCreated(const uint64_t& child)
|
||||
{
|
||||
@ -1013,6 +1020,8 @@ public:
|
||||
virtual bool RecvNotifyRegionInvalidated(const nsIntRegion& aRegion) { return true; }
|
||||
virtual bool RecvStartFrameTimeRecording(const int32_t& aBufferSize, uint32_t* aOutStartIndex) MOZ_OVERRIDE { return true; }
|
||||
virtual bool RecvStopFrameTimeRecording(const uint32_t& aStartIndex, InfallibleTArray<float>* intervals) MOZ_OVERRIDE { return true; }
|
||||
virtual bool RecvSetTestSampleTime(const TimeStamp& aTime) MOZ_OVERRIDE { return true; }
|
||||
virtual bool RecvLeaveTestMode() MOZ_OVERRIDE { return true; }
|
||||
|
||||
virtual PLayerTransactionParent*
|
||||
AllocPLayerTransactionParent(const nsTArray<LayersBackend>& aBackendHints,
|
||||
|
@ -93,6 +93,8 @@ public:
|
||||
virtual bool RecvNotifyRegionInvalidated(const nsIntRegion& aRegion) MOZ_OVERRIDE;
|
||||
virtual bool RecvStartFrameTimeRecording(const int32_t& aBufferSize, uint32_t* aOutStartIndex) MOZ_OVERRIDE;
|
||||
virtual bool RecvStopFrameTimeRecording(const uint32_t& aStartIndex, InfallibleTArray<float>* intervals) MOZ_OVERRIDE;
|
||||
virtual bool RecvSetTestSampleTime(const TimeStamp& aTime) MOZ_OVERRIDE;
|
||||
virtual bool RecvLeaveTestMode() MOZ_OVERRIDE;
|
||||
|
||||
virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE;
|
||||
|
||||
@ -222,19 +224,11 @@ public:
|
||||
|
||||
float ComputeRenderIntegrity();
|
||||
|
||||
/**
|
||||
* Tell all CompositorParents to update their last refresh to aTime and sample
|
||||
* animations at this time stamp. If aIsTesting is true, the
|
||||
* CompositorParents will become "paused" and continue sampling animations at
|
||||
* this time stamp until this function is called again with aIsTesting set to
|
||||
* false.
|
||||
*/
|
||||
static void SetTimeAndSampleAnimations(TimeStamp aTime, bool aIsTesting);
|
||||
|
||||
/**
|
||||
* Returns true if the calling thread is the compositor thread.
|
||||
*/
|
||||
static bool IsInCompositorThread();
|
||||
|
||||
protected:
|
||||
virtual PLayerTransactionParent*
|
||||
AllocPLayerTransactionParent(const nsTArray<LayersBackend>& aBackendHints,
|
||||
|
@ -18,6 +18,7 @@ using mozilla::layers::FrameMetrics::ViewID from "FrameMetrics.h";
|
||||
using mozilla::layers::LayersBackend from "mozilla/layers/LayersTypes.h";
|
||||
using mozilla::CrossProcessMutexHandle from "mozilla/ipc/CrossProcessMutex.h";
|
||||
using mozilla::ipc::SharedMemoryBasic::Handle from "mozilla/ipc/SharedMemoryBasic.h";
|
||||
using class mozilla::TimeStamp from "mozilla/TimeStamp.h";
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
@ -77,6 +78,12 @@ parent:
|
||||
sync StopFrameTimeRecording(uint32_t startIndex)
|
||||
returns (float[] intervals);
|
||||
|
||||
// Enter test mode, set the sample time to sampleTime, and resample animations.
|
||||
// sampleTime must not be null.
|
||||
sync SetTestSampleTime(TimeStamp sampleTime);
|
||||
// Leave test mode and resume normal compositing
|
||||
sync LeaveTestMode();
|
||||
|
||||
// layersBackendHints is an ordered list of preffered backends where
|
||||
// layersBackendHints[0] is the best backend. If any hints are LayersBackend::LAYERS_NONE
|
||||
// that hint is ignored.
|
||||
|
Loading…
Reference in New Issue
Block a user