-
Notifications
You must be signed in to change notification settings - Fork 473
Avoid eagerly rehydrating EngineSessionState for recently closed tabs #11688
Conversation
Fenix PR: mozilla-mobile/fenix#23649 |
1defaf9
to
4535474
Compare
Most of this PR is really just churn around pushing tab state down into |
This pull request has conflicts when rebasing. Could you fix it @grigoryk? 🙏 |
84ec886
to
63d5228
Compare
273c45d
to
8f57c94
Compare
Snuck in a few other things into this PR:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested this in both A-C sample browser and Fenix. I think this is ready to land.
One thing we should discuss is the issue Mihai linked (independent), but we could handle here as well. A crash reading from the recently closed tabs storage should never bring down the app. Let's chat but we can land this.
8e3ac29
to
db9c9d2
Compare
Added try/catch around Added a bit more |
db9c9d2
to
b9af07a
Compare
Hmmm, this didn't fail before:
|
Ah, it's failing intermittently locally as well - we're getting a set of stored tabs back, ordered by lastAccess, and in a test the order isn't stable (since System.currentTimeMillis() will likely give us the two identical values for both tabs under test). |
b9af07a
to
bafa19c
Compare
This change splits out tab-specific data from RecoverableTab data class into a separate TabState (so, it doesn't have the EngineSessionState). Then, once we have the simplified TabState, everything that touches RecentlyClosedTabs is converted to use that instead of its more expensive sibling. This way we avoid having to eagerly process EngineSessionState simply to populate BrowserState.closedTabs. This saves us from having to hit disk (where the EngineSessionState is persisted) on initializing BrowserState (so, startup in most cases). It also saves us from having to parse/rehydrate that persisted state. At the point we actually need the EngineSessionState for a tab we'd like to restore, we can read/process it.
bafa19c
to
7b79596
Compare
This change splits out tab-specific data from
RecoverableTab
data classinto a separate
TabState
(so, it doesn't have theEngineSessionState
).Then, once we have the simplified
TabState
, everything that touchesRecentlyClosedTabs
is converted to use that instead of its more expensive sibling.
This way we avoid having to eagerly process
EngineSessionState
simply to populateBrowserState.closedTabs
.This saves us from having to hit disk (where the
EngineSessionState
is persisted) on initializingBrowserState
(so, startup in most cases).It also saves us from having to parse/rehydrate that persisted state, and keep it in memory (in some regressive cases, these
EngineSessionStates
are very large).At the point we actually need the
EngineSessionState
for a tab we'd like to restore, we can read/process it.Pull Request checklist
After merge