mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 03:15:11 +00:00
Bug 1330037 - Propagate the CompositorOptions over to TabChild and keep a copy there. r=dvander
MozReview-Commit-ID: IQSm5cHkW4z --HG-- extra : rebase_source : 4d340257394d1d641a208a83e93f84e1d24f9056
This commit is contained in:
parent
a6072f9a62
commit
619cad37b5
@ -388,13 +388,6 @@ TabChild::TabChild(nsIContentChild* aManager,
|
||||
, mNativeWindowHandle(0)
|
||||
#endif
|
||||
{
|
||||
// In the general case having the TabParent tell us if APZ is enabled or not
|
||||
// doesn't really work because the TabParent itself may not have a reference
|
||||
// to the owning widget during initialization. Instead we assume that this
|
||||
// TabChild corresponds to a widget type that would have APZ enabled, and just
|
||||
// check the other conditions necessary for enabling APZ.
|
||||
mAsyncPanZoomEnabled = gfxPlatform::AsyncPanZoomEnabled();
|
||||
|
||||
nsWeakPtr weakPtrThis(do_GetWeakReference(static_cast<nsITabChild*>(this))); // for capture by the lambda
|
||||
mSetAllowedTouchBehaviorCallback = [weakPtrThis](uint64_t aInputBlockId,
|
||||
const nsTArray<TouchBehaviorFlags>& aFlags)
|
||||
@ -431,6 +424,15 @@ TabChild::TabChild(nsIContentChild* aManager,
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
TabChild::AsyncPanZoomEnabled() const
|
||||
{
|
||||
// If we have received the CompositorOptions we can answer definitively. If
|
||||
// not, return a best guess based on gfxPlaform values.
|
||||
return mCompositorOptions ? mCompositorOptions->UseAPZ()
|
||||
: gfxPlatform::AsyncPanZoomEnabled();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TabChild::Observe(nsISupports *aSubject,
|
||||
const char *aTopic,
|
||||
@ -2502,6 +2504,10 @@ TabChild::InitRenderingState(const TextureFactoryIdentifier& aTextureFactoryIden
|
||||
return;
|
||||
}
|
||||
|
||||
CompositorOptions options;
|
||||
Unused << compositorChild->SendGetCompositorOptions(aLayersId, &options);
|
||||
mCompositorOptions = Some(options);
|
||||
|
||||
ShadowLayerForwarder* lf =
|
||||
mPuppetWidget->GetLayerManager(
|
||||
nullptr, mTextureFactoryIdentifier.mParentBackend)
|
||||
@ -2550,11 +2556,10 @@ TabChild::InitRenderingState(const TextureFactoryIdentifier& aTextureFactoryIden
|
||||
void
|
||||
TabChild::InitAPZState()
|
||||
{
|
||||
auto cbc = CompositorBridgeChild::Get();
|
||||
|
||||
if (!cbc->GetAPZEnabled(mLayersId)) {
|
||||
if (!mCompositorOptions->UseAPZ()) {
|
||||
return;
|
||||
}
|
||||
auto cbc = CompositorBridgeChild::Get();
|
||||
|
||||
// Initialize the ApzcTreeManager. This takes multiple casts because of ugly multiple inheritance.
|
||||
PAPZCTreeManagerChild* baseProtocol = cbc->SendPAPZCTreeManagerConstructor(mLayersId);
|
||||
@ -2894,6 +2899,12 @@ TabChild::ReinitRendering()
|
||||
|
||||
RefPtr<CompositorBridgeChild> cb = CompositorBridgeChild::Get();
|
||||
|
||||
// Refresh the compositor options since we may now be attached to a different
|
||||
// compositor than we were previously.
|
||||
CompositorOptions options;
|
||||
Unused << cb->SendGetCompositorOptions(mLayersId, &options);
|
||||
mCompositorOptions = Some(options);
|
||||
|
||||
bool success;
|
||||
nsTArray<LayersBackend> ignored;
|
||||
PLayerTransactionChild* shadowManager =
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "mozilla/EventForwards.h"
|
||||
#include "mozilla/layers/CompositorTypes.h"
|
||||
#include "mozilla/layers/APZCCallbackHelper.h"
|
||||
#include "mozilla/layers/CompositorOptions.h"
|
||||
#include "nsIWebBrowserChrome3.h"
|
||||
#include "mozilla/dom/ipc/IdType.h"
|
||||
#include "AudioChannelService.h"
|
||||
@ -617,7 +618,7 @@ public:
|
||||
return mParentIsActive;
|
||||
}
|
||||
|
||||
bool AsyncPanZoomEnabled() const { return mAsyncPanZoomEnabled; }
|
||||
bool AsyncPanZoomEnabled() const;
|
||||
|
||||
virtual ScreenIntSize GetInnerSize() override;
|
||||
|
||||
@ -776,6 +777,10 @@ private:
|
||||
LayoutDeviceIntPoint mChromeDisp;
|
||||
TabId mUniqueId;
|
||||
|
||||
// Holds the compositor options for the compositor rendering this tab,
|
||||
// once we find out which compositor that is.
|
||||
Maybe<mozilla::layers::CompositorOptions> mCompositorOptions;
|
||||
|
||||
friend class ContentChild;
|
||||
float mDPI;
|
||||
int32_t mRounding;
|
||||
@ -785,7 +790,6 @@ private:
|
||||
|
||||
bool mIPCOpen;
|
||||
bool mParentIsActive;
|
||||
bool mAsyncPanZoomEnabled;
|
||||
CSSSize mUnscaledInnerSize;
|
||||
bool mDidSetRealShowInfo;
|
||||
bool mDidLoadURLInit;
|
||||
|
@ -1409,7 +1409,7 @@ bool
|
||||
LayerManagerComposite::AsyncPanZoomEnabled() const
|
||||
{
|
||||
if (CompositorBridgeParent* bridge = mCompositor->GetCompositorBridgeParent()) {
|
||||
return bridge->AsyncPanZoomEnabled();
|
||||
return bridge->GetOptions().UseAPZ();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -1088,14 +1088,6 @@ CompositorBridgeChild::DeallocPCompositorWidgetChild(PCompositorWidgetChild* aAc
|
||||
#endif
|
||||
}
|
||||
|
||||
bool
|
||||
CompositorBridgeChild::GetAPZEnabled(uint64_t aLayerTreeId)
|
||||
{
|
||||
bool result = false;
|
||||
Unused << SendAsyncPanZoomEnabled(aLayerTreeId, &result);
|
||||
return result;
|
||||
}
|
||||
|
||||
PAPZCTreeManagerChild*
|
||||
CompositorBridgeChild::AllocPAPZCTreeManagerChild(const uint64_t& aLayersId)
|
||||
{
|
||||
|
@ -221,8 +221,6 @@ public:
|
||||
PCompositorWidgetChild* AllocPCompositorWidgetChild(const CompositorWidgetInitData& aInitData) override;
|
||||
bool DeallocPCompositorWidgetChild(PCompositorWidgetChild* aActor) override;
|
||||
|
||||
bool GetAPZEnabled(uint64_t aLayerTreeId);
|
||||
|
||||
PAPZCTreeManagerChild* AllocPAPZCTreeManagerChild(const uint64_t& aLayersId) override;
|
||||
bool DeallocPAPZCTreeManagerChild(PAPZCTreeManagerChild* aActor) override;
|
||||
|
||||
|
@ -1102,11 +1102,12 @@ CompositorBridgeParent::DeallocPAPZParent(PAPZParent* aActor)
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult
|
||||
CompositorBridgeParent::RecvAsyncPanZoomEnabled(const uint64_t& aLayersId, bool* aHasAPZ)
|
||||
CompositorBridgeParent::RecvGetCompositorOptions(const uint64_t& aLayersId,
|
||||
CompositorOptions* aOptions)
|
||||
{
|
||||
// The main process should pass in 0 because we assume mRootLayerTreeID
|
||||
MOZ_ASSERT(aLayersId == 0);
|
||||
*aHasAPZ = AsyncPanZoomEnabled();
|
||||
*aOptions = mOptions;
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
|
@ -432,12 +432,13 @@ public:
|
||||
PAPZParent* AllocPAPZParent(const uint64_t& aLayersId) override;
|
||||
bool DeallocPAPZParent(PAPZParent* aActor) override;
|
||||
|
||||
mozilla::ipc::IPCResult RecvAsyncPanZoomEnabled(const uint64_t& aLayersId, bool* aHasAPZ) override;
|
||||
mozilla::ipc::IPCResult RecvGetCompositorOptions(const uint64_t& aLayersId,
|
||||
CompositorOptions* aOptions) override;
|
||||
|
||||
RefPtr<APZCTreeManager> GetAPZCTreeManager();
|
||||
|
||||
bool AsyncPanZoomEnabled() const {
|
||||
return !!mApzcTreeManager;
|
||||
CompositorOptions GetOptions() const {
|
||||
return mOptions;
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "mozilla/layers/APZCTreeManagerParent.h" // for APZCTreeManagerParent
|
||||
#include "mozilla/layers/APZThreadUtils.h" // for APZCTreeManager
|
||||
#include "mozilla/layers/AsyncCompositionManager.h"
|
||||
#include "mozilla/layers/CompositorOptions.h"
|
||||
#include "mozilla/layers/CompositorThread.h"
|
||||
#include "mozilla/layers/LayerManagerComposite.h"
|
||||
#include "mozilla/layers/LayerTreeOwnerTracker.h"
|
||||
@ -109,18 +110,21 @@ CrossProcessCompositorBridgeParent::DeallocPLayerTransactionParent(PLayerTransac
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult
|
||||
CrossProcessCompositorBridgeParent::RecvAsyncPanZoomEnabled(const uint64_t& aLayersId, bool* aHasAPZ)
|
||||
CrossProcessCompositorBridgeParent::RecvGetCompositorOptions(const uint64_t& aLayersId,
|
||||
CompositorOptions* aOptions)
|
||||
{
|
||||
// Check to see if this child process has access to this layer tree.
|
||||
if (!LayerTreeOwnerTracker::Get()->IsMapped(aLayersId, OtherPid())) {
|
||||
NS_ERROR("Unexpected layers id in RecvAsyncPanZoomEnabled; dropping message...");
|
||||
NS_ERROR("Unexpected layers id in RecvGetCompositorOptions; dropping message...");
|
||||
return IPC_FAIL_NO_REASON(this);
|
||||
}
|
||||
|
||||
MonitorAutoLock lock(*sIndirectLayerTreesLock);
|
||||
CompositorBridgeParent::LayerTreeState& state = sIndirectLayerTrees[aLayersId];
|
||||
|
||||
*aHasAPZ = state.mParent ? state.mParent->AsyncPanZoomEnabled() : false;
|
||||
if (state.mParent) {
|
||||
*aOptions = state.mParent->GetOptions();
|
||||
}
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,8 @@
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
||||
class CompositorOptions;
|
||||
|
||||
/**
|
||||
* This class handles layer updates pushed directly from child processes to
|
||||
* the compositor thread. It's associated with a CompositorBridgeParent on the
|
||||
@ -137,7 +139,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual mozilla::ipc::IPCResult RecvAsyncPanZoomEnabled(const uint64_t& aLayersId, bool* aHasAPZ) override;
|
||||
virtual mozilla::ipc::IPCResult RecvGetCompositorOptions(const uint64_t& aLayersId, CompositorOptions* aOptions) override;
|
||||
|
||||
virtual PAPZCTreeManagerParent* AllocPAPZCTreeManagerParent(const uint64_t& aLayersId) override;
|
||||
virtual bool DeallocPAPZCTreeManagerParent(PAPZCTreeManagerParent* aActor) override;
|
||||
|
@ -33,6 +33,7 @@ using mozilla::LayoutDeviceIntRegion from "Units.h";
|
||||
using class mozilla::TimeStamp from "mozilla/TimeStamp.h";
|
||||
using class mozilla::layers::FrameUniformityData from "mozilla/layers/FrameUniformityData.h";
|
||||
using mozilla::layers::TextureFlags from "mozilla/layers/CompositorTypes.h";
|
||||
using mozilla::layers::CompositorOptions from "mozilla/layers/CompositorOptions.h";
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
@ -128,8 +129,8 @@ parent:
|
||||
sync Reset(LayersBackend[] aBackendHints, uint64_t aSeqNo)
|
||||
returns (bool aResult, TextureFactoryIdentifier aOutIdentifier);
|
||||
|
||||
// Returns whether this Compositor has APZ enabled or not.
|
||||
sync AsyncPanZoomEnabled(uint64_t layersId) returns (bool aHasAPZ);
|
||||
// Returns the CompositorOptions for this compositor.
|
||||
sync GetCompositorOptions(uint64_t layersId) returns (CompositorOptions aOptions);
|
||||
|
||||
// Must be called after Initialize(), and only succeeds if AsyncPanZoomEnabled() is true.
|
||||
async PAPZ(uint64_t layersId);
|
||||
|
Loading…
Reference in New Issue
Block a user