flutter_webview_plugin icon indicating copy to clipboard operation
flutter_webview_plugin copied to clipboard

Weird lag while navigating to WebviewScaffold

Open OsamaFelFel opened this issue 5 years ago • 5 comments

System info

Issue occurs on: both Plugin version: 0.3.9+1 Flutter doctor output:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.9.1+hotfix.6, on Mac OS X 10.15.1 19B88, locale en-EG)
 
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 11.2.1)
[✓] Android Studio (version 3.0)
[✓] IntelliJ IDEA Ultimate Edition (version 2019.2.4)
[✓] VS Code (version 1.38.1)
[✓] Connected device (1 available)

• No issues found!

Steps to Reproduce

I'm facing a weird lag while navigating to WebviewScaffold. It's as if the body is being drawn without animation in the final location while still animating the app bar. It happens in both iOS & Android but it's more visible in iOS due to the default animation. I'm attaching gifs to show the issue

laginnavigation

lagandroid

Here is the code to reproduce it

void _openWebView({@required String title, @required String url})
  {
    widget._logger.log(message: url);
    Navigator.of(context).push(MaterialPageRoute
    (
      builder: (context)
      {
        return WebviewScaffold
        (
          url: url,
          withJavascript: true,
          clearCache: true,
          clearCookies: true,
          withZoom: false,
          appBar: TopNavBar.getAppBar(context, title, BackButton(color: Configs.current.COLORS_PRIMARY)),
          initialChild: Container
            (
            width: MediaQuery.of(context).size.width,
            color: Colors.white,
            child: Center
              (
              child: Loader
                (
                shadow: Colors.transparent,
                hasText: false,
              ),
            ),
          ),
        );
      }
    ));
  }

Logs

