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

Side by Side Diff: chrome/browser/sync/util/data_type_histogram.h

Issue 9699057: [Sync] Move 'sync' target to sync/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address Tim's comments Created 8 years, 9 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_SYNC_UTIL_DATA_TYPE_HISTOGRAM_H_
6 #define CHROME_BROWSER_SYNC_UTIL_DATA_TYPE_HISTOGRAM_H_
7 #pragma once
8
9 #include "base/metrics/histogram.h"
10 #include "base/time.h"
11 #include "chrome/browser/sync/syncable/model_type.h"
12
13 // For now, this just implements UMA_HISTOGRAM_LONG_TIMES. This can be adjusted
14 // if we feel the min, max, or bucket count amount are not appropriate.
15 #define SYNC_FREQ_HISTOGRAM(name, time) UMA_HISTOGRAM_CUSTOM_TIMES( \
16 name, time, base::TimeDelta::FromMilliseconds(1), \
17 base::TimeDelta::FromHours(1), 50)
18
19 // Helper macro for datatype specific histograms. For each datatype, invokes
20 // a pre-defined PER_DATA_TYPE_MACRO(type_str), where |type_str| is the string
21 // version of the datatype.
22 //
23 // Example usage (ignoring newlines necessary for multiline macro):
24 // std::vector<syncable::ModelType> types = GetEntryTypes();
25 // for (int i = 0; i < types.size(); ++i) {
26 // #define PER_DATA_TYPE_MACRO(type_str)
27 // UMA_HISTOGRAM_ENUMERATION("Sync." type_str "StartFailures",
28 // error, max_error);
29 // SYNC_DATA_TYPE_HISTOGRAM(types[i]);
30 // #undef PER_DATA_TYPE_MACRO
31 // }
32 //
33 // TODO(zea): Once visual studio supports proper variadic argument replacement
34 // in macros, pass in the histogram method directly as a parameter.
35 // See http://connect.microsoft.com/VisualStudio/feedback/details/380090/
36 // variadic-macro-replacement#details
37 #define SYNC_DATA_TYPE_HISTOGRAM(datatype) \
38 do { \
39 switch (datatype) { \
40 case syncable::BOOKMARKS: \
41 PER_DATA_TYPE_MACRO("Bookmarks"); \
42 break; \
43 case syncable::PREFERENCES: \
44 PER_DATA_TYPE_MACRO("Preferences"); \
45 break; \
46 case syncable::PASSWORDS: \
47 PER_DATA_TYPE_MACRO("Passwords"); \
48 break; \
49 case syncable::AUTOFILL: \
50 PER_DATA_TYPE_MACRO("Autofill"); \
51 break; \
52 case syncable::AUTOFILL_PROFILE: \
53 PER_DATA_TYPE_MACRO("AutofillProfiles"); \
54 break; \
55 case syncable::THEMES: \
56 PER_DATA_TYPE_MACRO("Themes"); \
57 break; \
58 case syncable::TYPED_URLS: \
59 PER_DATA_TYPE_MACRO("TypedUrls"); \
60 break; \
61 case syncable::EXTENSIONS: \
62 PER_DATA_TYPE_MACRO("Extensions"); \
63 break; \
64 case syncable::NIGORI: \
65 PER_DATA_TYPE_MACRO("Nigori"); \
66 break; \
67 case syncable::SEARCH_ENGINES: \
68 PER_DATA_TYPE_MACRO("SearchEngines"); \
69 break; \
70 case syncable::SESSIONS: \
71 PER_DATA_TYPE_MACRO("Sessions"); \
72 break; \
73 case syncable::APPS: \
74 PER_DATA_TYPE_MACRO("Apps"); \
75 break; \
76 case syncable::APP_SETTINGS: \
77 PER_DATA_TYPE_MACRO("AppSettings"); \
78 break; \
79 case syncable::EXTENSION_SETTINGS: \
80 PER_DATA_TYPE_MACRO("ExtensionSettings"); \
81 break; \
82 case syncable::APP_NOTIFICATIONS: \
83 PER_DATA_TYPE_MACRO("AppNotifications"); \
84 break; \
85 default: \
86 NOTREACHED() << "Unknown datatype " \
87 << syncable::ModelTypeToString(datatype); \
88 } \
89 } while (0)
90
91 #endif // CHROME_BROWSER_SYNC_UTIL_DATA_TYPE_HISTOGRAM_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/util/data_encryption_unittest.cc ('k') | chrome/browser/sync/util/data_type_histogram_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698