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/chromeos/contacts/contact_database.h" | 5 #include "chrome/browser/chromeos/contacts/contact_database.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 callback.Run(*success, contacts.Pass(), metadata.Pass()); | 168 callback.Run(*success, contacts.Pass(), metadata.Pass()); |
169 } | 169 } |
170 | 170 |
171 void ContactDatabase::InitFromTaskRunner(const base::FilePath& database_dir, | 171 void ContactDatabase::InitFromTaskRunner(const base::FilePath& database_dir, |
172 bool* success) { | 172 bool* success) { |
173 DCHECK(IsRunByTaskRunner()); | 173 DCHECK(IsRunByTaskRunner()); |
174 DCHECK(success); | 174 DCHECK(success); |
175 | 175 |
176 VLOG(1) << "Opening " << database_dir.value(); | 176 VLOG(1) << "Opening " << database_dir.value(); |
177 UMA_HISTOGRAM_MEMORY_KB("Contacts.DatabaseSizeBytes", | 177 UMA_HISTOGRAM_MEMORY_KB("Contacts.DatabaseSizeBytes", |
178 file_util::ComputeDirectorySize(database_dir)); | 178 base::ComputeDirectorySize(database_dir)); |
179 *success = false; | 179 *success = false; |
180 HistogramInitResult histogram_result = HISTOGRAM_INIT_RESULT_SUCCESS; | 180 HistogramInitResult histogram_result = HISTOGRAM_INIT_RESULT_SUCCESS; |
181 | 181 |
182 leveldb::Options options; | 182 leveldb::Options options; |
183 options.create_if_missing = true; | 183 options.create_if_missing = true; |
184 bool delete_and_retry_on_corruption = true; | 184 bool delete_and_retry_on_corruption = true; |
185 | 185 |
186 while (true) { | 186 while (true) { |
187 leveldb::DB* db = NULL; | 187 leveldb::DB* db = NULL; |
188 leveldb::Status status = | 188 leveldb::Status status = |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 db_iterator->Next(); | 333 db_iterator->Next(); |
334 } | 334 } |
335 | 335 |
336 *success = true; | 336 *success = true; |
337 UMA_HISTOGRAM_ENUMERATION("Contacts.DatabaseLoadResult", | 337 UMA_HISTOGRAM_ENUMERATION("Contacts.DatabaseLoadResult", |
338 HISTOGRAM_LOAD_RESULT_SUCCESS, | 338 HISTOGRAM_LOAD_RESULT_SUCCESS, |
339 HISTOGRAM_LOAD_RESULT_MAX_VALUE); | 339 HISTOGRAM_LOAD_RESULT_MAX_VALUE); |
340 } | 340 } |
341 | 341 |
342 } // namespace contacts | 342 } // namespace contacts |
OLD | NEW |