Commit e9060c68 authored by Mihai Sardarescu's avatar Mihai Sardarescu Committed by Chromium LUCI CQ

Avoid executing useless code in release mode

This CL moves 2 useless if-statements inside DCHECKs.

Bug: None
Change-Id: I5dbf2975190901265aa85569a175c0a7a0e500ec
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2598850
Commit-Queue: Mihai Sardarescu <msarda@chromium.org>
Reviewed-by: default avatarTanmoy Mollik <triploblastic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#839335}
parent 876518d4
......@@ -32,15 +32,14 @@ PrimaryAccountChangeEvent::Type PrimaryAccountChangeEvent::GetEventTypeFor(
if (previous_state_ == current_state_)
return Type::kNone;
if (previous_state_.consent_level == ConsentLevel::kSync) {
// Cannot change the Sync account without signing out first.
DCHECK(previous_state_.primary_account == current_state_.primary_account ||
current_state_.primary_account.IsEmpty());
}
if (previous_state_.primary_account == current_state_.primary_account) {
// Cannot change the consent level for the empty account.
DCHECK(!previous_state_.primary_account.IsEmpty());
}
// Cannot change the Sync account without clearing the primary account first.
DCHECK(previous_state_.consent_level != ConsentLevel::kSync ||
previous_state_.primary_account == current_state_.primary_account ||
current_state_.primary_account.IsEmpty());
// Cannot change the consent level for the empty account.
DCHECK(previous_state_.primary_account != current_state_.primary_account ||
!previous_state_.primary_account.IsEmpty());
switch (consent_level) {
case ConsentLevel::kNotRequired:
......@@ -55,7 +54,8 @@ PrimaryAccountChangeEvent::Type PrimaryAccountChangeEvent::GetEventTypeFor(
? Type::kSet
: Type::kCleared;
}
// Cannot change the Sync account without signing out first.
// Cannot change the Sync account without clearing the primary account
// first.
DCHECK_EQ(current_state_.consent_level, ConsentLevel::kNotRequired);
return Type::kNone;
}
......
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