Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Synthesize FCP for cached pages" #1641

Merged
merged 2 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 10 additions & 12 deletions app/src/common/shared/com/igalia/wolvic/browser/engine/Session.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
import android.content.SharedPreferences;
import android.graphics.Bitmap;
import androidx.preference.PreferenceManager;

import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import android.view.Surface;
import android.view.inputmethod.CursorAnchorInfo;
Expand Down Expand Up @@ -277,9 +280,7 @@ private void dumpState(WSession.ProgressDelegate aListener) {
return;
if (mState.mIsLoading) {
aListener.onPageStart(mState.mSession, mState.mUri);
aListener.onProgressChange(mState.mSession, 0);
} else {
aListener.onProgressChange(mState.mSession, 100);
aListener.onPageStop(mState.mSession, true);
}

Expand Down Expand Up @@ -1276,16 +1277,6 @@ public void onPageStop(@NonNull WSession aSession, boolean b) {
}
}

@Override
public void onProgressChange(@NonNull WSession aSession, int progress) {
if (mState.mSession != aSession) {
return;
}
for (WSession.ProgressDelegate listener : mProgressListeners) {
listener.onProgressChange(aSession, progress);
}
}

@Override
public void onSecurityChange(@NonNull WSession aSession, @NonNull SecurityInformation aInformation) {
if (mState.mSession != aSession) {
Expand Down Expand Up @@ -1376,6 +1367,13 @@ public void onFirstComposite(@NonNull WSession aSession) {
for (WSession.ContentDelegate listener : mContentListeners) {
listener.onFirstContentfulPaint(aSession);
}
} else if (!mState.mIsLoading) {
new Handler(Looper.getMainLooper()).postDelayed(() -> {
// onFirstContentfulPaint is not emitted sometimes when loading a page from
// the cache. This is a workaround to ensure that the event is emitted.
if (!mFirstContentfulPaint)
onFirstContentfulPaint(aSession);
}, 500);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1941,14 +1941,6 @@ public void onPageStop(@NonNull WSession aSession, boolean b) {
mViewModel.setIsLoading(false);
}

@Override
public void onProgressChange(@NonNull WSession aSession, int progress) {
// Pages that are completely loaded from cache don't trigger onFirstContentfulPaint so we
// force it here to the get page properly rendered.
if (!mAfterFirstPaint)
mSession.onFirstContentfulPaint(aSession);
}

public void captureImage() {
mSession.captureBitmap();
}
Expand Down
Loading