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

Side by Side Diff: components/sync_sessions/revisit/offset_tab_matcher.cc

Issue 1387253004: [Sync] Creating sync_sessions component, moving revisit logic. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removing test_support target. Created 5 years, 2 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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/sync_driver/revisit/offset_tab_matcher.h" 5 #include "components/sync_sessions/revisit/offset_tab_matcher.h"
6
7 #include <algorithm>
6 8
7 #include "base/metrics/histogram_macros.h" 9 #include "base/metrics/histogram_macros.h"
8 #include "base/metrics/sparse_histogram.h" 10 #include "base/metrics/sparse_histogram.h"
9 #include "components/sessions/core/serialized_navigation_entry.h" 11 #include "components/sessions/core/serialized_navigation_entry.h"
10 12
11 namespace sync_driver { 13 namespace sync_sessions {
12 14
13 namespace { 15 namespace {
14 16
15 // This is an upper bound of the max size of positive offset we will emit 17 // This is an upper bound of the max size of positive offset we will emit
16 // correct metrics for. Anything larger than this will be clamped to this value. 18 // correct metrics for. Anything larger than this will be clamped to this value.
17 // This value doesn't exactly correspond to what we actually expect, this value 19 // This value doesn't exactly correspond to what we actually expect, this value
18 // is currently larger than expected. This value is more for the safety of our 20 // is currently larger than expected. This value is more for the safety of our
19 // sparse histogram usage. It is assumed that the max negative offset is 21 // sparse histogram usage. It is assumed that the max negative offset is
20 // symmetrical and can be found by taking the negative of this value. 22 // symmetrical and can be found by taking the negative of this value.
21 const int kMaxOffset = 10; 23 const int kMaxOffset = 10;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 UMA_HISTOGRAM_ENUMERATION("Sync.PageRevisitNavigationMatchTransition", 71 UMA_HISTOGRAM_ENUMERATION("Sync.PageRevisitNavigationMatchTransition",
70 transition, 72 transition,
71 PageVisitObserver::kTransitionTypeLast); 73 PageVisitObserver::kTransitionTypeLast);
72 } 74 }
73 } 75 }
74 76
75 int OffsetTabMatcher::Clamp(const int input, const int lower, const int upper) { 77 int OffsetTabMatcher::Clamp(const int input, const int lower, const int upper) {
76 return std::max(lower, std::min(upper, input)); 78 return std::max(lower, std::min(upper, input));
77 } 79 }
78 80
79 } // namespace sync_driver 81 } // namespace sync_sessions
OLDNEW
« no previous file with comments | « components/sync_sessions/revisit/offset_tab_matcher.h ('k') | components/sync_sessions/revisit/offset_tab_matcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698