Bug 1919683 change MediaDecoderOwner::AbstractMainThread() from instance to class method r=media-playback-reviewers,padenot

This no longer needs to be an instance method since
https://hg.mozilla.org/mozilla-central/rev/324cc7d374d1860a1743fa7f8a33a782e3bd4177#l50.524

Another mock MediaDecoderOwner implementation will be added for GTests and
having the single AbstractMainThread() implementation saves having to add
another.

Maintaining the method on MediaDecoderOwner retains the clarification that the
different clients are using the same event queue mechanism.

Differential Revision: https://phabricator.services.mozilla.com/D223696
This commit is contained in:
Karl Tomlinson 2024-09-27 04:43:19 +00:00
parent b8ea2a092b
commit 098fbae913
3 changed files with 4 additions and 8 deletions

View File

@ -7484,10 +7484,6 @@ void HTMLMediaElement::UpdateCustomPolicyAfterPlayed() {
}
}
AbstractThread* HTMLMediaElement::AbstractMainThread() const {
return AbstractThread::MainThread();
}
nsTArray<RefPtr<PlayPromise>> HTMLMediaElement::TakePendingPlayPromises() {
return std::move(mPendingPlayPromises);
}

View File

@ -796,8 +796,6 @@ class HTMLMediaElement : public nsGenericHTMLElement,
void DispatchAsyncTestingEvent(const nsAString& aName) override;
AbstractThread* AbstractMainThread() const final;
// Log the usage of a {visible / invisible} video element as
// the source of {drawImage(), createPattern(), createImageBitmap() and
// captureStream()} APIs. This function can be used to collect telemetries for

View File

@ -8,13 +8,13 @@
#include "MediaInfo.h"
#include "MediaSegment.h"
#include "mozilla/AbstractThread.h"
#include "mozilla/DefineEnum.h"
#include "mozilla/UniquePtr.h"
#include "nsSize.h"
namespace mozilla {
class AbstractThread;
class GMPCrashHelper;
class VideoFrameContainer;
class MediaInfo;
@ -137,7 +137,9 @@ class MediaDecoderOwner {
* implementations so they can compile in Servo without modification.
*/
// Return an abstract thread on which to run main thread runnables.
virtual AbstractThread* AbstractMainThread() const { return nullptr; }
static AbstractThread* AbstractMainThread() {
return AbstractThread::MainThread();
}
// Get the HTMLMediaElement object if the decoder is being used from an
// HTML media element, and null otherwise.