From d906e37232d6a2a60f2f1ed16fe5737b51edf9c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Qu=C3=A8ze?= Date: Wed, 4 Oct 2017 16:01:04 +0200 Subject: [PATCH] Bug 1401919 - Functions used after the seekToNextFrame promise should not be interpreted half the time, r=nbp. --- dom/html/HTMLMediaElement.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/dom/html/HTMLMediaElement.cpp b/dom/html/HTMLMediaElement.cpp index 1d95e37f47fc..b59474997f1b 100644 --- a/dom/html/HTMLMediaElement.cpp +++ b/dom/html/HTMLMediaElement.cpp @@ -2660,6 +2660,18 @@ HTMLMediaElement::FastSeek(double aTime, ErrorResult& aRv) already_AddRefed HTMLMediaElement::SeekToNextFrame(ErrorResult& aRv) { + /* This will cause JIT code to be kept around longer, to help performance + * when using SeekToNextFrame to iterate through every frame of a video. + */ + nsCOMPtr global = + do_QueryInterface(OwnerDoc()->GetInnerWindow()); + + if (global) { + if (JSObject *obj = global->GetGlobalJSObject()) { + js::NotifyAnimationActivity(obj); + } + } + return Seek(CurrentTime(), SeekTarget::NextFrame, aRv); }