[+2061 ms] [DEVICE LOG] 2019-11-19 19:32:08.872626+0200  localhost Runner[41473]: (WebKit) [com.apple.WebKit:ProcessSuspension] 0x7fbf0a43b260 - ProcessThrottler::didConnectToProcess(41542)
[        ] [DEVICE LOG] 2019-11-19 19:32:08.872738+0200  localhost Runner[41473]: (WebKit) [com.apple.WebKit:ProcessSuspension] 0x13f2f72d0 - ProcessAssertion() PID 41473 acquiring assertion for process with PID 41542, name 'Web
content visibility'
[        ] [DEVICE LOG] 2019-11-19 19:32:08.872996+0200  localhost Runner[41473]: (WebKit) [com.apple.WebKit:ProcessSuspension] 0x60000377a300 - WKProcessAssertionBackgroundTaskManager - beginBackgroundTaskWithName
[  +13 ms] [DEVICE LOG] 2019-11-19 19:32:08.887510+0200  localhost Runner[41473]: (WebKit) [com.apple.WebKit:ProcessSuspension] 0x13f2d0228 - ProcessThrottler::didConnectToProcess(41543)
[        ] [DEVICE LOG] 2019-11-19 19:32:08.887566+0200  localhost Runner[41473]: (WebKit) [com.apple.WebKit:ProcessSuspension] 0x13f2f7300 - ProcessAssertion() PID 41473 acquiring assertion for process with PID 41543, name 'Web
content visibility'
[        ] [DEVICE LOG] 2019-11-19 19:32:08.887638+0200  localhost Runner[41473]: (WebKit) [com.apple.WebKit:ProcessSuspension] 0x13f2d0000 - WebProcessProxy::didSetAssertionState(Foreground) taking foreground assertion for network
process
[        ] [DEVICE LOG] 2019-11-19 19:32:08.887746+0200  localhost Runner[41473]: (WebKit) [com.apple.WebKit:ProcessSuspension] 0x7fbf0a689bc0 - ProcessThrottler::didConnectToProcess(41544)
[        ] [DEVICE LOG] 2019-11-19 19:32:08.887781+0200  localhost Runner[41473]: (WebKit) [com.apple.WebKit:ProcessSuspension] 0x13f2f7330 - ProcessAssertion() PID 41473 acquiring assertion for process with PID 41544, name 'Web
content visibility'
[ +249 ms] [DEVICE LOG] 2019-11-19 19:32:09.139014+0200  localhost Runner[41473]: (WebKit) [com.apple.WebKit:ProcessSuspension] 0x13f2f7360 - ProcessAssertion() PID 41473 acquiring assertion for process with PID 41542, name
'ConnectionTerminationWatchdog'
[        ] [DEVICE LOG] 2019-11-19 19:32:09.139257+0200  localhost Runner[41473]: (WebKit) [com.apple.WebKit:ProcessSuspension] 0x13f2f72d0 - ~ProcessAssertion() Releasing process assertion
[        ] [DEVICE LOG] 2019-11-19 19:32:09.140266+0200  localhost Runner[41473]: (WebKit) [com.apple.WebKit:ProcessSuspension] 0x7fbf0a43b130 - NetworkProcessProxy is releasing a background assertion because the Network process is
done deleting Website data
[ +472 ms] [DEVICE LOG] 2019-11-19 19:32:09.612788+0200  localhost Runner[41473]: (RunningBoardServices) Created Activity ID: 0x9a1cac, Description: assertionsDidInvalidate
[        ] [DEVICE LOG] 2019-11-19 19:32:09.613477+0200  localhost Runner[41473]: (WebKit) [com.apple.WebKit:ProcessSuspension] 0x13f2f7360 - ProcessAssertion() Process assertion for process with PID 41542 was invalidated
[        ] [DEVICE LOG] 2019-11-19 19:32:09.613559+0200  localhost Runner[41473]: (WebKit) [com.apple.WebKit:ProcessSuspension] 0x13f2f7360 - ProcessAssertion::processAssertionWasInvalidated()
[   +7 ms] [DEVICE LOG] 2019-11-19 19:32:09.620989+0200  localhost Runner[41473]: (WebKit) [com.apple.WebKit:Process] Created visibility propagation view 0x7fbf0a683c90 for WebContent process with PID 41543
[  +22 ms] [DEVICE LOG] 2019-11-19 19:32:09.643655+0200  localhost Runner[41473]: (CoreFoundation) Created Activity ID: 0x9a1cad, Description: Loading Preferences From System CFPrefsD
[   +1 ms] [DEVICE LOG] 2019-11-19 19:32:09.644600+0200  localhost Runner[41473]: (AppSSOCore) [com.apple.AppSSO:SOConfigurationClient] -[SOConfigurationClient init]  on <SOConfigurationClient: 0x6000022e0900>
[        ] [DEVICE LOG] 2019-11-19 19:32:09.644808+0200  localhost Runner[41473]: (AppSSOCore) [com.apple.AppSSO:SOServiceConnection] <SOServiceConnection: 0x6000022e08e0>: new XPC connection
[   +2 ms] [DEVICE LOG] 2019-11-19 19:32:09.648162+0200  localhost Runner[41473]: (WebKit) [com.apple.WebKit:ProcessSwapping] 0x7fbf0b199020 - WebPageProxy::decidePolicyForNavigationAction: keep using process 41543 for navigation,
reason: Process has not yet committed any provisional loads
[   +7 ms] [DEVICE LOG] 2019-11-19 19:32:09.655784+0200  localhost Runner[41473]: (WebKit) [com.apple.WebKit:Loading] 0x7fbf0b199020 - WebPageProxy::didStartProvisionalLoadForFrame: webPID = 41543, pageID = 8, frameID = 1
[  +85 ms] [DEVICE LOG] 2019-11-19 19:32:09.741085+0200  localhost Runner[41473]: (WebKit) [com.apple.WebKit:ProcessSuspension] UIProcess is taking a background assertion because the WebContent process is holding locked files
[  +76 ms] [DEVICE LOG] 2019-11-19 19:32:09.816186+0200  localhost Runner[41473]: (WebKit) [com.apple.WebKit:Loading] 0x7fbf0b199020 - WebPageProxy::didNavigateWithNavigationDataShared: webPID = 41543, pageID = 8
[        ] [DEVICE LOG] 2019-11-19 19:32:09.816452+0200  localhost Runner[41473]: (WebKit) [com.apple.WebKit:Loading] 0x7fbf0b199020 - WebPageProxy::didCommitLoadForFrame: webPID = 41543, pageID = 8, frameID = 1
[ +139 ms] [DEVICE LOG] 2019-11-19 19:32:09.957310+0200  localhost Runner[41473]: (WebKit) [com.apple.WebKit:Loading] 0x7fbf0b199020 - WebPageProxy::didFinishDocumentLoadForFrame: webPID = 41543, pageID = 8, frameID = 1
[  +21 ms] [DEVICE LOG] 2019-11-19 19:32:09.978038+0200  localhost Runner[41473]: (WebKit) [com.apple.WebKit:Loading] 0x7fbf0b199020 - WebPageProxy::didFinishLoadForFrame: webPID = 41543, pageID = 8, frameID = 1
[        ] [DEVICE LOG] 2019-11-19 19:32:09.978097+0200  localhost Runner[41473]: (WebKit) [com.apple.WebKit:ProcessSuspension] 0x13f2e94e0 - NavigationState will release its process network assertion soon because the page load
completed
[+3002 ms] [DEVICE LOG] 2019-11-19 19:32:12.979149+0200  localhost Runner[41473]: (WebKit) [com.apple.WebKit:ProcessSuspension] 0x13f2e94e0 NavigationState is releasing background process assertion because a page load completed
[+1760 ms] [DEVICE LOG] 2019-11-19 19:32:14.741773+0200  localhost Runner[41473]: (WebKit) [com.apple.WebKit:ProcessSuspension] UIProcess is releasing a background assertion because the WebContent process is no longer holding
locked files

