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

Side by Side Diff: chrome/browser/prefs/chrome_pref_service_factory.cc

Issue 23653025: Change PrefService.ReadError histogram to sample success case. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 "chrome/browser/prefs/chrome_pref_service_factory.h" 5 #include "chrome/browser/prefs/chrome_pref_service_factory.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 21 matching lines...) Expand all
32 #include "chrome/browser/policy/policy_types.h" 32 #include "chrome/browser/policy/policy_types.h"
33 #endif 33 #endif
34 34
35 using content::BrowserContext; 35 using content::BrowserContext;
36 using content::BrowserThread; 36 using content::BrowserThread;
37 37
38 namespace { 38 namespace {
39 39
40 // Shows notifications which correspond to PersistentPrefStore's reading errors. 40 // Shows notifications which correspond to PersistentPrefStore's reading errors.
41 void HandleReadError(PersistentPrefStore::PrefReadError error) { 41 void HandleReadError(PersistentPrefStore::PrefReadError error) {
42 // Sample the histogram also for the successful case in order to get a
43 // baseline on the success rate in addition to the error distribution.
44 UMA_HISTOGRAM_ENUMERATION("PrefService.ReadError", error,
45 PersistentPrefStore::PREF_READ_ERROR_MAX_ENUM);
46
42 if (error != PersistentPrefStore::PREF_READ_ERROR_NONE) { 47 if (error != PersistentPrefStore::PREF_READ_ERROR_NONE) {
43 #if !defined(OS_CHROMEOS) 48 #if !defined(OS_CHROMEOS)
44 // Failing to load prefs on startup is a bad thing(TM). See bug 38352 for 49 // Failing to load prefs on startup is a bad thing(TM). See bug 38352 for
45 // an example problem that this can cause. 50 // an example problem that this can cause.
46 // Do some diagnosis and try to avoid losing data. 51 // Do some diagnosis and try to avoid losing data.
47 int message_id = 0; 52 int message_id = 0;
48 if (error <= PersistentPrefStore::PREF_READ_ERROR_JSON_TYPE) { 53 if (error <= PersistentPrefStore::PREF_READ_ERROR_JSON_TYPE) {
49 message_id = IDS_PREFERENCES_CORRUPT_ERROR; 54 message_id = IDS_PREFERENCES_CORRUPT_ERROR;
50 } else if (error != PersistentPrefStore::PREF_READ_ERROR_NO_FILE) { 55 } else if (error != PersistentPrefStore::PREF_READ_ERROR_NO_FILE) {
51 message_id = IDS_PREFERENCES_UNREADABLE_ERROR; 56 message_id = IDS_PREFERENCES_UNREADABLE_ERROR;
52 } 57 }
53 58
54 if (message_id) { 59 if (message_id) {
55 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, 60 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
56 base::Bind(&ShowProfileErrorDialog, message_id)); 61 base::Bind(&ShowProfileErrorDialog, message_id));
57 } 62 }
58 #else 63 #else
59 // On ChromeOS error screen with message about broken local state 64 // On ChromeOS error screen with message about broken local state
60 // will be displayed. 65 // will be displayed.
61 #endif 66 #endif
62 UMA_HISTOGRAM_ENUMERATION("PrefService.ReadError", error,
63 PersistentPrefStore::PREF_READ_ERROR_MAX_ENUM);
64 } 67 }
65 } 68 }
66 69
67 void PrepareBuilder( 70 void PrepareBuilder(
68 PrefServiceSyncableBuilder* builder, 71 PrefServiceSyncableBuilder* builder,
69 const base::FilePath& pref_filename, 72 const base::FilePath& pref_filename,
70 base::SequencedTaskRunner* pref_io_task_runner, 73 base::SequencedTaskRunner* pref_io_task_runner,
71 policy::PolicyService* policy_service, 74 policy::PolicyService* policy_service,
72 const scoped_refptr<PrefStore>& extension_prefs, 75 const scoped_refptr<PrefStore>& extension_prefs,
73 bool async) { 76 bool async) {
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 PrepareBuilder(&builder, 140 PrepareBuilder(&builder,
138 pref_filename, 141 pref_filename,
139 pref_io_task_runner, 142 pref_io_task_runner,
140 policy_service, 143 policy_service,
141 extension_prefs, 144 extension_prefs,
142 async); 145 async);
143 return builder.CreateSyncable(pref_registry.get()); 146 return builder.CreateSyncable(pref_registry.get());
144 } 147 }
145 148
146 } // namespace chrome_prefs 149 } // namespace chrome_prefs
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