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. 4 5 #include "ios/web/navigation/time_smoother.h" 6 7 namespace web { 8 9 // Duplicated from content/browser/web_contents/navigation_controller_impl.cc. GetSmoothedTime(base::Time t)10base::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_; 17 } 18 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; 23 } 24 25 } // namespace web 26