Why Android-WebView project is much slower than Content-Shell project ?

3,179 views
Skip to first unread message

Ahmed Ibrahim Khalil

unread,
Dec 17, 2013, 10:33:46 AM12/17/13
to chromi...@chromium.org
Hello,

I am developing a native packaged web application that uses Davis' Ford android-chromium project.

The problem now is that I tried the application using Content-Shell apk and it was very fast, but the drawback is that I can't load files using file:///android_asset URL scheme while the Android-WebView apk can load it with no problems but with much slower performance than Content-Shell.

I tried to enable hardware acceleration using the hardwareAccelerated attribute but nothing is rendered and I get lots of log lines stating:
AwContents: "nativeOnDraw failed; clearing to background color."

Although hardwareAccelerated attribute works with no problem under Content-Shell.

So is there a way I could enable hardware acceleration using Android-WebView code so that I could increase performance ?


Cheers.

Martin Kosiba

unread,
Dec 17, 2013, 11:30:47 AM12/17/13
to ahmedibr...@gmail.com, Chromium-dev
It's possible but not trivial and not something we're looking into at the moment.

Currently hardware acceleration in the WebView requires special support from the Android system (see DrawGLFunctor) which only gets invoked when the WebView code is compiled and used as a system framework component.

It might be possible to provide an alternative SDK-clean AwContents.InternalAccessDelegate.requestDrawGl implementation by using a SurfaceView. We'd certainly welcome non-disruptive patches implementing hardware rendering mode for the webview test shell so feel free to give it a shot if you feel up to the task :)

Bo Liu

unread,
Dec 19, 2013, 1:14:03 PM12/19/13
to Marcin Kosiba, ahmedibr...@gmail.com, Chromium-dev
In addition to the DrawGLFunctor support, android webview hardware acceleration also depends on the GraphicsBuffer api (https://android.googlesource.com/platform/frameworks/webview/+/android-4.4_r1.1/chromium/plat_support/graphic_buffer_impl.cpp)

That one is harder to implement in an sdk-clean manner. Probably easier to just remove kEnableMapImage (https://code.google.com/p/chromium/codesearch#chromium/src/android_webview/lib/main/aw_main_delegate.cc&l=59) and switch to the upload path used by ContentShell.


--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev

Ahmed Ibrahim Khalil

unread,
Dec 19, 2013, 5:43:23 PM12/19/13
to bo...@chromium.org, Marcin Kosiba, Chromium-dev
@Bo Liu
So if recompiled the .so file under the android-webview project without the
cl->AppendSwitch(cc::switches::kEnableMapImage);

Hardware Acceleration is going to be used instead of software rendering without the need to render on a SurfaceView ? 

Bo Liu

unread,
Dec 19, 2013, 5:47:48 PM12/19/13
to Ahmed Ibrahim Khalil, Marcin Kosiba, Chromium-dev
Sorry I was not clear.

Removing kEnableMapImage will get rid of the dependency on GraphicsBuffer only, a DrawGLFunctor implementation is still needed.

changj...@intel.com

unread,
Jan 6, 2014, 4:30:56 AM1/6/14
to chromi...@chromium.org
A CL is being working to enable Canvas2D hardware acceleration for Android WebView currently:
https://codereview.chromium.org/101163004

在 2013年12月17日星期二UTC+8下午11时33分46秒,Ahmed Ibrahim Khalil写道:

Srikar Rangineni

unread,
Jan 27, 2014, 9:34:32 AM1/27/14
to chromi...@chromium.org
Any update on this CL?
Reply all
Reply to author
Forward
0 new messages