[rfc] Investigations into separating GeckoView out of Fennec

Nick Alexander nalexander at mozilla.com
Mon Feb 24 11:21:24 PST 2014


Hello mobile-firefox-dev, (friends, in your best Zoidberg voice),

Motivated by all the problems that I don't understand about how 
packaging a GeckoView library with Android resources is ever supposed to 
work, I started to think about how hard it will be to actually extract 
GeckoView out of Fennec without Android resources.

To help understand the layering of the system, I used Classycle [1]. 
It's neat!

I used the dependency definition file at [2] to figure out where things 
are at.  This simply says that GeckoView is comprised of (at least) the 
following packages and classes.

[lib] = \
   org.mozilla.gecko.gfx.* \
   org.mozilla.gecko.mozglue.* \
   org.mozilla.gecko.sqlite.* \
   org.mozilla.gecko.util.* \
   org.mozilla.gecko.ZoomConstraints \
   org.mozilla.gecko.NSSBridge \
   org.mozilla.gecko.TouchEventInterceptor \
   org.mozilla.gecko.GeckoJavaSampler \
   org.mozilla.gecko.GeckoApp \
   org.mozilla.gecko.GeckoAppShell \
   org.mozilla.gecko.GeckoEvent \
   org.mozilla.gecko.GeckoThread \
   org.mozilla.gecko.EventDispatcher

I ran Classycle like so:

chocho:Classycle1.4.1 nalexander$ java -cp classycle.jar 
classycle.dependency.DependencyChecker -mergeInnerClasses 
-dependencies=@geckoview.ddf 
/Users/nalexander/Mozilla/gecko-dev/objdir-droid/mobile/android/base/jars-proguarded 
&> geckoview.out

The output is at [3].  I really have to hand it to the maintainers of 
org.mozilla.gecko.gfx; modulo a few renames (ZoomConstraints should be 
in .gfx, I think, and TouchEventInterceptor in .utils), the .gfx code is 
really well isolated.  With a little abstraction around preferences and 
tab events, I'm confident .gfx could be "Fennec-clean" in short order. 
I'm also confident we could remove the inappropriate references to 
org.mozilla.gecko.R throughout.

Unfortunately, extracting Fennec from GeckoApp looks to be *very* 
involved.  In fact, a naive approach would be to push almost all of 
GeckoApp into BrowserApp, and then try to make GeckoView work.  This 
sounds like hard work.

In any case, I don't have more time to investigate this now, but didn't 
want my research to die with me.  If you're ever in the neighbourhood, 
check out Classycle [1], and feel free to correct my assumptions about 
what code should live in GeckoView.  And if you can explain to me how 
GeckoView and Android resources are supposed to work, that would be 
nice, too.

Yours,
Nick

[1] http://classycle.sourceforge.net

[2] http://people.mozilla.org/~nalexander/geckoview/geckoview.ddf

[3] http://people.mozilla.org/~nalexander/geckoview/geckoview.out


More information about the mobile-firefox-dev mailing list