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/predictors/predictor_database.h" | 5 #include "chrome/browser/predictors/predictor_database.h" |
6 | 6 |
| 7 #include <stdint.h> |
| 8 |
7 #include "base/bind.h" | 9 #include "base/bind.h" |
8 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
9 #include "base/files/file_util.h" | 11 #include "base/files/file_util.h" |
10 #include "base/logging.h" | 12 #include "base/logging.h" |
11 #include "base/macros.h" | 13 #include "base/macros.h" |
12 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
13 #include "base/strings/stringprintf.h" | 15 #include "base/strings/stringprintf.h" |
14 #include "chrome/browser/predictors/autocomplete_action_predictor_table.h" | 16 #include "chrome/browser/predictors/autocomplete_action_predictor_table.h" |
15 #include "chrome/browser/predictors/resource_prefetch_predictor.h" | 17 #include "chrome/browser/predictors/resource_prefetch_predictor.h" |
16 #include "chrome/browser/predictors/resource_prefetch_predictor_tables.h" | 18 #include "chrome/browser/predictors/resource_prefetch_predictor_tables.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 !BrowserThread::IsMessageLoopValid(BrowserThread::UI)); | 114 !BrowserThread::IsMessageLoopValid(BrowserThread::UI)); |
113 | 115 |
114 autocomplete_table_->SetCancelled(); | 116 autocomplete_table_->SetCancelled(); |
115 resource_prefetch_tables_->SetCancelled(); | 117 resource_prefetch_tables_->SetCancelled(); |
116 } | 118 } |
117 | 119 |
118 void PredictorDatabaseInternal::LogDatabaseStats() { | 120 void PredictorDatabaseInternal::LogDatabaseStats() { |
119 CHECK(BrowserThread::CurrentlyOn(BrowserThread::DB) || | 121 CHECK(BrowserThread::CurrentlyOn(BrowserThread::DB) || |
120 !BrowserThread::IsMessageLoopValid(BrowserThread::DB)); | 122 !BrowserThread::IsMessageLoopValid(BrowserThread::DB)); |
121 | 123 |
122 int64 db_size; | 124 int64_t db_size; |
123 bool success = base::GetFileSize(db_path_, &db_size); | 125 bool success = base::GetFileSize(db_path_, &db_size); |
124 DCHECK(success) << "Failed to get file size for " << db_path_.value(); | 126 DCHECK(success) << "Failed to get file size for " << db_path_.value(); |
125 UMA_HISTOGRAM_MEMORY_KB("PredictorDatabase.DatabaseSizeKB", | 127 UMA_HISTOGRAM_MEMORY_KB("PredictorDatabase.DatabaseSizeKB", |
126 static_cast<int>(db_size / 1024)); | 128 static_cast<int>(db_size / 1024)); |
127 | 129 |
128 autocomplete_table_->LogDatabaseStats(); | 130 autocomplete_table_->LogDatabaseStats(); |
129 if (is_resource_prefetch_predictor_enabled_) | 131 if (is_resource_prefetch_predictor_enabled_) |
130 resource_prefetch_tables_->LogDatabaseStats(); | 132 resource_prefetch_tables_->LogDatabaseStats(); |
131 } | 133 } |
132 | 134 |
(...skipping 18 matching lines...) Expand all Loading... |
151 scoped_refptr<ResourcePrefetchPredictorTables> | 153 scoped_refptr<ResourcePrefetchPredictorTables> |
152 PredictorDatabase::resource_prefetch_tables() { | 154 PredictorDatabase::resource_prefetch_tables() { |
153 return db_->resource_prefetch_tables_; | 155 return db_->resource_prefetch_tables_; |
154 } | 156 } |
155 | 157 |
156 sql::Connection* PredictorDatabase::GetDatabase() { | 158 sql::Connection* PredictorDatabase::GetDatabase() { |
157 return db_->db_.get(); | 159 return db_->db_.get(); |
158 } | 160 } |
159 | 161 |
160 } // namespace predictors | 162 } // namespace predictors |
OLD | NEW |