[iOS][QD] Implement and use TabsCounter [chromium/src : main]

0 views
Skip to first unread message

Filipa Senra (Gerrit)

unread,
Jul 4, 2024, 1:55:50 AM (yesterday) Jul 4
to Sylvain Defresne, findit...@appspot.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, blundell+...@chromium.org, dullweb...@chromium.org, feature-me...@chromium.org, ios-revie...@chromium.org, ios-r...@chromium.org, marq+...@chromium.org, msrame...@chromium.org, srahim...@chromium.org
Attention needed from Sylvain Defresne

Filipa Senra added 2 comments

Patchset-level comments
File-level comment, Patchset 8 (Latest):
Filipa Senra . resolved

Hey Sylvain! Can you take a look at the counter code? Ty.

File ios/chrome/browser/ui/settings/clear_browsing_data/quick_delete_egtest.mm
Line 419, Patchset 1: IDS_IOS_DELETE_BROWSING_DATA_SUMMARY_SITES, 1))]
Filipa Senra . resolved

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.

Open in Gerrit

Related details

Attention is currently required from:
  • Sylvain Defresne
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I70efde2c4dd04764b833e70bd1b5eed137c41e23
Gerrit-Change-Number: 5667360
Gerrit-PatchSet: 8
Gerrit-Owner: Filipa Senra <fse...@google.com>
Gerrit-Reviewer: Filipa Senra <fse...@google.com>
Gerrit-Reviewer: Sylvain Defresne <sdef...@chromium.org>
Gerrit-Attention: Sylvain Defresne <sdef...@chromium.org>
Gerrit-Comment-Date: Thu, 04 Jul 2024 05:55:44 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Sylvain Defresne (Gerrit)

unread,
Jul 4, 2024, 11:31:54 AM (17 hours ago) Jul 4
to Filipa Senra, findit...@appspot.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, blundell+...@chromium.org, dullweb...@chromium.org, feature-me...@chromium.org, ios-revie...@chromium.org, ios-r...@chromium.org, marq+...@chromium.org, msrame...@chromium.org, srahim...@chromium.org
Attention needed from Filipa Senra

Sylvain Defresne added 7 comments

Patchset-level comments
Sylvain Defresne . resolved

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?

File ios/chrome/browser/browsing_data/model/browsing_data_counter_wrapper.h
Line 9, Patchset 8 (Latest):#import <string_view>
Sylvain Defresne . unresolved

Revert changes to this file.

File ios/chrome/browser/browsing_data/model/tabs_closure_util.h
Line 24, Patchset 8 (Latest):int GetCountOfTabsToClose(WebStateIDToTime tabs_to_last_navigation_time,
Sylvain Defresne . unresolved

This copy the map. You probably want to pass it by const reference.

File ios/chrome/browser/browsing_data/model/tabs_closure_util.mm
Line 38, Patchset 8 (Latest): tabs_to_last_navigation_time.begin(), tabs_to_last_navigation_time.end(),
Sylvain Defresne . unresolved

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);
});
File ios/chrome/browser/browsing_data/model/tabs_closure_util_unittest.mm
Line 44, Patchset 8 (Latest):#if defined(GTEST_HAS_DEATH_TEST)
Sylvain Defresne . unresolved

iOS does not have GTEST_HAS_DEATH_TEST, so remove this test.

File ios/chrome/browser/browsing_data/model/tabs_counter.h
Line 38, Patchset 8 (Latest): explicit TabsCounter(ChromeBrowserState* browser_state);
Sylvain Defresne . unresolved

Inject the dependencies you really need `BrowserList` and `SessionRestorationService`. This will make the code easier to test.

File ios/chrome/browser/browsing_data/model/tabs_counter.mm
Line 62, Patchset 8 (Latest): tabs_closure_util::WebStateIDToTime result) {
Sylvain Defresne . unresolved

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`.

Open in Gerrit

Related details

Attention is currently required from:
  • Filipa Senra
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I70efde2c4dd04764b833e70bd1b5eed137c41e23
    Gerrit-Change-Number: 5667360
    Gerrit-PatchSet: 8
    Gerrit-Owner: Filipa Senra <fse...@google.com>
    Gerrit-Reviewer: Filipa Senra <fse...@google.com>
    Gerrit-Reviewer: Sylvain Defresne <sdef...@chromium.org>
    Gerrit-Attention: Filipa Senra <fse...@google.com>
    Gerrit-Comment-Date: Thu, 04 Jul 2024 15:31:44 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy
    Reply all
    Reply to author
    Forward
    0 new messages