Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(847)

Side by Side Diff: sync/syncable/on_disk_directory_backing_store.cc

Issue 10828261: Fix Sync.DirectoryOpenResult histogram (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "sync/syncable/on_disk_directory_backing_store.h" 5 #include "sync/syncable/on_disk_directory_backing_store.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "sync/syncable/syncable-inl.h" 9 #include "sync/syncable/syncable-inl.h"
10 10
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 56
57 return OPENED; 57 return OPENED;
58 58
59 } 59 }
60 60
61 DirOpenResult OnDiskDirectoryBackingStore::Load( 61 DirOpenResult OnDiskDirectoryBackingStore::Load(
62 MetahandlesIndex* entry_bucket, 62 MetahandlesIndex* entry_bucket,
63 Directory::KernelLoadInfo* kernel_load_info) { 63 Directory::KernelLoadInfo* kernel_load_info) {
64 DirOpenResult result = TryLoad(entry_bucket, kernel_load_info); 64 DirOpenResult result = TryLoad(entry_bucket, kernel_load_info);
65 if (result == OPENED) { 65 if (result == OPENED) {
66 HISTOGRAM_ENUMERATION( 66 UMA_HISTOGRAM_ENUMERATION(
67 "Sync.DirectoryOpenResult", FIRST_TRY_SUCCESS, RESULT_COUNT); 67 "Sync.DirectoryOpenResult", FIRST_TRY_SUCCESS, RESULT_COUNT);
68 return OPENED; 68 return OPENED;
69 } 69 }
70 70
71 ReportFirstTryOpenFailure(); 71 ReportFirstTryOpenFailure();
72 72
73 // The fallback: delete the current database and return a fresh one. We can 73 // The fallback: delete the current database and return a fresh one. We can
74 // fetch the user's data from the could. 74 // fetch the user's data from the could.
75 entry_bucket->clear(); 75 entry_bucket->clear();
76 db_.reset(new sql::Connection); 76 db_.reset(new sql::Connection);
77 file_util::Delete(backing_filepath_, false); 77 file_util::Delete(backing_filepath_, false);
78 78
79 result = TryLoad(entry_bucket, kernel_load_info); 79 result = TryLoad(entry_bucket, kernel_load_info);
80 if (result == OPENED) { 80 if (result == OPENED) {
81 HISTOGRAM_ENUMERATION( 81 UMA_HISTOGRAM_ENUMERATION(
82 "Sync.DirectoryOpenResult", SECOND_TRY_SUCCESS, RESULT_COUNT); 82 "Sync.DirectoryOpenResult", SECOND_TRY_SUCCESS, RESULT_COUNT);
83 } else { 83 } else {
84 HISTOGRAM_ENUMERATION( 84 UMA_HISTOGRAM_ENUMERATION(
85 "Sync.DirectoryOpenResult", SECOND_TRY_FAILURE, RESULT_COUNT); 85 "Sync.DirectoryOpenResult", SECOND_TRY_FAILURE, RESULT_COUNT);
86 } 86 }
87 87
88 return result; 88 return result;
89 } 89 }
90 90
91 void OnDiskDirectoryBackingStore::ReportFirstTryOpenFailure() { 91 void OnDiskDirectoryBackingStore::ReportFirstTryOpenFailure() {
92 // In debug builds, the last thing we want is to silently clear the database. 92 // In debug builds, the last thing we want is to silently clear the database.
93 // It's full of evidence that might help us determine what went wrong. It 93 // It's full of evidence that might help us determine what went wrong. It
94 // might be sqlite's fault, but it could also be a bug in sync. We crash 94 // might be sqlite's fault, but it could also be a bug in sync. We crash
95 // immediately so a developer can investigate. 95 // immediately so a developer can investigate.
96 // 96 //
97 // Developers: If you're not interested in debugging this right now, just move 97 // Developers: If you're not interested in debugging this right now, just move
98 // aside the 'Sync Data' directory in your profile. This is similar to what 98 // aside the 'Sync Data' directory in your profile. This is similar to what
99 // the code would do if this DCHECK were disabled. 99 // the code would do if this DCHECK were disabled.
100 NOTREACHED() << "Crashing to preserve corrupt sync database"; 100 NOTREACHED() << "Crashing to preserve corrupt sync database";
101 } 101 }
102 102
103 } // namespace syncable 103 } // namespace syncable
104 } // namespace syncer 104 } // namespace syncer
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698