Hey Sylvain! Can you take a look at the counter code? Ty.
IDS_IOS_DELETE_BROWSING_DATA_SUMMARY_SITES, 1))]
this is not really part of this Cl, but I thought I would just fix it bc it's super small. Because we only add one url, this test should check for the `1 site` string.
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
I think the code looks good, but I'm afraid that this design will lead to reading the data from disk multiple time. Can we expand the scope of `TabsCounter` to also keep the list of tabs' info so that we don't have to reload it again when we decide to close the tabs?
#import <string_view>
Revert changes to this file.
int GetCountOfTabsToClose(WebStateIDToTime tabs_to_last_navigation_time,
This copy the map. You probably want to pass it by const reference.
tabs_to_last_navigation_time.begin(), tabs_to_last_navigation_time.end(),
nit: I think you don't need .begin(), .end() with base::ranges::count_if
return base::ranges::count_if(
tabs_to_last_navigation_time,
[begin_time, end_time](const auto& web_state_info) {
return ShouldCloseTab(web_state_info.second, begin_time, end_time);
});
#if defined(GTEST_HAS_DEATH_TEST)
iOS does not have GTEST_HAS_DEATH_TEST, so remove this test.
explicit TabsCounter(ChromeBrowserState* browser_state);
Inject the dependencies you really need `BrowserList` and `SessionRestorationService`. This will make the code easier to test.
tabs_closure_util::WebStateIDToTime result) {
You'll eventually need this mapping to close the tabs. Maybe this class should be responsible for keeping the count and the result. So maybe rename it to `TabsCloser` or `TabsWithNoRecentNavigationCloser`.
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |