OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/history/history_backend.h" | 5 #include "chrome/browser/history/history_backend.h" |
6 | 6 |
7 #include <list> | 7 #include <list> |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 */ | 64 */ |
65 | 65 |
66 namespace history { | 66 namespace history { |
67 | 67 |
68 // How long we keep segment data for in days. Currently 3 months. | 68 // How long we keep segment data for in days. Currently 3 months. |
69 // This value needs to be greater or equal to | 69 // This value needs to be greater or equal to |
70 // MostVisitedModel::kMostVisitedScope but we don't want to introduce a direct | 70 // MostVisitedModel::kMostVisitedScope but we don't want to introduce a direct |
71 // dependency between MostVisitedModel and the history backend. | 71 // dependency between MostVisitedModel and the history backend. |
72 static const int kSegmentDataRetention = 90; | 72 static const int kSegmentDataRetention = 90; |
73 | 73 |
74 // How long we'll wait to do a commit, so that things are batched together. | 74 // The number of milliseconds we'll wait to do a commit, so that things are |
75 static const int kCommitIntervalSeconds = 10; | 75 // batched together. |
| 76 static const int kCommitIntervalMs = 10000; |
76 | 77 |
77 // The amount of time before we re-fetch the favicon. | 78 // The amount of time before we re-fetch the favicon. |
78 static const int kFaviconRefetchDays = 7; | 79 static const int kFaviconRefetchDays = 7; |
79 | 80 |
80 // GetSessionTabs returns all open tabs, or tabs closed kSessionCloseTimeWindow | 81 // GetSessionTabs returns all open tabs, or tabs closed kSessionCloseTimeWindow |
81 // seconds ago. | 82 // seconds ago. |
82 static const int kSessionCloseTimeWindowSecs = 10; | 83 static const int kSessionCloseTimeWindowSecs = 10; |
83 | 84 |
84 // The maximum number of items we'll allow in the redirect list before | 85 // The maximum number of items we'll allow in the redirect list before |
85 // deleting some. | 86 // deleting some. |
(...skipping 1848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1934 } | 1935 } |
1935 } | 1936 } |
1936 | 1937 |
1937 void HistoryBackend::ScheduleCommit() { | 1938 void HistoryBackend::ScheduleCommit() { |
1938 if (scheduled_commit_.get()) | 1939 if (scheduled_commit_.get()) |
1939 return; | 1940 return; |
1940 scheduled_commit_ = new CommitLaterTask(this); | 1941 scheduled_commit_ = new CommitLaterTask(this); |
1941 MessageLoop::current()->PostDelayedTask( | 1942 MessageLoop::current()->PostDelayedTask( |
1942 FROM_HERE, | 1943 FROM_HERE, |
1943 base::Bind(&CommitLaterTask::RunCommit, scheduled_commit_.get()), | 1944 base::Bind(&CommitLaterTask::RunCommit, scheduled_commit_.get()), |
1944 base::TimeDelta::FromSeconds(kCommitIntervalSeconds)); | 1945 kCommitIntervalMs); |
1945 } | 1946 } |
1946 | 1947 |
1947 void HistoryBackend::CancelScheduledCommit() { | 1948 void HistoryBackend::CancelScheduledCommit() { |
1948 if (scheduled_commit_) { | 1949 if (scheduled_commit_) { |
1949 scheduled_commit_->Cancel(); | 1950 scheduled_commit_->Cancel(); |
1950 scheduled_commit_ = NULL; | 1951 scheduled_commit_ = NULL; |
1951 } | 1952 } |
1952 } | 1953 } |
1953 | 1954 |
1954 void HistoryBackend::ProcessDBTaskImpl() { | 1955 void HistoryBackend::ProcessDBTaskImpl() { |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2315 break; | 2316 break; |
2316 } | 2317 } |
2317 } | 2318 } |
2318 } | 2319 } |
2319 UMA_HISTOGRAM_TIMES("History.GetFavIconFromDB", // historical name | 2320 UMA_HISTOGRAM_TIMES("History.GetFavIconFromDB", // historical name |
2320 TimeTicks::Now() - beginning_time); | 2321 TimeTicks::Now() - beginning_time); |
2321 return success; | 2322 return success; |
2322 } | 2323 } |
2323 | 2324 |
2324 } // namespace history | 2325 } // namespace history |
OLD | NEW |