Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(155)

Side by Side Diff: ios/web/navigation/time_smoother.cc

Issue 988383002: Upstream various ios/web utilities and helpers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@web-public-upstreaming
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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.
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_;
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698