OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/history/core/browser/typed_url_syncable_service.h" | 5 #include "components/history/core/browser/typed_url_syncable_service.h" |
6 | 6 |
| 7 #include <stddef.h> |
| 8 |
7 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
8 #include "base/logging.h" | 10 #include "base/logging.h" |
9 #include "base/metrics/histogram_macros.h" | 11 #include "base/metrics/histogram_macros.h" |
10 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
11 #include "components/history/core/browser/history_backend.h" | 13 #include "components/history/core/browser/history_backend.h" |
12 #include "net/base/net_util.h" | 14 #include "net/base/net_util.h" |
13 #include "sync/protocol/sync.pb.h" | 15 #include "sync/protocol/sync.pb.h" |
14 #include "sync/protocol/typed_url_specifics.pb.h" | 16 #include "sync/protocol/typed_url_specifics.pb.h" |
15 | 17 |
16 namespace history { | 18 namespace history { |
(...skipping 16 matching lines...) Expand all Loading... |
33 static const int kTypedUrlVisitThrottleThreshold = 10; | 35 static const int kTypedUrlVisitThrottleThreshold = 10; |
34 | 36 |
35 // This is the multiple we use when throttling sync updates. If the multiple is | 37 // This is the multiple we use when throttling sync updates. If the multiple is |
36 // N, we sync up every Nth update (i.e. when typed_count % N == 0). | 38 // N, we sync up every Nth update (i.e. when typed_count % N == 0). |
37 static const int kTypedUrlVisitThrottleMultiple = 10; | 39 static const int kTypedUrlVisitThrottleMultiple = 10; |
38 | 40 |
39 } // namespace | 41 } // namespace |
40 | 42 |
41 // Enforce oldest to newest visit order. | 43 // Enforce oldest to newest visit order. |
42 static bool CheckVisitOrdering(const VisitVector& visits) { | 44 static bool CheckVisitOrdering(const VisitVector& visits) { |
43 int64 previous_visit_time = 0; | 45 int64_t previous_visit_time = 0; |
44 for (VisitVector::const_iterator visit = visits.begin(); | 46 for (VisitVector::const_iterator visit = visits.begin(); |
45 visit != visits.end(); ++visit) { | 47 visit != visits.end(); ++visit) { |
46 if (visit != visits.begin()) { | 48 if (visit != visits.begin()) { |
47 // We allow duplicate visits here - they shouldn't really be allowed, but | 49 // We allow duplicate visits here - they shouldn't really be allowed, but |
48 // they still seem to show up sometimes and we haven't figured out the | 50 // they still seem to show up sometimes and we haven't figured out the |
49 // source, so we just log an error instead of failing an assertion. | 51 // source, so we just log an error instead of failing an assertion. |
50 // (http://crbug.com/91473). | 52 // (http://crbug.com/91473). |
51 if (previous_visit_time == visit->visit_time.ToInternalValue()) | 53 if (previous_visit_time == visit->visit_time.ToInternalValue()) |
52 DVLOG(1) << "Duplicate visit time encountered"; | 54 DVLOG(1) << "Duplicate visit time encountered"; |
53 else if (previous_visit_time > visit->visit_time.ToInternalValue()) | 55 else if (previous_visit_time > visit->visit_time.ToInternalValue()) |
(...skipping 1004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1058 | 1060 |
1059 for (; new_index < new_visit_count; ++new_index) { | 1061 for (; new_index < new_visit_count; ++new_index) { |
1060 new_visits->push_back(history::VisitInfo( | 1062 new_visits->push_back(history::VisitInfo( |
1061 base::Time::FromInternalValue(sync_specifics.visits(new_index)), | 1063 base::Time::FromInternalValue(sync_specifics.visits(new_index)), |
1062 ui::PageTransitionFromInt( | 1064 ui::PageTransitionFromInt( |
1063 sync_specifics.visit_transitions(new_index)))); | 1065 sync_specifics.visit_transitions(new_index)))); |
1064 } | 1066 } |
1065 } | 1067 } |
1066 | 1068 |
1067 } // namespace history | 1069 } // namespace history |
OLD | NEW |