From d8bbc7858622b6d9c278469aab701ca0b609cddf Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 15 May 2024 05:35:49 +0200 Subject: Merging upstream version 126.0. Signed-off-by: Daniel Baumann --- gfx/2d/DrawEventRecorder.h | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'gfx/2d/DrawEventRecorder.h') diff --git a/gfx/2d/DrawEventRecorder.h b/gfx/2d/DrawEventRecorder.h index d62f098784..c099973fbd 100644 --- a/gfx/2d/DrawEventRecorder.h +++ b/gfx/2d/DrawEventRecorder.h @@ -15,6 +15,7 @@ #include #include +#include "ImageContainer.h" #include "mozilla/DataMutex.h" #include "mozilla/ThreadSafeWeakPtr.h" #include "nsTHashMap.h" @@ -83,7 +84,8 @@ class DrawEventRecorderPrivate : public DrawEventRecorder { virtual void RecordEvent(const RecordedEvent& aEvent) = 0; - void RecordEvent(DrawTargetRecording* aDT, const RecordedEvent& aEvent) { + void RecordEvent(const DrawTargetRecording* aDT, + const RecordedEvent& aEvent) { ReferencePtr dt = aDT; if (mCurrentDT != dt) { SetDrawTarget(dt); @@ -93,7 +95,7 @@ class DrawEventRecorderPrivate : public DrawEventRecorder { void SetDrawTarget(ReferencePtr aDT); - void ClearDrawTarget(DrawTargetRecording* aDT) { + void ClearDrawTarget(const DrawTargetRecording* aDT) { ReferencePtr dt = aDT; if (mCurrentDT == dt) { mCurrentDT = nullptr; @@ -185,6 +187,12 @@ class DrawEventRecorderPrivate : public DrawEventRecorder { virtual void StoreSourceSurfaceRecording(SourceSurface* aSurface, const char* aReason); + virtual void StoreImageRecording( + const RefPtr& aImageOfSurfaceDescriptor, + const char* aReasony) { + MOZ_ASSERT_UNREACHABLE("unexpected to be called"); + } + /** * Used when a source surface is destroyed, aSurface is a void* instead of a * SourceSurface* because this is called during the SourceSurface destructor, @@ -209,11 +217,21 @@ class DrawEventRecorderPrivate : public DrawEventRecorder { aSurfaces = std::move(mExternalSurfaces); } + struct ExternalImageEntry { + RefPtr mImage; + int64_t mEventCount = -1; + }; + + using ExternalImagesHolder = std::deque; + protected: NS_DECL_OWNINGTHREAD void StoreExternalSurfaceRecording(SourceSurface* aSurface, uint64_t aKey); + void StoreExternalImageRecording( + const RefPtr& aImageOfSurfaceDescriptor); + void ProcessPendingDeletions() { NS_ASSERT_OWNINGTHREAD(DrawEventRecorderPrivate); @@ -253,6 +271,7 @@ class DrawEventRecorderPrivate : public DrawEventRecorder { ReferencePtr mCurrentDT; ExternalSurfacesHolder mExternalSurfaces; + ExternalImagesHolder mExternalImages; bool mExternalFonts; }; -- cgit v1.2.3