[✓] Flutter (Channel stable, v1.9.1+hotfix.6, on Mac OS X 10.15.1 19B88, locale en-EG)
    • Flutter version 1.9.1+hotfix.6 at /Users/osamafelfel/work/flutter
    • Framework revision 68587a0916 (10 weeks ago), 2019-09-13 19:46:58 -0700
    • Engine revision b863200c37
    • Dart version 2.5.0

 
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at /Users/osamafelfel/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 28.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b08)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.2.1, Build version 11B500
    • CocoaPods version 1.7.5

[✓] Android Studio (version 3.0)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 23.2.1
    • Dart plugin version 171.4424
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b08)

[✓] IntelliJ IDEA Ultimate Edition (version 2019.2.4)
    • IntelliJ at /Applications/IntelliJ IDEA.app
    • Flutter plugin version 41.1.4
    • Dart plugin version 192.7402

[✓] VS Code (version 1.38.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.2.0

[✓] Connected device (2 available)
    • AOSP on IA Emulator • emulator-5554                        • android-x86 • Android 9 (API 28) (emulator)
    • iPhone 11 Pro Max   • 1CCE1C63-DFC2-46B6-90B3-40AA32573E54 • ios         • com.apple.CoreSimulator.SimRuntime.iOS-13-2 (simulator)

• No issues found!

OsamaFelFel avatar Nov 19 '19 17:11 OsamaFelFel

Same here, looks like because of using WebviewScaffold, which using Material Scaffold instead of Cupertino Scaffold.

But I don't know how to fix it except to write my own wrapper for webview, and not the fact that it will help.

Crisis2010 avatar Nov 22 '19 09:11 Crisis2010

up!

SebAubin avatar Dec 11 '19 18:12 SebAubin

up!

RSC-88 avatar Mar 27 '20 23:03 RSC-88

up!

2coo avatar Jan 12 '21 10:01 2coo

same here

shlima avatar Apr 15 '21 14:04 shlima