Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(343)

Issue 2766063002: Remove the concept of currentItemIndex (Closed)

Created:
3 years, 9 months ago by liaoyuke
Modified:
3 years, 9 months ago
CC:
chromium-reviews, ios-reviews+chrome_chromium.org, ios-reviews_chromium.org, Eugene But (OOO till 7-30), baxley+watch_chromium.org, pkl (ping after 24h if needed), ios-reviews+web_chromium.org, noyau+watch_chromium.org, marq+watch_chromium.org, huangml+watch_chromium.org, liaoyuke+watch_chromium.org, sync-reviews_chromium.org, sdefresne+watch_chromium.org
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Remove the concept of currentItemIndex In NavigationManager and SessionController, the concept of current item index is simply a duplicate of last committed item, and what's worse, this results in GetCurrentItemIndex != GetItemIndex(GetCurrentItem), which is counter-intuitive. This CL removes the concept of currentItemIndex and converts callers to use lastCommittedItemIndex instead. This CL will diverges us from web content, but I think it's totally worth it given that APIs containing "current" have become quite untrustworthy, and removing this API will make our web code less confusing. NOTE: this CL doesn't touch the concept of currentItem. BUG=703863 Review-Url: https://codereview.chromium.org/2766063002 Cr-Commit-Position: refs/heads/master@{#459097} Committed: https://chromium.googlesource.com/chromium/src/+/c833f1b7fee45abebea16b04eeaf62d198af3157

Patch Set 1 #

Total comments: 4

Patch Set 2 : Addressed comments #

Total comments: 2

Patch Set 3 : Addressed comments #

Patch Set 4 : fix unit tests #

Unified diffs Side-by-side diffs Delta from patch set Stats (+196 lines, -213 lines) Patch
M components/sessions/ios/ios_live_tab.mm View 1 chunk +1 line, -1 line 0 comments Download
M ios/chrome/browser/native_app_launcher/native_app_navigation_util.mm View 1 chunk +1 line, -1 line 0 comments Download
M ios/chrome/browser/sync/ios_chrome_synced_tab_delegate.mm View 1 chunk +1 line, -1 line 0 comments Download
M ios/chrome/browser/web/navigation_manager_util.mm View 1 chunk +1 line, -1 line 0 comments Download
M ios/shared/chrome/browser/tabs/web_state_list.mm View 1 chunk +2 lines, -1 line 0 comments Download
M ios/shared/chrome/browser/tabs/web_state_list_order_controller_unittest.mm View 1 chunk +0 lines, -1 line 0 comments Download
M ios/shared/chrome/browser/tabs/web_state_list_unittest.mm View 1 1 chunk +11 lines, -9 lines 0 comments Download
M ios/web/navigation/crw_session_controller.h View 1 3 chunks +5 lines, -5 lines 0 comments Download
M ios/web/navigation/crw_session_controller.mm View 1 2 16 chunks +67 lines, -68 lines 0 comments Download
M ios/web/navigation/crw_session_controller+private_constructors.h View 1 2 3 1 chunk +2 lines, -2 lines 0 comments Download
M ios/web/navigation/crw_session_controller_unittest.mm View 1 2 3 19 chunks +48 lines, -48 lines 0 comments Download
M ios/web/navigation/crw_session_storage_unittest.mm View 1 2 3 2 chunks +4 lines, -4 lines 0 comments Download
M ios/web/navigation/navigation_manager_impl.h View 1 chunk +0 lines, -1 line 0 comments Download
M ios/web/navigation/navigation_manager_impl.mm View 1 2 3 6 chunks +10 lines, -14 lines 0 comments Download
M ios/web/navigation/navigation_manager_impl_unittest.mm View 11 chunks +13 lines, -13 lines 0 comments Download
M ios/web/navigation/session_storage_builder.mm View 1 2 3 3 chunks +10 lines, -11 lines 0 comments Download
M ios/web/net/crw_ssl_status_updater_unittest.mm View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M ios/web/public/crw_session_storage.h View 1 2 3 1 chunk +2 lines, -2 lines 0 comments Download
M ios/web/public/crw_session_storage.mm View 1 2 3 4 chunks +11 lines, -13 lines 0 comments Download
M ios/web/public/navigation_manager.h View 1 chunk +0 lines, -4 lines 0 comments Download
M ios/web/public/test/fakes/test_navigation_manager.h View 1 2 chunks +3 lines, -4 lines 0 comments Download
M ios/web/public/test/fakes/test_navigation_manager.mm View 1 2 chunks +3 lines, -8 lines 0 comments Download

Messages

Total messages: 27 (18 generated)
liaoyuke
Hey Eugene, Kurt, PTAL. Thank you very much!
3 years, 9 months ago (2017-03-21 23:40:37 UTC) #2
kkhorimoto
In addition to my comments, could you also replace |_currentNavigationIndex| with |_lastCommittedItemIndex| in CRWSessionController https://codereview.chromium.org/2766063002/diff/1/ios/shared/chrome/browser/tabs/web_state_list_unittest.mm ...
3 years, 9 months ago (2017-03-21 23:54:17 UTC) #3
liaoyuke
PTAL. Thank you very much! https://codereview.chromium.org/2766063002/diff/1/ios/shared/chrome/browser/tabs/web_state_list_unittest.mm File ios/shared/chrome/browser/tabs/web_state_list_unittest.mm (left): https://codereview.chromium.org/2766063002/diff/1/ios/shared/chrome/browser/tabs/web_state_list_unittest.mm#oldcode116 ios/shared/chrome/browser/tabs/web_state_list_unittest.mm:116: int GetLastCommittedItemIndex() const override ...
3 years, 9 months ago (2017-03-22 18:50:37 UTC) #8
Eugene But (OOO till 7-30)
Thanks for doing this! lgtm https://codereview.chromium.org/2766063002/diff/60001/ios/web/navigation/crw_session_controller.mm File ios/web/navigation/crw_session_controller.mm (right): https://codereview.chromium.org/2766063002/diff/60001/ios/web/navigation/crw_session_controller.mm#newcode492 ios/web/navigation/crw_session_controller.mm:492: // |sourceLastCommittedIndex|, the |source|'s ...
3 years, 9 months ago (2017-03-22 20:19:13 UTC) #9
liaoyuke
Thank you for reviewing! Hi Scott, Could you please do a quick owner's approval? Thanks! ...
3 years, 9 months ago (2017-03-22 22:40:23 UTC) #13
sky
LGTM
3 years, 9 months ago (2017-03-22 23:49:28 UTC) #14
liaoyuke
Thank you for the quick response! On Wed, Mar 22, 2017 at 4:49 PM <sky@chromium.org> ...
3 years, 9 months ago (2017-03-22 23:59:04 UTC) #15
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2766063002/100001
3 years, 9 months ago (2017-03-23 15:49:00 UTC) #24
commit-bot: I haz the power
3 years, 9 months ago (2017-03-23 15:58:14 UTC) #27
Message was sent while issue was closed.
Committed patchset #4 (id:100001) as
https://chromium.googlesource.com/chromium/src/+/c833f1b7fee45abebea16b04eeaf...

Powered by Google App Engine
This is Rietveld 408576698