Hello mobile-firefox-dev,
Eight long months ago, I wrote a mailing list post [1] describing some
investigation I did into separating GeckoView out of Fennec. I got
interested in this project again this weekend and re-ran the
investigations.
tl;dr: separating GeckoView out of Fennec has gotten more difficult in
the intervening eight months.
Details
-------
To help understand how the "core" of GeckoView and the "rest" of
Fennec are intertwined, I use a tool called Classycle [2] that
analyzes dependencies.
By hand, I've defined the following sets of classes [3]:
* the core of GeckoView;
* a "middle" layer of things that GeckoView currently depends on but
I'm not certain really belong in GeckoView;
* and the remainder of Fennec.
If the middle set was empty, we'd be ready to extract GeckoView out of
Fennec today. Unfortunately, it's not empty :( My analysis has
changed a little, but I believe that the middle layer has grown to
include the list [middle] reproduced at the end of this message.
Proposal
--------
I propose to fail the Fennec build if this middle set grows. That is,
the build will go red (both locally and remotely) if you add a
build-time dependency from GeckoView to code in the rest of Fennec. I
have filed Bug 1096627 [4] to track this work.
Discussion
----------
I'd like to get comments on this approach. I'll note a few things
here:
* This will almost certainly make a small portion of Fennec
development more challenging, because you'll need to consider
whether the feature you're building is part of GeckoView and you'll
need to engineer certain features to be split between GeckoView and
Fennec. My perspective is that GeckoView is valuable and paying
this cost incrementally is better than paying it all at once at some
point in the future.
* It's not hard to increase the [middle] set if we need to. The point
is that doing so should be conscious decision.
* I don't think it's feasible to "cut the knot" at one time. I've
looked into a number of these dependencies, and most of them are not
mechanical fixes.
For example, GeckoAppShell depends on the favicons code. Said code
is really about caching and decoding favicons, which doesn't sound
like a GV thing; but it's tied into the Gecko-level functionality
for creating "desktop bookmarks". So separating this dependency
probably requires a critical rethink of how that bookmarking feature
is exposed to GeckoView consumers (including Fennec).
For an even trickier example, GeckoProfile caches instances of
itself on GeckoApp instances. It's not immediately clear what
should own the GeckoProfile instance in a GeckoView App; no matter
what is chosen, there are all sorts of lifecycle issues to work
through in order to do something different than what is done now.
I will try to file some targeted bugs to involve the relevant domain
experts in this project.
Conclusion
----------
I know lots of folks on the Fennec team want to push the GeckoView
project. Here's a low cost way of making sure we don't go backwards
that also helps us better understand what we need to move forward.
Do you support these kinds of build-level assertions?
Yours,
Nick
[1]
https://mail.mozilla.org/pipermail/mobile-firefox-dev/2014-February/000538.html
[2] http://classycle.sourceforge.net/
[3] These sets are [lib], [middle], and [main] in
https://bugzilla.mozilla.org/attachment.cgi?id=8520244&action=diff#a/mobile/android/base/geckoview.ddf_sec2
[4] https://bugzilla.mozilla.org/show_bug.cgi?id=1096627
[middle] = \
org.mozilla.gecko.prompts.* \
org.mozilla.gecko.AlertNotification \
org.mozilla.gecko.FormAssistPopup \
org.mozilla.gecko.GeckoActivity \
org.mozilla.gecko.GeckoApp \
org.mozilla.gecko.GeckoProfileDirectories \
org.mozilla.gecko.GuestSession \
org.mozilla.gecko.R \
org.mozilla.gecko.Tab \
org.mozilla.gecko.Tabs \
org.mozilla.gecko.Telemetry \
org.mozilla.gecko.TelemetryContract \
org.mozilla.gecko.ThumbnailHelper \
org.mozilla.gecko.db.BrowserDB \
org.mozilla.gecko.db.LocalBrowserDB \
org.mozilla.gecko.distribution.Distribution \
org.mozilla.gecko.favicons.Favicons \
org.mozilla.gecko.favicons.OnFaviconLoadedListener
_______________________________________________
mobile-firefox-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/mobile-firefox-dev