Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / ios / web / navigation / time_smoother.cc
blobb8aaec68ec3c2e222594fcd7b82f7221fcc26884
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ios/web/navigation/time_smoother.h"
7 namespace web {
9 // Duplicated from content/browser/web_contents/navigation_controller_impl.cc.
10 base::Time TimeSmoother::GetSmoothedTime(base::Time t) {
11 // If |t| is between the water marks, we're in a run of duplicates
12 // or just getting out of it, so increase the high-water mark to get
13 // a time that probably hasn't been used before and return it.
14 if (low_water_mark_ <= t && t <= high_water_mark_) {
15 high_water_mark_ += base::TimeDelta::FromMicroseconds(1);
16 return high_water_mark_;
19 // Otherwise, we're clear of the last duplicate run, so reset the
20 // water marks.
21 low_water_mark_ = high_water_mark_ = t;
22 return t;
25 } // namespace web