1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4  * License, v. 2.0. If a copy of the MPL was not distributed with this
5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 
7 #ifndef mozilla_layers_WebRenderBridgeParent_h
8 #define mozilla_layers_WebRenderBridgeParent_h
9 
10 #include <unordered_map>
11 #include <unordered_set>
12 
13 #include "CompositableHost.h"  // for CompositableHost, ImageCompositeNotificationInfo
14 #include "GLContextProvider.h"
15 #include "Layers.h"
16 #include "mozilla/layers/CompositableTransactionParent.h"
17 #include "mozilla/layers/CompositorTypes.h"
18 #include "mozilla/layers/CompositorVsyncSchedulerOwner.h"
19 #include "mozilla/layers/PWebRenderBridgeParent.h"
20 #include "mozilla/layers/UiCompositorControllerParent.h"
21 #include "mozilla/layers/WebRenderCompositionRecorder.h"
22 #include "mozilla/HashTable.h"
23 #include "mozilla/Maybe.h"
24 #include "mozilla/Result.h"
25 #include "mozilla/UniquePtr.h"
26 #include "mozilla/WeakPtr.h"
27 #include "mozilla/webrender/WebRenderTypes.h"
28 #include "mozilla/webrender/WebRenderAPI.h"
29 #include "mozilla/webrender/RenderThread.h"
30 #include "nsTArrayForwardDeclare.h"
31 
32 namespace mozilla {
33 
34 namespace gl {
35 class GLContext;
36 }
37 
38 namespace widget {
39 class CompositorWidget;
40 }
41 
42 namespace wr {
43 class WebRenderAPI;
44 }
45 
46 namespace layers {
47 
48 class Compositor;
49 class CompositorAnimationStorage;
50 class CompositorBridgeParentBase;
51 class CompositorVsyncScheduler;
52 class AsyncImagePipelineManager;
53 class WebRenderImageHost;
54 
55 class PipelineIdAndEpochHashEntry : public PLDHashEntryHdr {
56  public:
57   typedef const std::pair<wr::PipelineId, wr::Epoch>& KeyType;
58   typedef const std::pair<wr::PipelineId, wr::Epoch>* KeyTypePointer;
59   enum { ALLOW_MEMMOVE = true };
60 
PipelineIdAndEpochHashEntry(wr::PipelineId aPipelineId,wr::Epoch aEpoch)61   explicit PipelineIdAndEpochHashEntry(wr::PipelineId aPipelineId,
62                                        wr::Epoch aEpoch)
63       : mValue(aPipelineId, aEpoch) {}
64 
65   PipelineIdAndEpochHashEntry(PipelineIdAndEpochHashEntry&& aOther) = default;
66 
PipelineIdAndEpochHashEntry(KeyTypePointer aKey)67   explicit PipelineIdAndEpochHashEntry(KeyTypePointer aKey)
68       : mValue(aKey->first, aKey->second) {}
69 
~PipelineIdAndEpochHashEntry()70   ~PipelineIdAndEpochHashEntry() {}
71 
GetKey()72   KeyType GetKey() const { return mValue; }
73 
KeyEquals(KeyTypePointer aKey)74   bool KeyEquals(KeyTypePointer aKey) const {
75     return mValue.first.mHandle == aKey->first.mHandle &&
76            mValue.first.mNamespace == aKey->first.mNamespace &&
77            mValue.second.mHandle == aKey->second.mHandle;
78   };
79 
KeyToPointer(KeyType aKey)80   static KeyTypePointer KeyToPointer(KeyType aKey) { return &aKey; }
81 
HashKey(KeyTypePointer aKey)82   static PLDHashNumber HashKey(KeyTypePointer aKey) {
83     return mozilla::HashGeneric(aKey->first.mHandle, aKey->first.mNamespace,
84                                 aKey->second.mHandle);
85   }
86 
87  private:
88   std::pair<wr::PipelineId, wr::Epoch> mValue;
89 };
90 
91 class WebRenderBridgeParent final
92     : public PWebRenderBridgeParent,
93       public CompositorVsyncSchedulerOwner,
94       public CompositableParentManager,
95       public layers::FrameRecorder,
96       public SupportsWeakPtr<WebRenderBridgeParent> {
97  public:
98   MOZ_DECLARE_WEAKREFERENCE_TYPENAME(WebRenderBridgeParent)
99   WebRenderBridgeParent(CompositorBridgeParentBase* aCompositorBridge,
100                         const wr::PipelineId& aPipelineId,
101                         widget::CompositorWidget* aWidget,
102                         CompositorVsyncScheduler* aScheduler,
103                         RefPtr<wr::WebRenderAPI>&& aApi,
104                         RefPtr<AsyncImagePipelineManager>&& aImageMgr,
105                         RefPtr<CompositorAnimationStorage>&& aAnimStorage,
106                         TimeDuration aVsyncRate);
107 
108   static WebRenderBridgeParent* CreateDestroyed(
109       const wr::PipelineId& aPipelineId);
110 
PipelineId()111   wr::PipelineId PipelineId() { return mPipelineId; }
GetWebRenderAPI()112   already_AddRefed<wr::WebRenderAPI> GetWebRenderAPI() {
113     return do_AddRef(mApi);
114   }
AsyncImageManager()115   AsyncImagePipelineManager* AsyncImageManager() { return mAsyncImageManager; }
CompositorScheduler()116   CompositorVsyncScheduler* CompositorScheduler() {
117     return mCompositorScheduler.get();
118   }
GetCompositorBridge()119   CompositorBridgeParentBase* GetCompositorBridge() {
120     return mCompositorBridge;
121   }
122 
123   void UpdateQualitySettings();
124   void UpdateDebugFlags();
125   void UpdateMultithreading();
126   void UpdateBatchingParameters();
127 
128   mozilla::ipc::IPCResult RecvEnsureConnected(
129       TextureFactoryIdentifier* aTextureFactoryIdentifier,
130       MaybeIdNamespace* aMaybeIdNamespace) override;
131 
132   mozilla::ipc::IPCResult RecvNewCompositable(
133       const CompositableHandle& aHandle, const TextureInfo& aInfo) override;
134   mozilla::ipc::IPCResult RecvReleaseCompositable(
135       const CompositableHandle& aHandle) override;
136 
137   mozilla::ipc::IPCResult RecvShutdown() override;
138   mozilla::ipc::IPCResult RecvShutdownSync() override;
139   mozilla::ipc::IPCResult RecvDeleteCompositorAnimations(
140       nsTArray<uint64_t>&& aIds) override;
141   mozilla::ipc::IPCResult RecvUpdateResources(
142       nsTArray<OpUpdateResource>&& aUpdates,
143       nsTArray<RefCountedShmem>&& aSmallShmems,
144       nsTArray<ipc::Shmem>&& aLargeShmems) override;
145   mozilla::ipc::IPCResult RecvSetDisplayList(
146       DisplayListData&& aDisplayList, nsTArray<OpDestroy>&& aToDestroy,
147       const uint64_t& aFwdTransactionId, const TransactionId& aTransactionId,
148       const bool& aContainsSVGGroup, const VsyncId& aVsyncId,
149       const TimeStamp& aVsyncStartTime, const TimeStamp& aRefreshStartTime,
150       const TimeStamp& aTxnStartTime, const nsCString& aTxnURL,
151       const TimeStamp& aFwdTime,
152       nsTArray<CompositionPayload>&& aPayloads) override;
153   mozilla::ipc::IPCResult RecvEmptyTransaction(
154       const FocusTarget& aFocusTarget,
155       Maybe<TransactionData>&& aTransactionData,
156       nsTArray<OpDestroy>&& aToDestroy, const uint64_t& aFwdTransactionId,
157       const TransactionId& aTransactionId, const VsyncId& aVsyncId,
158       const TimeStamp& aVsyncStartTime, const TimeStamp& aRefreshStartTime,
159       const TimeStamp& aTxnStartTime, const nsCString& aTxnURL,
160       const TimeStamp& aFwdTime,
161       nsTArray<CompositionPayload>&& aPayloads) override;
162   mozilla::ipc::IPCResult RecvSetFocusTarget(
163       const FocusTarget& aFocusTarget) override;
164   mozilla::ipc::IPCResult RecvParentCommands(
165       nsTArray<WebRenderParentCommand>&& commands) override;
166   mozilla::ipc::IPCResult RecvGetSnapshot(PTextureParent* aTexture) override;
167 
168   mozilla::ipc::IPCResult RecvSetLayersObserverEpoch(
169       const LayersObserverEpoch& aChildEpoch) override;
170 
171   mozilla::ipc::IPCResult RecvClearCachedResources() override;
172   mozilla::ipc::IPCResult RecvInvalidateRenderedFrame() override;
173   mozilla::ipc::IPCResult RecvScheduleComposite() override;
174   mozilla::ipc::IPCResult RecvCapture() override;
175   mozilla::ipc::IPCResult RecvToggleCaptureSequence() override;
176   mozilla::ipc::IPCResult RecvSyncWithCompositor() override;
177 
178   mozilla::ipc::IPCResult RecvSetConfirmedTargetAPZC(
179       const uint64_t& aBlockId,
180       nsTArray<ScrollableLayerGuid>&& aTargets) override;
181 
182   mozilla::ipc::IPCResult RecvSetTestSampleTime(
183       const TimeStamp& aTime) override;
184   mozilla::ipc::IPCResult RecvLeaveTestMode() override;
185   mozilla::ipc::IPCResult RecvGetAnimationValue(
186       const uint64_t& aCompositorAnimationsId, OMTAValue* aValue) override;
187   mozilla::ipc::IPCResult RecvSetAsyncScrollOffset(
188       const ScrollableLayerGuid::ViewID& aScrollId, const float& aX,
189       const float& aY) override;
190   mozilla::ipc::IPCResult RecvSetAsyncZoom(
191       const ScrollableLayerGuid::ViewID& aScrollId,
192       const float& aZoom) override;
193   mozilla::ipc::IPCResult RecvFlushApzRepaints() override;
194   mozilla::ipc::IPCResult RecvGetAPZTestData(APZTestData* data) override;
195 
196   void ActorDestroy(ActorDestroyReason aWhy) override;
197 
198   void Pause();
199   bool Resume();
200 
201   void Destroy();
202 
203   // CompositorVsyncSchedulerOwner
IsPendingComposite()204   bool IsPendingComposite() override { return false; }
FinishPendingComposite()205   void FinishPendingComposite() override {}
206   void CompositeToTarget(VsyncId aId, gfx::DrawTarget* aTarget,
207                          const gfx::IntRect* aRect = nullptr) override;
208   TimeDuration GetVsyncInterval() const override;
209 
210   // CompositableParentManager
211   bool IsSameProcess() const override;
212   base::ProcessId GetChildProcessId() override;
213   void NotifyNotUsed(PTextureParent* aTexture,
214                      uint64_t aTransactionId) override;
215   void SendAsyncMessage(
216       const nsTArray<AsyncParentMessageData>& aMessage) override;
217   void SendPendingAsyncMessages() override;
218   void SetAboutToSendAsyncMessages() override;
219 
220   void HoldPendingTransactionId(
221       const wr::Epoch& aWrEpoch, TransactionId aTransactionId,
222       bool aContainsSVGGroup, const VsyncId& aVsyncId,
223       const TimeStamp& aVsyncStartTime, const TimeStamp& aRefreshStartTime,
224       const TimeStamp& aTxnStartTime, const nsCString& aTxnURL,
225       const TimeStamp& aFwdTime, const bool aIsFirstPaint,
226       nsTArray<CompositionPayload>&& aPayloads,
227       const bool aUseForTelemetry = true);
228   TransactionId LastPendingTransactionId();
229   TransactionId FlushTransactionIdsForEpoch(
230       const wr::Epoch& aEpoch, const VsyncId& aCompositeStartId,
231       const TimeStamp& aCompositeStartTime, const TimeStamp& aRenderStartTime,
232       const TimeStamp& aEndTime, UiCompositorControllerParent* aUiController,
233       wr::RendererStats* aStats = nullptr,
234       nsTArray<FrameStats>* aOutputStats = nullptr);
235   void NotifySceneBuiltForEpoch(const wr::Epoch& aEpoch,
236                                 const TimeStamp& aEndTime);
237 
238   void CompositeIfNeeded();
239 
240   TextureFactoryIdentifier GetTextureFactoryIdentifier();
241 
242   void ExtractImageCompositeNotifications(
243       nsTArray<ImageCompositeNotificationInfo>* aNotifications);
244 
GetCurrentEpoch()245   wr::Epoch GetCurrentEpoch() const { return mWrEpoch; }
GetIdNamespace()246   wr::IdNamespace GetIdNamespace() { return mIdNamespace; }
247 
248   void FlushRendering(bool aWaitForPresent = true);
249 
250   /**
251    * Schedule generating WebRender frame definitely at next composite timing.
252    *
253    * WebRenderBridgeParent uses composite timing to check if there is an update
254    * to AsyncImagePipelines. If there is no update, WebRenderBridgeParent skips
255    * to generate frame. If we need to generate new frame at next composite
256    * timing, call this method.
257    *
258    * Call CompositorVsyncScheduler::ScheduleComposition() directly, if we just
259    * want to trigger AsyncImagePipelines update checks.
260    */
261   void ScheduleGenerateFrame();
262 
263   /**
264    * Invalidate rendered frame.
265    *
266    * WebRender could skip frame rendering if there is no update.
267    * This function is used to force invalidating even when there is no update.
268    */
269   void InvalidateRenderedFrame();
270 
271   /**
272    * Schedule forced frame rendering at next composite timing.
273    *
274    * WebRender could skip frame rendering if there is no update.
275    * This function is used to force rendering even when there is no update.
276    */
277   void ScheduleForcedGenerateFrame();
278 
279   void NotifyDidSceneBuild(RefPtr<const wr::WebRenderPipelineInfo> aInfo);
280 
281   wr::Epoch UpdateWebRender(
282       CompositorVsyncScheduler* aScheduler, RefPtr<wr::WebRenderAPI>&& aApi,
283       AsyncImagePipelineManager* aImageMgr,
284       CompositorAnimationStorage* aAnimStorage,
285       const TextureFactoryIdentifier& aTextureFactoryIdentifier);
286 
287   void RemoveEpochDataPriorTo(const wr::Epoch& aRenderedEpoch);
288 
289   bool IsRootWebRenderBridgeParent() const;
290   LayersId GetLayersId() const;
291 
292   void SetCompositionRecorder(
293       UniquePtr<layers::WebRenderCompositionRecorder> aRecorder);
294 
295   /**
296    * Write the frames collected by the |WebRenderCompositionRecorder| to disk.
297    *
298    * If there is not currently a recorder, this is a no-op.
299    */
300   RefPtr<wr::WebRenderAPI::WriteCollectedFramesPromise> WriteCollectedFrames();
301 
302 #if defined(MOZ_WIDGET_ANDROID)
303   /**
304    * Request a screengrab for android
305    */
306   void RequestScreenPixels(UiCompositorControllerParent* aController);
307   void MaybeCaptureScreenPixels();
308 #endif
309   /**
310    * Return the frames collected by the |WebRenderCompositionRecorder| encoded
311    * as data URIs.
312    *
313    * If there is not currently a recorder, this is a no-op and the promise will
314    * be rejected.
315    */
316   RefPtr<wr::WebRenderAPI::GetCollectedFramesPromise> GetCollectedFrames();
317 
318   void DisableNativeCompositor();
319   void AddPendingScrollPayload(
320       CompositionPayload& aPayload,
321       const std::pair<wr::PipelineId, wr::Epoch>& aKey);
322 
323   nsTArray<CompositionPayload> TakePendingScrollPayload(
324       const std::pair<wr::PipelineId, wr::Epoch>& aKey);
325 
326  private:
327   class ScheduleSharedSurfaceRelease;
328 
329   explicit WebRenderBridgeParent(const wr::PipelineId& aPipelineId);
330   virtual ~WebRenderBridgeParent();
331 
332   bool ProcessEmptyTransactionUpdates(TransactionData& aData,
333                                       bool* aScheduleComposite);
334 
335   bool ProcessDisplayListData(DisplayListData& aDisplayList, wr::Epoch aWrEpoch,
336                               const TimeStamp& aTxnStartTime,
337                               bool aValidTransaction,
338                               bool aObserveLayersUpdate);
339 
340   bool SetDisplayList(const LayoutDeviceRect& aRect,
341                       const wr::LayoutSize& aContentSize, ipc::ByteBuf&& aDL,
342                       const wr::BuiltDisplayListDescriptor& aDLDesc,
343                       const nsTArray<OpUpdateResource>& aResourceUpdates,
344                       const nsTArray<RefCountedShmem>& aSmallShmems,
345                       const nsTArray<ipc::Shmem>& aLargeShmems,
346                       const TimeStamp& aTxnStartTime,
347                       wr::TransactionBuilder& aTxn, wr::Epoch aWrEpoch,
348                       bool aValidTransaction, bool aObserveLayersUpdate);
349 
350   void UpdateAPZFocusState(const FocusTarget& aFocus);
351   void UpdateAPZScrollData(const wr::Epoch& aEpoch,
352                            WebRenderScrollData&& aData);
353   void UpdateAPZScrollOffsets(ScrollUpdatesMap&& aUpdates,
354                               uint32_t aPaintSequenceNumber);
355 
356   bool UpdateResources(const nsTArray<OpUpdateResource>& aResourceUpdates,
357                        const nsTArray<RefCountedShmem>& aSmallShmems,
358                        const nsTArray<ipc::Shmem>& aLargeShmems,
359                        wr::TransactionBuilder& aUpdates);
360   bool AddPrivateExternalImage(wr::ExternalImageId aExtId, wr::ImageKey aKey,
361                                wr::ImageDescriptor aDesc,
362                                wr::TransactionBuilder& aResources);
363   bool UpdatePrivateExternalImage(wr::ExternalImageId aExtId, wr::ImageKey aKey,
364                                   const wr::ImageDescriptor& aDesc,
365                                   const ImageIntRect& aDirtyRect,
366                                   wr::TransactionBuilder& aResources);
367   bool AddSharedExternalImage(wr::ExternalImageId aExtId, wr::ImageKey aKey,
368                               wr::TransactionBuilder& aResources);
369   bool UpdateSharedExternalImage(
370       wr::ExternalImageId aExtId, wr::ImageKey aKey,
371       const ImageIntRect& aDirtyRect, wr::TransactionBuilder& aResources,
372       UniquePtr<ScheduleSharedSurfaceRelease>& aScheduleRelease);
373   void ObserveSharedSurfaceRelease(
374       const nsTArray<wr::ExternalImageKeyPair>& aPairs);
375 
376   bool PushExternalImageForTexture(wr::ExternalImageId aExtId,
377                                    wr::ImageKey aKey, TextureHost* aTexture,
378                                    bool aIsUpdate,
379                                    wr::TransactionBuilder& aResources);
380 
381   void AddPipelineIdForCompositable(const wr::PipelineId& aPipelineIds,
382                                     const CompositableHandle& aHandle,
383                                     const bool& aAsync,
384                                     wr::TransactionBuilder& aTxn,
385                                     wr::TransactionBuilder& aTxnForImageBridge);
386   void RemovePipelineIdForCompositable(const wr::PipelineId& aPipelineId,
387                                        wr::TransactionBuilder& aTxn);
388 
389   void DeleteImage(const wr::ImageKey& aKey, wr::TransactionBuilder& aUpdates);
390   void ReleaseTextureOfImage(const wr::ImageKey& aKey);
391 
392   bool ProcessWebRenderParentCommands(
393       const nsTArray<WebRenderParentCommand>& aCommands,
394       wr::TransactionBuilder& aTxn);
395 
396   void ClearResources();
397   bool ShouldParentObserveEpoch();
398   mozilla::ipc::IPCResult HandleShutdown();
399 
400   // Returns true if there is any animation (including animations in delay
401   // phase).
402   bool AdvanceAnimations();
403 
404   struct WrAnimations {
405     nsTArray<wr::WrOpacityProperty> mOpacityArrays;
406     nsTArray<wr::WrTransformProperty> mTransformArrays;
407     nsTArray<wr::WrColorProperty> mColorArrays;
408   };
409   bool SampleAnimations(WrAnimations& aAnimations);
410 
411   CompositorBridgeParent* GetRootCompositorBridgeParent() const;
412 
413   RefPtr<WebRenderBridgeParent> GetRootWebRenderBridgeParent() const;
414 
415   // Tell APZ what the subsequent sampling's timestamp should be.
416   void SetAPZSampleTime();
417 
418   wr::Epoch GetNextWrEpoch();
419   // This function is expected to be used when GetNextWrEpoch() is called,
420   // but TransactionBuilder does not have resource updates nor display list.
421   // In this case, ScheduleGenerateFrame is not triggered via SceneBuilder.
422   // Then we want to rollback WrEpoch. See Bug 1490117.
423   void RollbackWrEpoch();
424 
425   void FlushSceneBuilds();
426   void FlushFrameGeneration();
427   void FlushFramePresentation();
428 
429   void MaybeGenerateFrame(VsyncId aId, bool aForceGenerateFrame);
430 
GetVsyncIdForEpoch(const wr::Epoch & aEpoch)431   VsyncId GetVsyncIdForEpoch(const wr::Epoch& aEpoch) {
432     for (auto& id : mPendingTransactionIds) {
433       if (id.mEpoch.mHandle == aEpoch.mHandle) {
434         return id.mVsyncId;
435       }
436     }
437     return VsyncId();
438   }
439 
440  private:
441   struct PendingTransactionId {
PendingTransactionIdPendingTransactionId442     PendingTransactionId(const wr::Epoch& aEpoch, TransactionId aId,
443                          bool aContainsSVGGroup, const VsyncId& aVsyncId,
444                          const TimeStamp& aVsyncStartTime,
445                          const TimeStamp& aRefreshStartTime,
446                          const TimeStamp& aTxnStartTime,
447                          const nsCString& aTxnURL, const TimeStamp& aFwdTime,
448                          const bool aIsFirstPaint, const bool aUseForTelemetry,
449                          nsTArray<CompositionPayload>&& aPayloads)
450         : mEpoch(aEpoch),
451           mId(aId),
452           mVsyncId(aVsyncId),
453           mVsyncStartTime(aVsyncStartTime),
454           mRefreshStartTime(aRefreshStartTime),
455           mTxnStartTime(aTxnStartTime),
456           mTxnURL(aTxnURL),
457           mFwdTime(aFwdTime),
458           mSkippedComposites(0),
459           mContainsSVGGroup(aContainsSVGGroup),
460           mIsFirstPaint(aIsFirstPaint),
461           mUseForTelemetry(aUseForTelemetry),
462           mPayloads(std::move(aPayloads)) {}
463     wr::Epoch mEpoch;
464     TransactionId mId;
465     VsyncId mVsyncId;
466     TimeStamp mVsyncStartTime;
467     TimeStamp mRefreshStartTime;
468     TimeStamp mTxnStartTime;
469     nsCString mTxnURL;
470     TimeStamp mFwdTime;
471     TimeStamp mSceneBuiltTime;
472     uint32_t mSkippedComposites;
473     bool mContainsSVGGroup;
474     bool mIsFirstPaint;
475     bool mUseForTelemetry;
476     nsTArray<CompositionPayload> mPayloads;
477   };
478 
479   struct CompositorAnimationIdsForEpoch {
CompositorAnimationIdsForEpochCompositorAnimationIdsForEpoch480     CompositorAnimationIdsForEpoch(const wr::Epoch& aEpoch,
481                                    nsTArray<uint64_t>&& aIds)
482         : mEpoch(aEpoch), mIds(std::move(aIds)) {}
483 
484     wr::Epoch mEpoch;
485     nsTArray<uint64_t> mIds;
486   };
487 
488   CompositorBridgeParentBase* MOZ_NON_OWNING_REF mCompositorBridge;
489   wr::PipelineId mPipelineId;
490   RefPtr<widget::CompositorWidget> mWidget;
491   RefPtr<wr::WebRenderAPI> mApi;
492   RefPtr<AsyncImagePipelineManager> mAsyncImageManager;
493   RefPtr<CompositorVsyncScheduler> mCompositorScheduler;
494   RefPtr<CompositorAnimationStorage> mAnimStorage;
495   // mActiveAnimations is used to avoid leaking animations when
496   // WebRenderBridgeParent is destroyed abnormally and Tab move between
497   // different windows.
498   std::unordered_map<uint64_t, wr::Epoch> mActiveAnimations;
499   std::unordered_map<uint64_t, RefPtr<WebRenderImageHost>> mAsyncCompositables;
500   std::unordered_map<uint64_t, CompositableTextureHostRef> mTextureHosts;
501   std::unordered_map<uint64_t, wr::ExternalImageId> mSharedSurfaceIds;
502 
503   TimeDuration mVsyncRate;
504   TimeStamp mPreviousFrameTimeStamp;
505   // These fields keep track of the latest layer observer epoch values in the
506   // child and the parent. mChildLayersObserverEpoch is the latest epoch value
507   // received from the child. mParentLayersObserverEpoch is the latest epoch
508   // value that we have told BrowserParent about (via ObserveLayerUpdate).
509   LayersObserverEpoch mChildLayersObserverEpoch;
510   LayersObserverEpoch mParentLayersObserverEpoch;
511 
512   std::deque<PendingTransactionId> mPendingTransactionIds;
513   std::queue<CompositorAnimationIdsForEpoch> mCompositorAnimationsToDelete;
514   wr::Epoch mWrEpoch;
515   wr::IdNamespace mIdNamespace;
516 
517   VsyncId mSkippedCompositeId;
518   TimeStamp mMostRecentComposite;
519 
520 #if defined(MOZ_WIDGET_ANDROID)
521   UiCompositorControllerParent* mScreenPixelsTarget;
522 #endif
523   bool mPaused;
524   bool mDestroyed;
525   bool mReceivedDisplayList;
526   bool mIsFirstPaint;
527   bool mSkippedComposite;
528   bool mDisablingNativeCompositor;
529   // These payloads are being used for SCROLL_PRESENT_LATENCY telemetry
530   DataMutex<nsClassHashtable<PipelineIdAndEpochHashEntry,
531                              nsTArray<CompositionPayload>>>
532       mPendingScrollPayloads;
533 };
534 
535 }  // namespace layers
536 }  // namespace mozilla
537 
538 #endif  // mozilla_layers_WebRenderBridgeParent_h
539