From a552472cb2ded0599f3da0e18776d5c509c6bab8 Mon Sep 17 00:00:00 2001 From: Imanol Fernandez Date: Mon, 25 Nov 2019 17:13:06 +0100 Subject: [PATCH] Improve onFirstContentfulPaintnotification --- .../org/mozilla/vrbrowser/browser/engine/Session.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/src/common/shared/org/mozilla/vrbrowser/browser/engine/Session.java b/app/src/common/shared/org/mozilla/vrbrowser/browser/engine/Session.java index 4e8e08808..292e4fda2 100644 --- a/app/src/common/shared/org/mozilla/vrbrowser/browser/engine/Session.java +++ b/app/src/common/shared/org/mozilla/vrbrowser/browser/engine/Session.java @@ -466,6 +466,7 @@ private void closeSession(@NonNull SessionState aState) { } aState.mSession.close(); aState.setActive(false); + mFirstContentfulPaint = false; } public void captureBitmap() { @@ -1053,6 +1054,14 @@ public void onFirstComposite(@NonNull GeckoSession aSession) { for (GeckoSession.ContentDelegate listener : mContentListeners) { listener.onFirstComposite(aSession); } + if (mFirstContentfulPaint) { + // onFirstContentfulPaint is only called once after a session is opened. + // Notify onFirstContentfulPaint after a session is reattached before + // being closed ((e.g. tab selected) + for (GeckoSession.ContentDelegate listener : mContentListeners) { + listener.onFirstContentfulPaint(aSession); + } + } } }