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

Side by Side Diff: base/metrics/user_metrics.h

Issue 1859213002: Move the thread hop for UMA user actions from content:: to base::. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing bugs. Created 4 years, 8 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 BASE_METRICS_USER_METRICS_H_ 5 #ifndef BASE_METRICS_USER_METRICS_H_
6 #define BASE_METRICS_USER_METRICS_H_ 6 #define BASE_METRICS_USER_METRICS_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/base_export.h" 10 #include "base/base_export.h"
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/metrics/user_metrics_action.h" 12 #include "base/metrics/user_metrics_action.h"
13 #include "base/single_thread_task_runner.h"
13 14
14 namespace base { 15 namespace base {
15 16
16 // This module provides some helper functions for logging actions tracked by 17 // This module provides some helper functions for logging actions tracked by
17 // the user metrics system. 18 // the user metrics system.
18 19
19 // Record that the user performed an action. 20 // Record that the user performed an action.
20 // This method *must* be called from the main thread. 21 // This method *must* be called from the main thread.
Lei Zhang 2016/04/18 21:34:13 Does this need updating?
beaudoin 2016/04/19 16:57:27 Done.
21 // 22 //
22 // "Action" here means a user-generated event: 23 // "Action" here means a user-generated event:
23 // good: "Reload", "CloseTab", and "IMEInvoked" 24 // good: "Reload", "CloseTab", and "IMEInvoked"
24 // not good: "SSLDialogShown", "PageLoaded", "DiskFull" 25 // not good: "SSLDialogShown", "PageLoaded", "DiskFull"
25 // We use this to gather anonymized information about how users are 26 // We use this to gather anonymized information about how users are
26 // interacting with the browser. 27 // interacting with the browser.
27 // WARNING: In calls to this function, UserMetricsAction and a 28 // WARNING: In calls to this function, UserMetricsAction and a
28 // string literal parameter must be on the same line, e.g. 29 // string literal parameter must be on the same line, e.g.
29 // RecordAction(UserMetricsAction("my extremely long action name")); 30 // RecordAction(UserMetricsAction("my extremely long action name"));
30 // This ensures that our processing scripts can associate this action's hash 31 // This ensures that our processing scripts can associate this action's hash
(...skipping 17 matching lines...) Expand all
48 // tools/metrics/actions/extract_actions.py. 49 // tools/metrics/actions/extract_actions.py.
49 BASE_EXPORT void RecordComputedAction(const std::string& action); 50 BASE_EXPORT void RecordComputedAction(const std::string& action);
50 51
51 // Called with the action string. 52 // Called with the action string.
52 typedef base::Callback<void(const std::string&)> ActionCallback; 53 typedef base::Callback<void(const std::string&)> ActionCallback;
53 54
54 // Add/remove action callbacks (see above). 55 // Add/remove action callbacks (see above).
55 BASE_EXPORT void AddActionCallback(const ActionCallback& callback); 56 BASE_EXPORT void AddActionCallback(const ActionCallback& callback);
56 BASE_EXPORT void RemoveActionCallback(const ActionCallback& callback); 57 BASE_EXPORT void RemoveActionCallback(const ActionCallback& callback);
57 58
59 // Set the task runner on which to record actions. The task runner can only be
60 // set once, unless ResetRecordActionTaskRunnerForTesting is called.
sgurun-gerrit only 2016/04/19 15:36:06 is it optional to call this? if not called what is
beaudoin 2016/04/19 16:57:27 Must be called before any of the other functions h
61 BASE_EXPORT void SetRecordActionTaskRunner(
62 scoped_refptr<base::SingleThreadTaskRunner> task_runner);
63
58 } // namespace base 64 } // namespace base
59 65
60 #endif // BASE_METRICS_USER_METRICS_H_ 66 #endif // BASE_METRICS_USER_METRICS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698