Commit 619cad37 authored by Kartikaya Gupta's avatar Kartikaya Gupta
Browse files

Bug 1330037 - Propagate the CompositorOptions over to TabChild and keep a copy there. r=dvander

MozReview-Commit-ID: IQSm5cHkW4z

--HG--
extra : rebase_source : 4d340257394d1d641a208a83e93f84e1d24f9056
parent a6072f9a
Loading
Loading
Loading
Loading
+21 −10
Original line number Diff line number Diff line
@@ -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 =
+6 −2
Original line number Diff line number Diff line
@@ -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;
+1 −1
Original line number Diff line number Diff line
@@ -1409,7 +1409,7 @@ bool
LayerManagerComposite::AsyncPanZoomEnabled() const
{
  if (CompositorBridgeParent* bridge = mCompositor->GetCompositorBridgeParent()) {
    return bridge->AsyncPanZoomEnabled();
    return bridge->GetOptions().UseAPZ();
  }
  return false;
}
+0 −8
Original line number Diff line number Diff line
@@ -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)
{
+0 −2
Original line number Diff line number Diff line
@@ -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;

Loading