| 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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 *success = true; | 193 *success = true; |
| 194 return; | 194 return; |
| 195 } | 195 } |
| 196 | 196 |
| 197 LOG(WARNING) << "Unable to open " << database_dir.value() << ": " | 197 LOG(WARNING) << "Unable to open " << database_dir.value() << ": " |
| 198 << status.ToString(); | 198 << status.ToString(); |
| 199 | 199 |
| 200 // Delete the existing database and try again (just once, though). | 200 // Delete the existing database and try again (just once, though). |
| 201 if (status.IsCorruption() && delete_and_retry_on_corruption) { | 201 if (status.IsCorruption() && delete_and_retry_on_corruption) { |
| 202 LOG(WARNING) << "Deleting possibly-corrupt database"; | 202 LOG(WARNING) << "Deleting possibly-corrupt database"; |
| 203 base::Delete(database_dir, true); | 203 base::DeleteFile(database_dir, true); |
| 204 delete_and_retry_on_corruption = false; | 204 delete_and_retry_on_corruption = false; |
| 205 histogram_result = HISTOGRAM_INIT_RESULT_DELETED_CORRUPTED; | 205 histogram_result = HISTOGRAM_INIT_RESULT_DELETED_CORRUPTED; |
| 206 } else { | 206 } else { |
| 207 histogram_result = HISTOGRAM_INIT_RESULT_FAILURE; | 207 histogram_result = HISTOGRAM_INIT_RESULT_FAILURE; |
| 208 break; | 208 break; |
| 209 } | 209 } |
| 210 } | 210 } |
| 211 | 211 |
| 212 UMA_HISTOGRAM_ENUMERATION("Contacts.DatabaseInitResult", | 212 UMA_HISTOGRAM_ENUMERATION("Contacts.DatabaseInitResult", |
| 213 histogram_result, | 213 histogram_result, |
| (...skipping 119 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 |