| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 | 105 |
| 106 autocomplete_table_->SetCancelled(); | 106 autocomplete_table_->SetCancelled(); |
| 107 logged_in_table_->SetCancelled(); | 107 logged_in_table_->SetCancelled(); |
| 108 resource_prefetch_tables_->SetCancelled(); | 108 resource_prefetch_tables_->SetCancelled(); |
| 109 } | 109 } |
| 110 | 110 |
| 111 void PredictorDatabaseInternal::LogDatabaseStats() { | 111 void PredictorDatabaseInternal::LogDatabaseStats() { |
| 112 CHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); | 112 CHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); |
| 113 | 113 |
| 114 int64 db_size; | 114 int64 db_size; |
| 115 bool success = file_util::GetFileSize(db_path_, &db_size); | 115 bool success = base::GetFileSize(db_path_, &db_size); |
| 116 DCHECK(success) << "Failed to get file size for " << db_path_.value(); | 116 DCHECK(success) << "Failed to get file size for " << db_path_.value(); |
| 117 UMA_HISTOGRAM_MEMORY_KB("PredictorDatabase.DatabaseSizeKB", | 117 UMA_HISTOGRAM_MEMORY_KB("PredictorDatabase.DatabaseSizeKB", |
| 118 static_cast<int>(db_size / 1024)); | 118 static_cast<int>(db_size / 1024)); |
| 119 | 119 |
| 120 autocomplete_table_->LogDatabaseStats(); | 120 autocomplete_table_->LogDatabaseStats(); |
| 121 logged_in_table_->LogDatabaseStats(); | 121 logged_in_table_->LogDatabaseStats(); |
| 122 if (is_resource_prefetch_predictor_enabled_) | 122 if (is_resource_prefetch_predictor_enabled_) |
| 123 resource_prefetch_tables_->LogDatabaseStats(); | 123 resource_prefetch_tables_->LogDatabaseStats(); |
| 124 } | 124 } |
| 125 | 125 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 149 scoped_refptr<ResourcePrefetchPredictorTables> | 149 scoped_refptr<ResourcePrefetchPredictorTables> |
| 150 PredictorDatabase::resource_prefetch_tables() { | 150 PredictorDatabase::resource_prefetch_tables() { |
| 151 return db_->resource_prefetch_tables_; | 151 return db_->resource_prefetch_tables_; |
| 152 } | 152 } |
| 153 | 153 |
| 154 sql::Connection* PredictorDatabase::GetDatabase() { | 154 sql::Connection* PredictorDatabase::GetDatabase() { |
| 155 return db_->db_.get(); | 155 return db_->db_.get(); |
| 156 } | 156 } |
| 157 | 157 |
| 158 } // namespace predictors | 158 } // namespace predictors |
| OLD | NEW |