The following revision refers to this bug:
https://chromium.googlesource.com/chromium/src.git/+/44c09dc47b0df3de230ad862c98ffeccf1997699
commit 44c09dc47b0df3de230ad862c98ffeccf1997699
Author: sdefresne <sdefresne@chromium.org>
Date: Tue Feb 07 11:13:08 2017
Refactor TabModel initialisation from a saved session.
There was two code path to restore Tabs from a saved sessions, one
in the TabModel initialiser and one in -restoreSessionWindow:. They
were almost the same with the few differences (used helper methods
vs manipulating _tabs directly, thus not sending notifications).
When considering the fact that there are no observer registered at
the time the initialiser is called, nor are there any Tabs in the
_tabs array, the only significant difference left was whether the
state was persisted after updating _currentTab.
Refactor the initialiser to call -restoreSessionWindow: method by
adding an helper method allowing to choose whether the state should
be persisted or not.
While restoring a session in the initialiser via the shared code path,
the selection of the selected tab will be recorded to be reported
as a metric. To not change the metric, the count is reset after
restoring the session in the initialiser.
BUG= 687207
Review-Url: https://codereview.chromium.org/2674893002
Cr-Commit-Position: refs/heads/master@{#448598}
[modify] https://crrev.com/44c09dc47b0df3de230ad862c98ffeccf1997699/ios/chrome/browser/tabs/tab_model.mm
The end goal is to have WebStateList API be as close as possible to TabStripModel API. To reduce the size of the CLs and make the transition in incremental steps, the APIs may diverge temporarily
One example, TabStripModel uses the active tab as opener, but correct handling of active tab requires opener-opened relationship, so WebStateList will temporarily require the opener to be passed to the public methods to implement opener-opened relationship without knowledge of active tab, then once active tab is moved to WebStateList, the opener will be checked to be the active tab and eventually removed.
Comment 1 by bugdroid1@chromium.org
, Feb 6 2017