OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 COMPONENTS_UKM_UKM_SERVICE_H_ | 5 #ifndef COMPONENTS_UKM_UKM_SERVICE_H_ |
6 #define COMPONENTS_UKM_UKM_SERVICE_H_ | 6 #define COMPONENTS_UKM_UKM_SERVICE_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <memory> | 9 #include <memory> |
10 #include <vector> | 10 #include <vector> |
(...skipping 29 matching lines...) Expand all Loading... |
40 namespace metrics { | 40 namespace metrics { |
41 class MetricsServiceClient; | 41 class MetricsServiceClient; |
42 } | 42 } |
43 | 43 |
44 namespace ukm { | 44 namespace ukm { |
45 | 45 |
46 class UkmEntry; | 46 class UkmEntry; |
47 class UkmEntryBuilder; | 47 class UkmEntryBuilder; |
48 class UkmSource; | 48 class UkmSource; |
49 | 49 |
| 50 namespace debug { |
| 51 class DebugPage; |
| 52 } |
| 53 |
50 // This feature controls whether UkmService should be created. | 54 // This feature controls whether UkmService should be created. |
51 extern const base::Feature kUkmFeature; | 55 extern const base::Feature kUkmFeature; |
52 | 56 |
53 // The URL-Keyed Metrics (UKM) service is responsible for gathering and | 57 // The URL-Keyed Metrics (UKM) service is responsible for gathering and |
54 // uploading reports that contain fine grained performance metrics including | 58 // uploading reports that contain fine grained performance metrics including |
55 // URLs for top-level navigations. | 59 // URLs for top-level navigations. |
56 class UkmService { | 60 class UkmService { |
57 public: | 61 public: |
58 // Constructs a UkmService. | 62 // Constructs a UkmService. |
59 // Calling code is responsible for ensuring that the lifetime of | 63 // Calling code is responsible for ensuring that the lifetime of |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 const std::map<int32_t, std::unique_ptr<UkmSource>>& sources_for_testing() | 114 const std::map<int32_t, std::unique_ptr<UkmSource>>& sources_for_testing() |
111 const { | 115 const { |
112 return sources_; | 116 return sources_; |
113 } | 117 } |
114 | 118 |
115 const std::vector<std::unique_ptr<UkmEntry>>& entries_for_testing() const { | 119 const std::vector<std::unique_ptr<UkmEntry>>& entries_for_testing() const { |
116 return entries_; | 120 return entries_; |
117 } | 121 } |
118 | 122 |
119 private: | 123 private: |
| 124 friend ::ukm::debug::DebugPage; |
120 friend autofill::AutofillMetrics; | 125 friend autofill::AutofillMetrics; |
121 friend payments::JourneyLogger; | 126 friend payments::JourneyLogger; |
122 friend PluginInfoMessageFilter; | 127 friend PluginInfoMessageFilter; |
123 friend UkmPageLoadMetricsObserver; | 128 friend UkmPageLoadMetricsObserver; |
124 friend translate::TranslateRankerImpl; | 129 friend translate::TranslateRankerImpl; |
125 FRIEND_TEST_ALL_PREFIXES(UkmServiceTest, AddEntryWithEmptyMetrics); | 130 FRIEND_TEST_ALL_PREFIXES(UkmServiceTest, AddEntryWithEmptyMetrics); |
126 FRIEND_TEST_ALL_PREFIXES(UkmServiceTest, EntryBuilderAndSerialization); | 131 FRIEND_TEST_ALL_PREFIXES(UkmServiceTest, EntryBuilderAndSerialization); |
127 FRIEND_TEST_ALL_PREFIXES(UkmServiceTest, | 132 FRIEND_TEST_ALL_PREFIXES(UkmServiceTest, |
128 LogsUploadedOnlyWhenHavingSourcesOrEntries); | 133 LogsUploadedOnlyWhenHavingSourcesOrEntries); |
129 FRIEND_TEST_ALL_PREFIXES(UkmServiceTest, MetricsProviderTest); | 134 FRIEND_TEST_ALL_PREFIXES(UkmServiceTest, MetricsProviderTest); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 // Weak pointers factory used to post task on different threads. All weak | 211 // Weak pointers factory used to post task on different threads. All weak |
207 // pointers managed by this factory have the same lifetime as UkmService. | 212 // pointers managed by this factory have the same lifetime as UkmService. |
208 base::WeakPtrFactory<UkmService> self_ptr_factory_; | 213 base::WeakPtrFactory<UkmService> self_ptr_factory_; |
209 | 214 |
210 DISALLOW_COPY_AND_ASSIGN(UkmService); | 215 DISALLOW_COPY_AND_ASSIGN(UkmService); |
211 }; | 216 }; |
212 | 217 |
213 } // namespace ukm | 218 } // namespace ukm |
214 | 219 |
215 #endif // COMPONENTS_UKM_UKM_SERVICE_H_ | 220 #endif // COMPONENTS_UKM_UKM_SERVICE_H_ |
OLD | NEW |