diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:43:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:43:14 +0000 |
commit | 8dd16259287f58f9273002717ec4d27e97127719 (patch) | |
tree | 3863e62a53829a84037444beab3abd4ed9dfc7d0 /dom/canvas/OffscreenCanvasDisplayHelper.cpp | |
parent | Releasing progress-linux version 126.0.1-1~progress7.99u1. (diff) | |
download | firefox-8dd16259287f58f9273002717ec4d27e97127719.tar.xz firefox-8dd16259287f58f9273002717ec4d27e97127719.zip |
Merging upstream version 127.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | dom/canvas/OffscreenCanvasDisplayHelper.cpp | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/dom/canvas/OffscreenCanvasDisplayHelper.cpp b/dom/canvas/OffscreenCanvasDisplayHelper.cpp index 9e1cbb3e75..972fa468d2 100644 --- a/dom/canvas/OffscreenCanvasDisplayHelper.cpp +++ b/dom/canvas/OffscreenCanvasDisplayHelper.cpp @@ -61,6 +61,22 @@ void OffscreenCanvasDisplayHelper::DestroyCanvas() { mWorkerRef = nullptr; } +bool OffscreenCanvasDisplayHelper::CanElementCaptureStream() const { + MutexAutoLock lock(mMutex); + return !!mWorkerRef; +} + +bool OffscreenCanvasDisplayHelper::UsingElementCaptureStream() const { + MutexAutoLock lock(mMutex); + + if (NS_WARN_IF(!NS_IsMainThread())) { + MOZ_ASSERT_UNREACHABLE("Should not call off main-thread!"); + return !!mCanvasElement; + } + + return mCanvasElement && mCanvasElement->UsingCaptureStream(); +} + CanvasContextType OffscreenCanvasDisplayHelper::GetContextType() const { MutexAutoLock lock(mMutex); return mType; @@ -116,11 +132,11 @@ void OffscreenCanvasDisplayHelper::FlushForDisplay() { return; } - class FlushWorkerRunnable final : public WorkerRunnable { + class FlushWorkerRunnable final : public WorkerThreadRunnable { public: FlushWorkerRunnable(WorkerPrivate* aWorkerPrivate, OffscreenCanvasDisplayHelper* aDisplayHelper) - : WorkerRunnable(aWorkerPrivate, "FlushWorkerRunnable"), + : WorkerThreadRunnable("FlushWorkerRunnable"), mDisplayHelper(aDisplayHelper) {} bool WorkerRun(JSContext*, WorkerPrivate*) override { @@ -148,7 +164,7 @@ void OffscreenCanvasDisplayHelper::FlushForDisplay() { // Otherwise we are calling from the main thread during painting to a canvas // on a worker thread. auto task = MakeRefPtr<FlushWorkerRunnable>(mWorkerRef->Private(), this); - task->Dispatch(); + task->Dispatch(mWorkerRef->Private()); } bool OffscreenCanvasDisplayHelper::CommitFrameToCompositor( @@ -418,7 +434,7 @@ OffscreenCanvasDisplayHelper::GetSurfaceSnapshot() { public: SnapshotWorkerRunnable(WorkerPrivate* aWorkerPrivate, OffscreenCanvasDisplayHelper* aDisplayHelper) - : MainThreadWorkerRunnable(aWorkerPrivate, "SnapshotWorkerRunnable"), + : MainThreadWorkerRunnable("SnapshotWorkerRunnable"), mMonitor("SnapshotWorkerRunnable::mMonitor"), mDisplayHelper(aDisplayHelper) {} @@ -498,7 +514,7 @@ OffscreenCanvasDisplayHelper::GetSurfaceSnapshot() { if (mWorkerRef) { workerRunnable = MakeRefPtr<SnapshotWorkerRunnable>(mWorkerRef->Private(), this); - workerRunnable->Dispatch(); + workerRunnable->Dispatch(mWorkerRef->Private()); } } |