Commit 4fc1007c authored by Ramin Halavati's avatar Ramin Halavati Committed by Commit Bot

Update OTR profile DCHECK in ProfileDestroyer.

Updates the DCHECKing when regular profile is destroyed to ensure no
renderer process host is alive for any off-the-record profile.

Bug: 1033903
Change-Id: I4971d68f6f958fcace723b3515b3ed44f8753866
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2478989Reviewed-by: default avatarMihai Sardarescu <msarda@chromium.org>
Commit-Queue: Ramin Halavati <rhalavati@chromium.org>
Cr-Commit-Position: refs/heads/master@{#819441}
parent 8b77e73b
......@@ -98,10 +98,7 @@ void ProfileDestroyer::DestroyRegularProfileNow(Profile* const profile) {
// on later.
HostSet profile_hosts = GetHostsForProfile(profile);
void* profile_ptr = profile;
// TODO(https://crbug.com/1033903): Updated to cover all OTR profiles.
void* otr_profile_ptr = profile->HasPrimaryOTRProfile()
? profile->GetPrimaryOTRProfile()
: nullptr;
std::vector<Profile*> otr_profiles = profile->GetAllOffTheRecordProfiles();
#endif // DCHECK_IS_ON()
delete profile;
......@@ -111,8 +108,9 @@ void ProfileDestroyer::DestroyRegularProfileNow(Profile* const profile) {
// and off-the-record Profile.
const size_t profile_hosts_count = GetHostsForProfile(profile_ptr).size();
base::debug::Alias(&profile_hosts_count);
const size_t off_the_record_profile_hosts_count =
otr_profile_ptr ? GetHostsForProfile(otr_profile_ptr).size() : 0u;
size_t off_the_record_profile_hosts_count = 0;
for (Profile* otr : otr_profiles)
off_the_record_profile_hosts_count += GetHostsForProfile(otr).size();
base::debug::Alias(&off_the_record_profile_hosts_count);
// |profile| is not off-the-record, so if |profile_hosts| is not empty then
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment