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

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

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

Powered by Google App Engine
This is Rietveld 408576698