зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1343458 - Label runnables in dom/media/VideoFrameContainer.cpp. r=cpearce
MozReview-Commit-ID: D0QTbA4UwAZ --HG-- extra : rebase_source : fa35324fc7e37b54f05f1ddb864a19c51a6cbec9 extra : intermediate-source : e48b7e6127698005749086d8ee9d94ec4fb39ae6 extra : source : 6b8a2a5d9984828d60b2777b2fa5f305340e3219
This commit is contained in:
Родитель
c8d15b9a9c
Коммит
3c60a97e1f
|
@ -749,6 +749,8 @@ public:
|
|||
|
||||
void SetMediaInfo(const MediaInfo& aInfo);
|
||||
|
||||
virtual AbstractThread* AbstractMainThread() const final override;
|
||||
|
||||
// Telemetry: to record the usage of a {visible / invisible} video element as
|
||||
// the source of {drawImage(), createPattern(), createImageBitmap() and
|
||||
// captureStream()} APIs.
|
||||
|
@ -1188,8 +1190,6 @@ protected:
|
|||
return this;
|
||||
}
|
||||
|
||||
virtual AbstractThread* AbstractMainThread() const final override;
|
||||
|
||||
// Return true if decoding should be paused
|
||||
virtual bool GetPaused() final override
|
||||
{
|
||||
|
|
|
@ -17,6 +17,8 @@ namespace mozilla {
|
|||
static LazyLogModule gVideoFrameContainerLog("VideoFrameContainer");
|
||||
#define CONTAINER_LOG(type, msg) MOZ_LOG(gVideoFrameContainerLog, type, msg)
|
||||
|
||||
#define NS_DispatchToMainThread(...) CompileError_UseAbstractMainThreadInstead
|
||||
|
||||
VideoFrameContainer::VideoFrameContainer(dom::HTMLMediaElement* aElement,
|
||||
already_AddRefed<ImageContainer> aContainer)
|
||||
: mElement(aElement),
|
||||
|
@ -24,7 +26,9 @@ VideoFrameContainer::VideoFrameContainer(dom::HTMLMediaElement* aElement,
|
|||
mBlackImage(nullptr),
|
||||
mFrameID(0),
|
||||
mIntrinsicSizeChanged(false), mImageSizeChanged(false),
|
||||
mPendingPrincipalHandle(PRINCIPAL_HANDLE_NONE), mFrameIDForPendingPrincipalHandle(0)
|
||||
mPendingPrincipalHandle(PRINCIPAL_HANDLE_NONE),
|
||||
mFrameIDForPendingPrincipalHandle(0),
|
||||
mMainThread(aElement->AbstractMainThread())
|
||||
{
|
||||
NS_ASSERTION(aElement, "aElement must not be null");
|
||||
NS_ASSERTION(mImageContainer, "aContainer must not be null");
|
||||
|
@ -78,7 +82,8 @@ SetImageToBlackPixel(PlanarYCbCrImage* aImage)
|
|||
class VideoFrameContainerInvalidateRunnable : public Runnable {
|
||||
public:
|
||||
explicit VideoFrameContainerInvalidateRunnable(VideoFrameContainer* aVideoFrameContainer)
|
||||
: mVideoFrameContainer(aVideoFrameContainer)
|
||||
: Runnable("VideoFrameContainerInvalidateRunnable")
|
||||
, mVideoFrameContainer(aVideoFrameContainer)
|
||||
{}
|
||||
NS_IMETHOD Run()
|
||||
{
|
||||
|
@ -171,7 +176,7 @@ void VideoFrameContainer::SetCurrentFrames(const VideoSegment& aSegment)
|
|||
SetCurrentFramesLocked(mLastPlayedVideoFrame.GetIntrinsicSize(), images);
|
||||
nsCOMPtr<nsIRunnable> event =
|
||||
new VideoFrameContainerInvalidateRunnable(this);
|
||||
NS_DispatchToMainThread(event.forget());
|
||||
mMainThread->Dispatch(event.forget());
|
||||
|
||||
images.ClearAndRetainStorage();
|
||||
}
|
||||
|
@ -242,11 +247,16 @@ void VideoFrameContainer::SetCurrentFramesLocked(const gfx::IntSize& aIntrinsicS
|
|||
mLastPrincipalHandle = mPendingPrincipalHandle;
|
||||
mPendingPrincipalHandle = PRINCIPAL_HANDLE_NONE;
|
||||
mFrameIDForPendingPrincipalHandle = 0;
|
||||
NS_DispatchToMainThread(NS_NewRunnableFunction([self, principalHandle]() {
|
||||
if (self->mElement) {
|
||||
self->mElement->PrincipalHandleChangedForVideoFrameContainer(self, principalHandle);
|
||||
}
|
||||
}));
|
||||
mMainThread->Dispatch(
|
||||
NS_NewRunnableFunction(
|
||||
"PrincipalHandleChangedForVideoFrameContainer",
|
||||
[self, principalHandle]() {
|
||||
if (self->mElement) {
|
||||
self->mElement->PrincipalHandleChangedForVideoFrameContainer(self, principalHandle);
|
||||
}
|
||||
}
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if (aImages.IsEmpty()) {
|
||||
|
@ -357,3 +367,5 @@ void VideoFrameContainer::InvalidateWithFlags(uint32_t aFlags)
|
|||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#undef NS_DispatchToMainThread
|
||||
|
|
|
@ -140,6 +140,8 @@ protected:
|
|||
PrincipalHandle mPendingPrincipalHandle;
|
||||
// The FrameID for which mPendingPrincipal is first valid.
|
||||
ImageContainer::FrameID mFrameIDForPendingPrincipalHandle;
|
||||
|
||||
const RefPtr<AbstractThread> mMainThread;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
|
Загрузка…
Ссылка в новой задаче