| 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 <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/threading/thread_checker.h" | 10 #include "base/threading/thread_checker.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 std::vector<ActionCallback> callbacks_; | 48 std::vector<ActionCallback> callbacks_; |
| 49 | 49 |
| 50 DISALLOW_COPY_AND_ASSIGN(Callbacks); | 50 DISALLOW_COPY_AND_ASSIGN(Callbacks); |
| 51 }; | 51 }; |
| 52 | 52 |
| 53 base::LazyInstance<Callbacks> g_callbacks = LAZY_INSTANCE_INITIALIZER; | 53 base::LazyInstance<Callbacks> g_callbacks = LAZY_INSTANCE_INITIALIZER; |
| 54 | 54 |
| 55 } // namespace | 55 } // namespace |
| 56 | 56 |
| 57 void RecordAction(const UserMetricsAction& action) { | 57 void RecordAction(const UserMetricsAction& action) { |
| 58 LOG(INFO) << "metrix base::RecordAction action=" << action.str_; |
| 59 |
| 58 g_callbacks.Get().Record(action.str_); | 60 g_callbacks.Get().Record(action.str_); |
| 59 } | 61 } |
| 60 | 62 |
| 61 void RecordComputedAction(const std::string& action) { | 63 void RecordComputedAction(const std::string& action) { |
| 62 g_callbacks.Get().Record(action); | 64 g_callbacks.Get().Record(action); |
| 63 } | 65 } |
| 64 | 66 |
| 65 void AddActionCallback(const ActionCallback& callback) { | 67 void AddActionCallback(const ActionCallback& callback) { |
| 66 g_callbacks.Get().AddCallback(callback); | 68 g_callbacks.Get().AddCallback(callback); |
| 67 } | 69 } |
| 68 | 70 |
| 69 void RemoveActionCallback(const ActionCallback& callback) { | 71 void RemoveActionCallback(const ActionCallback& callback) { |
| 70 g_callbacks.Get().RemoveCallback(callback); | 72 g_callbacks.Get().RemoveCallback(callback); |
| 71 | 73 |
| 72 } | 74 } |
| 73 | 75 |
| 74 } // namespace base | 76 } // namespace base |
| OLD | NEW |