blob: b8aaec68ec3c2e222594fcd7b82f7221fcc26884 [file] [log] [blame]
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ios/web/navigation/time_smoother.h"
namespace web {
// Duplicated from content/browser/web_contents/navigation_controller_impl.cc.
base::Time TimeSmoother::GetSmoothedTime(base::Time t) {
// If |t| is between the water marks, we're in a run of duplicates
// or just getting out of it, so increase the high-water mark to get
// a time that probably hasn't been used before and return it.
if (low_water_mark_ <= t && t <= high_water_mark_) {
high_water_mark_ += base::TimeDelta::FromMicroseconds(1);
return high_water_mark_;
}
// Otherwise, we're clear of the last duplicate run, so reset the
// water marks.
low_water_mark_ = high_water_mark_ = t;
return t;
}
} // namespace web