author Hiroyuki Ikezoe <>
Tue, 31 Jul 2018 06:13:15 +0900
changeset 429252 2ffc8e9d5686766189b3d287f086fca8e0d2d8dd
parent 429191 383e6ae8f7d4d1961a56aa6f5a69b4c3e8c3e2e5
child 429253 c8c2625a33baf37d1122814ee9a04dfcf40cf180
permissions -rw-r--r--
Bug 1479234 - Introduce a generic function to get an animation value on the compositor. r=boris,froydnj On the compositor we store animation values in a hash table and the hash is the compositor animation id which is a unique id for each property respectively. So we can get the corresponding animation value for the given property. In this patch there are lots of duplicated code, but they will be removed in the next patch. MozReview-Commit-ID: 7EboVcculcg

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 * vim: sw=2 ts=8 et :
/* 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 */

include LayersSurfaces;
include LayersMessages;
include "mozilla/GfxMessageUtils.h";
include "mozilla/layers/WebRenderMessageUtils.h";

include WebRenderMessages;
include protocol PCompositorBridge;
include protocol PTexture;

using mozilla::layers::APZTestData from "mozilla/layers/APZTestData.h";
using mozilla::layers::ScrollUpdatesMap from "FrameMetrics.h";
using struct mozilla::layers::ScrollableLayerGuid from "FrameMetrics.h";
using struct mozilla::layers::TextureFactoryIdentifier from "mozilla/layers/CompositorTypes.h";
using struct mozilla::layers::TextureInfo from "mozilla/layers/CompositorTypes.h";
using mozilla::layers::CompositableHandle from "mozilla/layers/LayersTypes.h";
using mozilla::wr::BuiltDisplayListDescriptor from "mozilla/webrender/webrender_ffi.h";
using mozilla::wr::IdNamespace from "mozilla/webrender/WebRenderTypes.h";
using mozilla::layers::WebRenderScrollData from "mozilla/layers/WebRenderScrollData.h";
using mozilla::layers::FocusTarget from "mozilla/layers/FocusTarget.h";
using mozilla::layers::LayersObserverEpoch from "mozilla/layers/LayersTypes.h";
using mozilla::layers::TransactionId from "mozilla/layers/LayersTypes.h";

namespace mozilla {
namespace layers {

sync protocol PWebRenderBridge
  manager PCompositorBridge;

  async NewCompositable(CompositableHandle handle, TextureInfo info);
  async ReleaseCompositable(CompositableHandle compositable);

  sync Create(IntSize aSize);
  async DeleteCompositorAnimations(uint64_t[] aIds);
  async SetDisplayList(IntSize aSize, WebRenderParentCommand[] commands, OpDestroy[] toDestroy, uint64_t fwdTransactionId, TransactionId transactionId,
                       LayoutSize aContentSize, ByteBuf aDL, BuiltDisplayListDescriptor aDLDesc,
                       WebRenderScrollData aScrollData,
                       OpUpdateResource[] aResourceUpdates, RefCountedShmem[] aSmallShmems, Shmem[] aLargeShmems,
                       IdNamespace aIdNamespace, TimeStamp refreshStartTime, TimeStamp txnStartTime, TimeStamp fwdTime);
  async EmptyTransaction(FocusTarget focusTarget, ScrollUpdatesMap scrollUpdates, uint32_t aPaintSequenceNumber,
                         WebRenderParentCommand[] commands, OpDestroy[] toDestroy, uint64_t fwdTransactionId, TransactionId transactionId,
                         IdNamespace aIdNamespace, TimeStamp refreshStartTime, TimeStamp txnStartTime, TimeStamp fwdTime);
  async SetFocusTarget(FocusTarget focusTarget);
  async UpdateResources(OpUpdateResource[] aResourceUpdates, RefCountedShmem[] aSmallShmems, Shmem[] aLargeShmems);
  async ParentCommands(WebRenderParentCommand[] commands);
  sync GetSnapshot(PTexture texture);
  async SetLayersObserverEpoch(LayersObserverEpoch childEpoch);
  async ClearCachedResources();
  // Schedule a composite if one isn't already scheduled.
  async ScheduleComposite();
  // Save the frame capture to disk
  async Capture();

  // Replacement for PCompositorBridge::SyncWithCompositor, but for WR. We need
  // it on PWebRenderBridge because it associated with a particular top-level
  // window, and PCompositorBridge doesn't allow doing that in a secure manner.
  sync SyncWithCompositor();

  // These correspond exactly to the equivalent APIs in PLayerTransaction -
  // see those for documentation.
  async SetConfirmedTargetAPZC(uint64_t aInputBlockId, ScrollableLayerGuid[] aTargets);
  // More copied from PLayerTransaction, but these are only used for testing.
  sync SetTestSampleTime(TimeStamp sampleTime);
  sync LeaveTestMode();
  sync GetAnimationValue(uint64_t aCompositorAnimationsId) returns (OMTAValue value);
  sync GetAnimationOpacity(uint64_t aCompositorAnimationsId) returns (float opacity,
                                                  bool hasAnimationOpacity);
  sync GetAnimationTransform(uint64_t aCompositorAnimationId) returns (MaybeTransform transform);
  sync SetAsyncScrollOffset(ViewID scrollId, float x, float y);
  sync SetAsyncZoom(ViewID scrollId, float zoom);
  async FlushApzRepaints();
  sync GetAPZTestData() returns (APZTestData data);

  async Shutdown();
  sync ShutdownSync();
  async WrUpdated(IdNamespace aNewIdNamespace, TextureFactoryIdentifier textureFactoryIdentifier);
  async __delete__();

} // layers
} // mozilla