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

Side by Side Diff: chrome/browser/diagnostics/sqlite_diagnostics.cc

Issue 462027: Use factory to create histograms, and refcounts to track lifetimes... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years 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 | « chrome/browser/chrome_browser_application_mac.mm ('k') | chrome/browser/jankometer.cc » ('j') | 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/diagnostics/sqlite_diagnostics.h" 5 #include "chrome/browser/diagnostics/sqlite_diagnostics.h"
6 6
7 #include "app/sql/connection.h" 7 #include "app/sql/connection.h"
8 #include "base/histogram.h" 8 #include "base/histogram.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/singleton.h" 10 #include "base/singleton.h"
(...skipping 25 matching lines...) Expand all
36 sql::Statement* stmt) { 36 sql::Statement* stmt) {
37 NOTREACHED() << "sqlite error " << error; 37 NOTREACHED() << "sqlite error " << error;
38 RecordErrorInHistogram(error); 38 RecordErrorInHistogram(error);
39 return error; 39 return error;
40 } 40 }
41 41
42 private: 42 private:
43 static void RecordErrorInHistogram(int error) { 43 static void RecordErrorInHistogram(int error) {
44 // The histogram values from sqlite result codes go currently from 1 to 44 // The histogram values from sqlite result codes go currently from 1 to
45 // 26 currently but 50 gives them room to grow. 45 // 26 currently but 50 gives them room to grow.
46 static LinearHistogram histogram(kHistogramNames[unique], 1, 50, 51); 46 static scoped_refptr<Histogram> histogram =
47 histogram.SetFlags(kUmaTargetedHistogramFlag); 47 LinearHistogram::LinearHistogramFactoryGet(kHistogramNames[unique], 1,
48 histogram.Add(error); 48 50, 51);
49 histogram->SetFlags(kUmaTargetedHistogramFlag);
50 histogram->Add(error);
49 } 51 }
50 }; 52 };
51 53
52 } // namespace 54 } // namespace
53 55
54 sql::ErrorDelegate* GetErrorHandlerForCookieDb() { 56 sql::ErrorDelegate* GetErrorHandlerForCookieDb() {
55 return new BasicSqliteErrrorHandler<0>(); 57 return new BasicSqliteErrrorHandler<0>();
56 } 58 }
57 59
58 sql::ErrorDelegate* GetErrorHandlerForHistoryDb() { 60 sql::ErrorDelegate* GetErrorHandlerForHistoryDb() {
59 return new BasicSqliteErrrorHandler<1>(); 61 return new BasicSqliteErrrorHandler<1>();
60 } 62 }
61 63
62 sql::ErrorDelegate* GetErrorHandlerForThumbnailDb() { 64 sql::ErrorDelegate* GetErrorHandlerForThumbnailDb() {
63 return new BasicSqliteErrrorHandler<2>(); 65 return new BasicSqliteErrrorHandler<2>();
64 } 66 }
65 67
66 sql::ErrorDelegate* GetErrorHandlerForTextDb() { 68 sql::ErrorDelegate* GetErrorHandlerForTextDb() {
67 return new BasicSqliteErrrorHandler<3>(); 69 return new BasicSqliteErrrorHandler<3>();
68 } 70 }
69 71
70 sql::ErrorDelegate* GetErrorHandlerForWebDb() { 72 sql::ErrorDelegate* GetErrorHandlerForWebDb() {
71 return new BasicSqliteErrrorHandler<4>(); 73 return new BasicSqliteErrrorHandler<4>();
72 } 74 }
OLDNEW
« no previous file with comments | « chrome/browser/chrome_browser_application_mac.mm ('k') | chrome/browser/jankometer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698