Skip to content

Instantly share code, notes, and snippets.

@sleroux
Created November 12, 2015 15:46
Show Gist options
  • Save sleroux/c2cef69ed0a57c89194f to your computer and use it in GitHub Desktop.
Save sleroux/c2cef69ed0a57c89194f to your computer and use it in GitHub Desktop.
BVC 2.0

Architecture Drawing - https://www.dropbox.com/s/xo8ra6gd1n687v7/IMG_0126.JPG?dl=0

WIP Branch - https://github.com/mozilla/firefox-ios/tree/sleroux/Bug1212021-InvertTabTray

Present Day BVC

(Potentially) Future BVC

  • Contains only one web view for the selected tab
    • Removes need for 'selectedTab' state
    • BVC can implicitly configure itself
    • We would pass in the Tab (currently named Browser) to the BVC when we instiatiate it
  • Is instantiated when tapping a tab from the Tab Tray and is deallocated when going back to the tray
  • WebViews are kept alive in the TabManager
  • One tab per BVC -> One HomeViewController per BVC
    • Would simplify/solve the state problem we have with Bookmarks

Questions:

  • What are the performance impliciations of moving from a singleton BVC model to per tab model?
  • Best way to manage getting this into mainline for 2.0 potentially?
  • Other ramifications?
    • I know theres already refactoring needed for handling the crash detection, queued tabs, openURLInTab since they rely on the BVC...
@sleroux
Copy link
Author

sleroux commented Nov 13, 2015

Is there a reason not to keep one BVC alive per tab?

Nope. Keeping alive multiple BVCs within the 'TabManager' sounds better than just the 'Tab'. This way we don't keep to recreate views, can manage native/web content views, etc

Is there a reason not to allow multiple HomeViewControllers, one for each time the home page appears in the navigation stack?

Are you saying that since we would have multiple BVCs in the TabManager, we should also have multiple HomeViewControllers containing state?

In general, I like the idea of keeping BVCs/HomeViewControllers alive in memory which would increase perf since we're not reallocated/recreating things everytime. At the same time I worry about memory usage and how we would manage keeping many tabs alive with their HomeViewControllers as well. Trade offs I guess...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment