OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/in_memory_database.h" | 5 #include "components/history/core/browser/in_memory_database.h" |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 sql::Statement visit_count(db_.GetUniqueStatement( | 95 sql::Statement visit_count(db_.GetUniqueStatement( |
96 "SELECT sum(visit_count) FROM urls")); | 96 "SELECT sum(visit_count) FROM urls")); |
97 if (visit_count.Step()) { | 97 if (visit_count.Step()) { |
98 UMA_HISTOGRAM_COUNTS("History.InMemoryTypedUrlVisitCount", | 98 UMA_HISTOGRAM_COUNTS("History.InMemoryTypedUrlVisitCount", |
99 visit_count.ColumnInt(0)); | 99 visit_count.ColumnInt(0)); |
100 } | 100 } |
101 } | 101 } |
102 | 102 |
103 // Insert keyword search related URLs. | 103 // Insert keyword search related URLs. |
104 begin_load = base::TimeTicks::Now(); | 104 begin_load = base::TimeTicks::Now(); |
105 if (!db_.Execute( | 105 if (!db_.Execute("INSERT OR IGNORE INTO urls SELECT u.id, u.url, u.title, " |
106 "INSERT OR IGNORE INTO urls SELECT u.id, u.url, u.title, u.visit_count, " | 106 "u.visit_count, u.typed_count, u.last_visit_time, u.hidden " |
107 "u.typed_count, u.last_visit_time, u.hidden, u.favicon_id " | 107 "FROM history.urls u JOIN history.keyword_search_terms kst " |
108 "FROM history.urls u JOIN history.keyword_search_terms kst " | 108 "WHERE u.typed_count = 0 AND u.id = kst.url_id")) { |
109 "WHERE u.typed_count = 0 AND u.id = kst.url_id")) { | |
110 // Unable to get data from the history database. This is OK, the file may | 109 // Unable to get data from the history database. This is OK, the file may |
111 // just not exist yet. | 110 // just not exist yet. |
112 } | 111 } |
113 end_load = base::TimeTicks::Now(); | 112 end_load = base::TimeTicks::Now(); |
114 UMA_HISTOGRAM_MEDIUM_TIMES("History.InMemoryDBKeywordURLPopulate", | 113 UMA_HISTOGRAM_MEDIUM_TIMES("History.InMemoryDBKeywordURLPopulate", |
115 end_load - begin_load); | 114 end_load - begin_load); |
116 UMA_HISTOGRAM_COUNTS("History.InMemoryDBKeywordURLItemCount", | 115 UMA_HISTOGRAM_COUNTS("History.InMemoryDBKeywordURLItemCount", |
117 db_.GetLastChangeCount()); | 116 db_.GetLastChangeCount()); |
118 | 117 |
119 // Copy search terms to memory. | 118 // Copy search terms to memory. |
(...skipping 22 matching lines...) Expand all Loading... |
142 CreateKeywordSearchTermsIndices(); | 141 CreateKeywordSearchTermsIndices(); |
143 | 142 |
144 return true; | 143 return true; |
145 } | 144 } |
146 | 145 |
147 sql::Connection& InMemoryDatabase::GetDB() { | 146 sql::Connection& InMemoryDatabase::GetDB() { |
148 return db_; | 147 return db_; |
149 } | 148 } |
150 | 149 |
151 } // namespace history | 150 } // namespace history |
OLD | NEW |