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 // The number of milliseconds we'll wait to do a commit, so that things are | 74 // How long we'll wait to do a commit, so that things are batched together. |
75 // batched together. | 75 static const int kCommitIntervalSeconds = 10; |
76 static const int kCommitIntervalMs = 10000; | |
77 | 76 |
78 // The amount of time before we re-fetch the favicon. | 77 // The amount of time before we re-fetch the favicon. |
79 static const int kFaviconRefetchDays = 7; | 78 static const int kFaviconRefetchDays = 7; |
80 | 79 |
81 // GetSessionTabs returns all open tabs, or tabs closed kSessionCloseTimeWindow | 80 // GetSessionTabs returns all open tabs, or tabs closed kSessionCloseTimeWindow |
82 // seconds ago. | 81 // seconds ago. |
83 static const int kSessionCloseTimeWindowSecs = 10; | 82 static const int kSessionCloseTimeWindowSecs = 10; |
84 | 83 |
85 // The maximum number of items we'll allow in the redirect list before | 84 // The maximum number of items we'll allow in the redirect list before |
86 // deleting some. | 85 // deleting some. |
(...skipping 1848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1935 } | 1934 } |
1936 } | 1935 } |
1937 | 1936 |
1938 void HistoryBackend::ScheduleCommit() { | 1937 void HistoryBackend::ScheduleCommit() { |
1939 if (scheduled_commit_.get()) | 1938 if (scheduled_commit_.get()) |
1940 return; | 1939 return; |
1941 scheduled_commit_ = new CommitLaterTask(this); | 1940 scheduled_commit_ = new CommitLaterTask(this); |
1942 MessageLoop::current()->PostDelayedTask( | 1941 MessageLoop::current()->PostDelayedTask( |
1943 FROM_HERE, | 1942 FROM_HERE, |
1944 base::Bind(&CommitLaterTask::RunCommit, scheduled_commit_.get()), | 1943 base::Bind(&CommitLaterTask::RunCommit, scheduled_commit_.get()), |
1945 kCommitIntervalMs); | 1944 base::TimeDelta::FromSeconds(kCommitIntervalSeconds)); |
1946 } | 1945 } |
1947 | 1946 |
1948 void HistoryBackend::CancelScheduledCommit() { | 1947 void HistoryBackend::CancelScheduledCommit() { |
1949 if (scheduled_commit_) { | 1948 if (scheduled_commit_) { |
1950 scheduled_commit_->Cancel(); | 1949 scheduled_commit_->Cancel(); |
1951 scheduled_commit_ = NULL; | 1950 scheduled_commit_ = NULL; |
1952 } | 1951 } |
1953 } | 1952 } |
1954 | 1953 |
1955 void HistoryBackend::ProcessDBTaskImpl() { | 1954 void HistoryBackend::ProcessDBTaskImpl() { |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2316 break; | 2315 break; |
2317 } | 2316 } |
2318 } | 2317 } |
2319 } | 2318 } |
2320 UMA_HISTOGRAM_TIMES("History.GetFavIconFromDB", // historical name | 2319 UMA_HISTOGRAM_TIMES("History.GetFavIconFromDB", // historical name |
2321 TimeTicks::Now() - beginning_time); | 2320 TimeTicks::Now() - beginning_time); |
2322 return success; | 2321 return success; |
2323 } | 2322 } |
2324 | 2323 |
2325 } // namespace history | 2324 } // namespace history |
OLD | NEW |