Commit a6072f9a authored by Kartikaya Gupta's avatar Kartikaya Gupta
Browse files

Bug 1330037 - Provide the CompositorBridgeParent with a CompositorOptions...

Bug 1330037 - Provide the CompositorBridgeParent with a CompositorOptions during construction that it holds for eternity. r=dvander

MozReview-Commit-ID: JnvNHUCF0AX

--HG--
extra : rebase_source : cf353f3397070c3133cf7eae8f0602a63f049e50
parent 6c437b31
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -6,6 +6,10 @@
#ifndef _include_mozilla_gfx_ipc_CompositorOptions_h_
#define _include_mozilla_gfx_ipc_CompositorOptions_h_

namespace IPC {
template <typename> struct ParamTraits;
} // namespace IPC

namespace mozilla {
namespace layers {

@@ -24,6 +28,12 @@ namespace layers {
class CompositorOptions
{
public:
  // This constructor needed for IPDL purposes, don't use it anywhere else.
  CompositorOptions()
    : mUseAPZ(false)
  {
  }

  explicit CompositorOptions(bool aUseAPZ)
    : mUseAPZ(aUseAPZ)
  {
@@ -31,8 +41,12 @@ public:

  bool UseAPZ() const { return mUseAPZ; }

  friend struct IPC::ParamTraits<CompositorOptions>;

private:
  bool mUseAPZ;

  // Make sure to add new fields to the ParamTraits implementation
};

} // namespace layers
+2 −1
Original line number Diff line number Diff line
@@ -288,11 +288,12 @@ mozilla::ipc::IPCResult
GPUParent::RecvNewWidgetCompositor(Endpoint<layers::PCompositorBridgeParent>&& aEndpoint,
                                   const CSSToLayoutDeviceScale& aScale,
                                   const TimeDuration& aVsyncRate,
                                   const CompositorOptions& aOptions,
                                   const bool& aUseExternalSurfaceSize,
                                   const IntSize& aSurfaceSize)
{
  RefPtr<CompositorBridgeParent> cbp =
    new CompositorBridgeParent(aScale, aVsyncRate, aUseExternalSurfaceSize, aSurfaceSize);
    new CompositorBridgeParent(aScale, aVsyncRate, aOptions, aUseExternalSurfaceSize, aSurfaceSize);

  MessageLoop* loop = CompositorThreadHolder::Loop();
  loop->PostTask(NewRunnableFunction(OpenParent, cbp, Move(aEndpoint)));
+1 −0
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ public:
      Endpoint<PCompositorBridgeParent>&& aEndpoint,
      const CSSToLayoutDeviceScale& aScale,
      const TimeDuration& aVsyncRate,
      const CompositorOptions& aOptions,
      const bool& aUseExternalSurface,
      const IntSize& aSurfaceSize) override;
  mozilla::ipc::IPCResult RecvNewContentCompositorBridge(Endpoint<PCompositorBridgeParent>&& aEndpoint) override;
+1 −0
Original line number Diff line number Diff line
@@ -567,6 +567,7 @@ GPUProcessManager::CreateRemoteSession(nsBaseWidget* aWidget,
    Move(parentPipe),
    aScale,
    vsyncRate,
    aOptions,
    aUseExternalSurfaceSize,
    aSurfaceSize);
  if (!ok) {
+15 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@
#include "ipc/IPCMessageUtils.h"
#include "mozilla/gfx/Matrix.h"
#include "mozilla/layers/AsyncDragMetrics.h"
#include "mozilla/layers/CompositorOptions.h"
#include "mozilla/layers/CompositorTypes.h"
#include "mozilla/layers/GeckoContentController.h"
#include "mozilla/layers/LayersTypes.h"
@@ -1318,6 +1319,20 @@ struct ParamTraits<mozilla::Array<T, Length>>
  }
};

template <>
struct ParamTraits<mozilla::layers::CompositorOptions>
{
  typedef mozilla::layers::CompositorOptions paramType;

  static void Write(Message* aMsg, const paramType& aParam) {
    WriteParam(aMsg, aParam.mUseAPZ);
  }

  static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult) {
    return ReadParam(aMsg, aIter, &aResult->mUseAPZ);
  }
};

} /* namespace IPC */

#endif /* __GFXMESSAGEUTILS_H__ */
Loading