OLD | NEW |
---|---|
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 #include "base/metrics/user_metrics.h" | 5 #include "base/metrics/user_metrics.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 16 matching lines...) Expand all Loading... | |
27 void RecordAction(const UserMetricsAction& action) { | 27 void RecordAction(const UserMetricsAction& action) { |
28 RecordComputedAction(action.str_); | 28 RecordComputedAction(action.str_); |
29 } | 29 } |
30 | 30 |
31 void RecordComputedAction(const std::string& action) { | 31 void RecordComputedAction(const std::string& action) { |
32 if (!g_task_runner.Get()) { | 32 if (!g_task_runner.Get()) { |
33 DCHECK(g_callbacks.Get().empty()); | 33 DCHECK(g_callbacks.Get().empty()); |
34 return; | 34 return; |
35 } | 35 } |
36 | 36 |
37 LOG(INFO) << "RecordAction: " << action; | |
dgn
2017/05/05 13:24:53
will be removed before landing
| |
38 | |
37 if (!g_task_runner.Get()->BelongsToCurrentThread()) { | 39 if (!g_task_runner.Get()->BelongsToCurrentThread()) { |
38 g_task_runner.Get()->PostTask(FROM_HERE, | 40 g_task_runner.Get()->PostTask(FROM_HERE, |
39 BindOnce(&RecordComputedAction, action)); | 41 BindOnce(&RecordComputedAction, action)); |
40 return; | 42 return; |
41 } | 43 } |
42 | 44 |
43 for (const ActionCallback& callback : g_callbacks.Get()) { | 45 for (const ActionCallback& callback : g_callbacks.Get()) { |
44 callback.Run(action); | 46 callback.Run(action); |
45 } | 47 } |
46 } | 48 } |
(...skipping 18 matching lines...) Expand all Loading... | |
65 } | 67 } |
66 | 68 |
67 void SetRecordActionTaskRunner( | 69 void SetRecordActionTaskRunner( |
68 scoped_refptr<SingleThreadTaskRunner> task_runner) { | 70 scoped_refptr<SingleThreadTaskRunner> task_runner) { |
69 DCHECK(task_runner->BelongsToCurrentThread()); | 71 DCHECK(task_runner->BelongsToCurrentThread()); |
70 DCHECK(!g_task_runner.Get() || g_task_runner.Get()->BelongsToCurrentThread()); | 72 DCHECK(!g_task_runner.Get() || g_task_runner.Get()->BelongsToCurrentThread()); |
71 g_task_runner.Get() = task_runner; | 73 g_task_runner.Get() = task_runner; |
72 } | 74 } |
73 | 75 |
74 } // namespace base | 76 } // namespace base |
OLD | NEW |