OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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> |
11 | 11 |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
14 #include "base/file_util.h" | 14 #include "base/file_util.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/memory/scoped_vector.h" | 16 #include "base/memory/scoped_vector.h" |
17 #include "base/message_loop.h" | 17 #include "base/message_loop.h" |
18 #include "base/metrics/histogram.h" | 18 #include "base/metrics/histogram.h" |
19 #include "base/string_util.h" | 19 #include "base/string_util.h" |
20 #include "base/time.h" | 20 #include "base/time.h" |
21 #include "chrome/browser/autocomplete/history_url_provider.h" | 21 #include "chrome/browser/autocomplete/history_url_provider.h" |
22 #include "chrome/browser/bookmarks/bookmark_service.h" | 22 #include "chrome/browser/bookmarks/bookmark_service.h" |
| 23 #include "chrome/browser/history/history_field_trial.h" |
23 #include "chrome/browser/history/history_notifications.h" | 24 #include "chrome/browser/history/history_notifications.h" |
24 #include "chrome/browser/history/history_publisher.h" | 25 #include "chrome/browser/history/history_publisher.h" |
25 #include "chrome/browser/history/in_memory_history_backend.h" | 26 #include "chrome/browser/history/in_memory_history_backend.h" |
26 #include "chrome/browser/history/page_usage_data.h" | 27 #include "chrome/browser/history/page_usage_data.h" |
27 #include "chrome/browser/history/top_sites.h" | 28 #include "chrome/browser/history/top_sites.h" |
28 #include "chrome/common/chrome_constants.h" | 29 #include "chrome/common/chrome_constants.h" |
29 #include "chrome/common/chrome_notification_types.h" | 30 #include "chrome/common/chrome_notification_types.h" |
30 #include "chrome/common/url_constants.h" | 31 #include "chrome/common/url_constants.h" |
31 #include "content/browser/cancelable_request.h" | 32 #include "content/browser/cancelable_request.h" |
32 #include "content/browser/download/download_persistent_store_info.h" | 33 #include "content/browser/download/download_persistent_store_info.h" |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 ScheduleCommit(); | 548 ScheduleCommit(); |
548 } | 549 } |
549 | 550 |
550 void HistoryBackend::InitImpl(const std::string& languages) { | 551 void HistoryBackend::InitImpl(const std::string& languages) { |
551 DCHECK(!db_.get()) << "Initializing HistoryBackend twice"; | 552 DCHECK(!db_.get()) << "Initializing HistoryBackend twice"; |
552 // In the rare case where the db fails to initialize a dialog may get shown | 553 // In the rare case where the db fails to initialize a dialog may get shown |
553 // the blocks the caller, yet allows other messages through. For this reason | 554 // the blocks the caller, yet allows other messages through. For this reason |
554 // we only set db_ to the created database if creation is successful. That | 555 // we only set db_ to the created database if creation is successful. That |
555 // way other methods won't do anything as db_ is still NULL. | 556 // way other methods won't do anything as db_ is still NULL. |
556 | 557 |
| 558 HistoryFieldTrial::Activate(); |
| 559 |
557 TimeTicks beginning_time = TimeTicks::Now(); | 560 TimeTicks beginning_time = TimeTicks::Now(); |
558 | 561 |
559 // Compute the file names. Note that the index file can be removed when the | 562 // Compute the file names. Note that the index file can be removed when the |
560 // text db manager is finished being hooked up. | 563 // text db manager is finished being hooked up. |
561 FilePath history_name = history_dir_.Append(chrome::kHistoryFilename); | 564 FilePath history_name = history_dir_.Append(chrome::kHistoryFilename); |
562 FilePath thumbnail_name = GetThumbnailFileName(); | 565 FilePath thumbnail_name = GetThumbnailFileName(); |
563 FilePath archived_name = GetArchivedFileName(); | 566 FilePath archived_name = GetArchivedFileName(); |
564 FilePath tmp_bookmarks_file = history_dir_.Append( | 567 FilePath tmp_bookmarks_file = history_dir_.Append( |
565 chrome::kHistoryBookmarksFileName); | 568 chrome::kHistoryBookmarksFileName); |
566 | 569 |
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1216 // if (archived_db_.get() && | 1219 // if (archived_db_.get() && |
1217 // expirer_.GetCurrentArchiveTime() - TimeDelta::FromDays(7)) { | 1220 // expirer_.GetCurrentArchiveTime() - TimeDelta::FromDays(7)) { |
1218 } else { | 1221 } else { |
1219 // Full text history query. | 1222 // Full text history query. |
1220 QueryHistoryFTS(text_query, options, &request->value); | 1223 QueryHistoryFTS(text_query, options, &request->value); |
1221 } | 1224 } |
1222 } | 1225 } |
1223 | 1226 |
1224 request->ForwardResult(request->handle(), &request->value); | 1227 request->ForwardResult(request->handle(), &request->value); |
1225 | 1228 |
1226 UMA_HISTOGRAM_TIMES("History.QueryHistory", | 1229 UMA_HISTOGRAM_TIMES( |
1227 TimeTicks::Now() - beginning_time); | 1230 "History.QueryHistory" + HistoryFieldTrial::GetGroupSuffix(), |
| 1231 TimeTicks::Now() - beginning_time); |
1228 } | 1232 } |
1229 | 1233 |
1230 // Basic time-based querying of history. | 1234 // Basic time-based querying of history. |
1231 void HistoryBackend::QueryHistoryBasic(URLDatabase* url_db, | 1235 void HistoryBackend::QueryHistoryBasic(URLDatabase* url_db, |
1232 VisitDatabase* visit_db, | 1236 VisitDatabase* visit_db, |
1233 const QueryOptions& options, | 1237 const QueryOptions& options, |
1234 QueryResults* result) { | 1238 QueryResults* result) { |
1235 // First get all visits. | 1239 // First get all visits. |
1236 VisitVector visits; | 1240 VisitVector visits; |
1237 visit_db->GetVisibleVisitsInRange(options.begin_time, options.end_time, | 1241 visit_db->GetVisibleVisitsInRange(options.begin_time, options.end_time, |
(...skipping 1061 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2299 break; | 2303 break; |
2300 } | 2304 } |
2301 } | 2305 } |
2302 } | 2306 } |
2303 UMA_HISTOGRAM_TIMES("History.GetFavIconFromDB", // historical name | 2307 UMA_HISTOGRAM_TIMES("History.GetFavIconFromDB", // historical name |
2304 TimeTicks::Now() - beginning_time); | 2308 TimeTicks::Now() - beginning_time); |
2305 return success; | 2309 return success; |
2306 } | 2310 } |
2307 | 2311 |
2308 } // namespace history | 2312 } // namespace history |
OLD | NEW |