From fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:14:29 +0200 Subject: Merging upstream version 125.0.1. Signed-off-by: Daniel Baumann --- gfx/layers/CanvasDrawEventRecorder.h | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'gfx/layers/CanvasDrawEventRecorder.h') diff --git a/gfx/layers/CanvasDrawEventRecorder.h b/gfx/layers/CanvasDrawEventRecorder.h index a4b1261cfb..c9eacf27ac 100644 --- a/gfx/layers/CanvasDrawEventRecorder.h +++ b/gfx/layers/CanvasDrawEventRecorder.h @@ -21,6 +21,10 @@ namespace mozilla { using EventType = gfx::RecordedEvent::EventType; +namespace dom { +class ThreadSafeWorkerRef; +} + namespace layers { typedef mozilla::ipc::SharedMemoryBasic::Handle Handle; @@ -31,7 +35,8 @@ class CanvasDrawEventRecorder final : public gfx::DrawEventRecorderPrivate, public: MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(CanvasDrawEventRecorder, final) - CanvasDrawEventRecorder(); + explicit CanvasDrawEventRecorder(dom::ThreadSafeWorkerRef* aWorkerRef); + ~CanvasDrawEventRecorder() override; enum class State : uint32_t { Processing, @@ -68,6 +73,7 @@ class CanvasDrawEventRecorder final : public gfx::DrawEventRecorderPrivate, virtual ~Helpers() = default; virtual bool InitTranslator(TextureType aTextureType, + TextureType aWebglTextureType, gfx::BackendType aBackendType, Handle&& aReadHandle, nsTArray&& aBufferHandles, @@ -89,8 +95,8 @@ class CanvasDrawEventRecorder final : public gfx::DrawEventRecorderPrivate, virtual bool RestartReader() = 0; }; - bool Init(TextureType aTextureType, gfx::BackendType aBackendType, - UniquePtr aHelpers); + bool Init(TextureType aTextureType, TextureType aWebglTextureType, + gfx::BackendType aBackendType, UniquePtr aHelpers); /** * Record an event for processing by the CanvasParent's CanvasTranslator. @@ -98,6 +104,10 @@ class CanvasDrawEventRecorder final : public gfx::DrawEventRecorderPrivate, */ void RecordEvent(const gfx::RecordedEvent& aEvent) final; + void DetachResources() final; + + void AddPendingDeletion(std::function&& aPendingDeletion) override; + void StoreSourceSurfaceRecording(gfx::SourceSurface* aSurface, const char* aReason) final; @@ -134,6 +144,11 @@ class CanvasDrawEventRecorder final : public gfx::DrawEventRecorderPrivate, void CheckAndSignalReader(); + void QueueProcessPendingDeletions( + RefPtr&& aRecorder); + void QueueProcessPendingDeletionsLocked( + RefPtr&& aRecorder); + size_t mDefaultBufferSize; size_t mMaxDefaultBuffers; uint32_t mMaxSpinCount; @@ -173,6 +188,9 @@ class CanvasDrawEventRecorder final : public gfx::DrawEventRecorderPrivate, UniquePtr mWriterSemaphore; UniquePtr mReaderSemaphore; + + RefPtr mWorkerRef; + bool mIsOnWorker = false; }; } // namespace layers -- cgit v1.2.3