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_database.h" | 5 #include "chrome/browser/history/history_database.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 if (version_status != sql::INIT_OK) | 99 if (version_status != sql::INIT_OK) |
100 return version_status; | 100 return version_status; |
101 | 101 |
102 return committer.Commit() ? sql::INIT_OK : sql::INIT_FAILURE; | 102 return committer.Commit() ? sql::INIT_OK : sql::INIT_FAILURE; |
103 } | 103 } |
104 | 104 |
105 void HistoryDatabase::ComputeDatabaseMetrics( | 105 void HistoryDatabase::ComputeDatabaseMetrics( |
106 const base::FilePath& history_name) { | 106 const base::FilePath& history_name) { |
107 base::TimeTicks start_time = base::TimeTicks::Now(); | 107 base::TimeTicks start_time = base::TimeTicks::Now(); |
108 int64 file_size = 0; | 108 int64 file_size = 0; |
109 if (!file_util::GetFileSize(history_name, &file_size)) | 109 if (!base::GetFileSize(history_name, &file_size)) |
110 return; | 110 return; |
111 int file_mb = static_cast<int>(file_size / (1024 * 1024)); | 111 int file_mb = static_cast<int>(file_size / (1024 * 1024)); |
112 UMA_HISTOGRAM_MEMORY_MB("History.DatabaseFileMB", file_mb); | 112 UMA_HISTOGRAM_MEMORY_MB("History.DatabaseFileMB", file_mb); |
113 | 113 |
114 sql::Statement url_count(db_.GetUniqueStatement("SELECT count(*) FROM urls")); | 114 sql::Statement url_count(db_.GetUniqueStatement("SELECT count(*) FROM urls")); |
115 if (!url_count.Step()) | 115 if (!url_count.Step()) |
116 return; | 116 return; |
117 UMA_HISTOGRAM_COUNTS("History.URLTableCount", url_count.ColumnInt(0)); | 117 UMA_HISTOGRAM_COUNTS("History.URLTableCount", url_count.ColumnInt(0)); |
118 | 118 |
119 sql::Statement visit_count(db_.GetUniqueStatement( | 119 sql::Statement visit_count(db_.GetUniqueStatement( |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 "WHERE id IN (SELECT id FROM segment_usage WHERE time_slot > 0);")); | 457 "WHERE id IN (SELECT id FROM segment_usage WHERE time_slot > 0);")); |
458 | 458 |
459 // Erase all the full text index files. These will take a while to update and | 459 // Erase all the full text index files. These will take a while to update and |
460 // are less important, so we just blow them away. Same with the archived | 460 // are less important, so we just blow them away. Same with the archived |
461 // database. | 461 // database. |
462 needs_version_17_migration_ = true; | 462 needs_version_17_migration_ = true; |
463 } | 463 } |
464 #endif | 464 #endif |
465 | 465 |
466 } // namespace history | 466 } // namespace history |
OLD | NEW |