| Code-Review | +1 |
[bedrock] Migrate GetBrowserCount Step 2Maybe add some necessary detail.
EXPECT_EQ(chrome::GetBrowserCount(profile), 1U);nit: missing one
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
size_t ProfileBrowserCollection::GetBrowserCount(Profile* profile) {Is there any chance we could use the existing `BrowserCollection::GetSize()` method (it should work for profile-scoped and globally-scoped collections). You can use it in these profile-scoped contexts by calling
```
ProfileBrowserCollection::GetForProfile(profile)->GetSize()
```
`GetSize()` shouldn't include pending-delete browsers and I suspect the `IsBrowserShownForProfile` handling for ChromeOS may not be necessary (though perhaps we split the chromeos-specific changes out into their own separate CL to be sure).
| Code-Review | +1 |
size_t ProfileBrowserCollection::GetBrowserCount(Profile* profile) {Is there any chance we could use the existing `BrowserCollection::GetSize()` method (it should work for profile-scoped and globally-scoped collections). You can use it in these profile-scoped contexts by calling
```
ProfileBrowserCollection::GetForProfile(profile)->GetSize()
````GetSize()` shouldn't include pending-delete browsers and I suspect the `IsBrowserShownForProfile` handling for ChromeOS may not be necessary (though perhaps we split the chromeos-specific changes out into their own separate CL to be sure).
+1. You may follow this CL to user `GetSize()`
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
size_t ProfileBrowserCollection::GetBrowserCount(Profile* profile) {Qikai ZhongIs there any chance we could use the existing `BrowserCollection::GetSize()` method (it should work for profile-scoped and globally-scoped collections). You can use it in these profile-scoped contexts by calling
```
ProfileBrowserCollection::GetForProfile(profile)->GetSize()
````GetSize()` shouldn't include pending-delete browsers and I suspect the `IsBrowserShownForProfile` handling for ChromeOS may not be necessary (though perhaps we split the chromeos-specific changes out into their own separate CL to be sure).
+1. You may follow this CL to user `GetSize()`
Maybe add some necessary detail.
Done
EXPECT_EQ(chrome::GetBrowserCount(profile), 1U);Kun Wangnit: missing one
Thanks, guess this is due to a bad rebase...
size_t ProfileBrowserCollection::GetBrowserCount(Profile* profile) {Is there any chance we could use the existing `BrowserCollection::GetSize()` method (it should work for profile-scoped and globally-scoped collections). You can use it in these profile-scoped contexts by calling
```
ProfileBrowserCollection::GetForProfile(profile)->GetSize()
````GetSize()` shouldn't include pending-delete browsers and I suspect the `IsBrowserShownForProfile` handling for ChromeOS may not be necessary (though perhaps we split the chromeos-specific changes out into their own separate CL to be sure).
`IsBrowserShownForProfile` was added here to fix:
https://luci-milo.appspot.com/ui/inv/build-8684453803395850961/test-results?q=BrowserFinderChromeOSTest.FindBrowserOwnedByAnotherProfile
I will see if ProfileBrowserCollection::GetForProfile(profile)->GetSize() works
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
Hidehiko ptal for `chrome/browser/ash/DEPS`
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
"+chrome/browser/ui/browser_window/public/profile_browser_collection.h",could you avoid allowing c/b/ui deps to wider area under c/b/ash?
Instead, could you update DEPS files in sub directories?
EXPECT_EQ(size_t{0}, 0u);This is 0 vs 0. Maybe just remove?
"//chrome/browser/ui/ash/multi_user",clarification: why we need this in this CL...?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
"+chrome/browser/ui/browser_window/public/profile_browser_collection.h",could you avoid allowing c/b/ui deps to wider area under c/b/ash?
Instead, could you update DEPS files in sub directories?
Sure, I will move it to sub directories and I understand that we should make this in the minimum sub dir. It should be in chrome/browser/ash/app_list and it has been added by another cl, the change has been rebase to this current cl, so removed it.
This is 0 vs 0. Maybe just remove?
Yes, you are right, the new implementation doesn't handle null-profile, so this check is not necessary any more, removed
clarification: why we need this in this CL...?
Thanks for reminding this. This is due to patchset 2 when I tried to fix a chromeos unit test in a wrong way, which should be reverted.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
lgtm
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
[bedrock] Migrate GetBrowserCount Step 2
Summary This change adds
ProfileBrowserCollection::GetBrowserCount(Profile*) and migrates the
next batch of chrome::GetBrowserCount() call sites to the browser-window
collection API.
The new helper counts only non-deleting browsers for a profile and
preserves ChromeOS multi-user semantics by only counting browsers shown
for that profile. This keeps profile-scoped browser counting consistent
with the browser window model while updating affected browser tests,
startup flows, and profile-related code.
Testing Updated existing browser tests and unit tests in affected areas.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
if (ProfileBrowserCollection::GetForProfile(profile)->GetSize() == 0) {this has been crashing on my local builds, GetForProfile() returns null sometimes.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
if (ProfileBrowserCollection::GetForProfile(profile)->GetSize() == 0) {this has been crashing on my local builds, GetForProfile() returns null sometimes.
Acknowledged. Thanks for your feedback, we have another CL to handle this issue. https://chromium-review.googlesource.com/c/chromium/src/+/7794693
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |