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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 // the provided PrefRegistry. | 87 // the provided PrefRegistry. |
88 static void RegisterPrefs(PrefRegistrySimple* registry); | 88 static void RegisterPrefs(PrefRegistrySimple* registry); |
89 | 89 |
90 using AddEntryCallback = base::Callback<void(std::unique_ptr<UkmEntry>)>; | 90 using AddEntryCallback = base::Callback<void(std::unique_ptr<UkmEntry>)>; |
91 | 91 |
92 protected: | 92 protected: |
93 const std::vector<std::unique_ptr<UkmSource>>& sources_for_testing() const { | 93 const std::vector<std::unique_ptr<UkmSource>>& sources_for_testing() const { |
94 return sources_; | 94 return sources_; |
95 } | 95 } |
96 | 96 |
| 97 const std::vector<std::unique_ptr<UkmEntry>>& entries_for_testing() const { |
| 98 return entries_; |
| 99 } |
| 100 |
97 private: | 101 private: |
98 friend UkmPageLoadMetricsObserver; | 102 friend UkmPageLoadMetricsObserver; |
99 FRIEND_TEST_ALL_PREFIXES(UkmServiceTest, AddEntryOnlyWithNonEmptyMetrics); | 103 FRIEND_TEST_ALL_PREFIXES(UkmServiceTest, AddEntryOnlyWithNonEmptyMetrics); |
100 FRIEND_TEST_ALL_PREFIXES(UkmServiceTest, EntryBuilderAndSerialization); | 104 FRIEND_TEST_ALL_PREFIXES(UkmServiceTest, EntryBuilderAndSerialization); |
101 FRIEND_TEST_ALL_PREFIXES(UkmServiceTest, | 105 FRIEND_TEST_ALL_PREFIXES(UkmServiceTest, |
102 LogsUploadedOnlyWhenHavingSourcesOrEntries); | 106 LogsUploadedOnlyWhenHavingSourcesOrEntries); |
103 FRIEND_TEST_ALL_PREFIXES(UkmServiceTest, MetricsProviderTest); | 107 FRIEND_TEST_ALL_PREFIXES(UkmServiceTest, MetricsProviderTest); |
104 FRIEND_TEST_ALL_PREFIXES(UkmServiceTest, PersistAndPurge); | 108 FRIEND_TEST_ALL_PREFIXES(UkmServiceTest, PersistAndPurge); |
105 | 109 |
106 // Get a new UkmEntryBuilder object for the specified source ID and event, | 110 // Get a new UkmEntryBuilder object for the specified source ID and event, |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 // Weak pointers factory used to post task on different threads. All weak | 184 // Weak pointers factory used to post task on different threads. All weak |
181 // pointers managed by this factory have the same lifetime as UkmService. | 185 // pointers managed by this factory have the same lifetime as UkmService. |
182 base::WeakPtrFactory<UkmService> self_ptr_factory_; | 186 base::WeakPtrFactory<UkmService> self_ptr_factory_; |
183 | 187 |
184 DISALLOW_COPY_AND_ASSIGN(UkmService); | 188 DISALLOW_COPY_AND_ASSIGN(UkmService); |
185 }; | 189 }; |
186 | 190 |
187 } // namespace ukm | 191 } // namespace ukm |
188 | 192 |
189 #endif // COMPONENTS_UKM_UKM_SERVICE_H_ | 193 #endif // COMPONENTS_UKM_UKM_SERVICE_H_ |
OLD | NEW |