Replace size() method with empty() when possible.

There is no guaranteed that size() is a constant-time function.
This commit is contained in:
Haojian Wu 2017-03-30 21:44:15 +02:00
parent e4c571fc68
commit d18b34d55f
4 changed files with 5 additions and 6 deletions

View file

@ -108,7 +108,7 @@ uint64_t DevToolsNetworkInterceptor::UpdateThrottledRecords(
uint64_t last_tick,
base::TimeDelta tick_length) {
if (tick_length.is_zero()) {
DCHECK(!records->size());
DCHECK(records->empty());
return last_tick;
}
@ -195,7 +195,7 @@ base::TimeTicks DevToolsNetworkInterceptor::CalculateDesiredTime(
void DevToolsNetworkInterceptor::ArmTimer(base::TimeTicks now) {
size_t suspend_count = suspended_.size();
if (!download_.size() && !upload_.size() && !suspend_count) {
if (download_.empty() && upload_.empty() && !suspend_count) {
timer_.Stop();
return;
}