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

Side by Side Diff: components/ukm/public/ukm_recorder.h

Issue 2938443002: [GRC] UKM Support (Closed)
Patch Set: Refactor Created 3 years, 6 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 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_PUBLIC_UKM_RECORDER_H_ 5 #ifndef COMPONENTS_UKM_PUBLIC_UKM_RECORDER_H_
6 #define COMPONENTS_UKM_PUBLIC_UKM_RECORDER_H_ 6 #define COMPONENTS_UKM_PUBLIC_UKM_RECORDER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <memory>
11
10 #include "base/callback.h" 12 #include "base/callback.h"
11 #include "base/feature_list.h" 13 #include "base/feature_list.h"
12 #include "base/macros.h" 14 #include "base/macros.h"
13 #include "base/threading/thread_checker.h" 15 #include "base/threading/thread_checker.h"
14 #include "components/ukm/public/interfaces/ukm_interface.mojom.h" 16 #include "components/ukm/public/interfaces/ukm_interface.mojom.h"
15 #include "components/ukm/public/ukm_entry_builder.h" 17 #include "components/ukm/public/ukm_entry_builder.h"
16 #include "components/ukm/public/ukm_export.h" 18 #include "components/ukm/public/ukm_export.h"
17 #include "url/gurl.h" 19 #include "url/gurl.h"
18 20
19 class ContextualSearchRankerLoggerImpl; 21 class ContextualSearchRankerLoggerImpl;
20 class PluginInfoMessageFilter; 22 class PluginInfoMessageFilter;
21 class UkmPageLoadMetricsObserver; 23 class UkmPageLoadMetricsObserver;
22 24
23 namespace autofill { 25 namespace autofill {
24 class AutofillMetrics; 26 class AutofillMetrics;
25 } 27 }
26 28
27 namespace content { 29 namespace content {
28 class MediaInternals; 30 class MediaInternals;
29 class RenderFrameImpl; 31 class RenderFrameImpl;
30 class RenderWidgetHostLatencyTracker; 32 class RenderWidgetHostLatencyTracker;
31 } 33 }
32 34
35 namespace resource_coordinator {
36 class CoordinationUnitManager;
37 }
38
33 namespace translate { 39 namespace translate {
34 class TranslateRankerImpl; 40 class TranslateRankerImpl;
35 } 41 }
36 42
37 namespace payments { 43 namespace payments {
38 class JourneyLogger; 44 class JourneyLogger;
39 } 45 }
40 46
41 namespace ukm { 47 namespace ukm {
42 48
(...skipping 30 matching lines...) Expand all
73 friend payments::JourneyLogger; 79 friend payments::JourneyLogger;
74 friend ContextualSearchRankerLoggerImpl; 80 friend ContextualSearchRankerLoggerImpl;
75 friend PluginInfoMessageFilter; 81 friend PluginInfoMessageFilter;
76 friend UkmPageLoadMetricsObserver; 82 friend UkmPageLoadMetricsObserver;
77 friend translate::TranslateRankerImpl; 83 friend translate::TranslateRankerImpl;
78 friend TestRecordingHelper; 84 friend TestRecordingHelper;
79 friend UkmInterface; 85 friend UkmInterface;
80 friend content::MediaInternals; 86 friend content::MediaInternals;
81 friend content::RenderFrameImpl; 87 friend content::RenderFrameImpl;
82 friend content::RenderWidgetHostLatencyTracker; 88 friend content::RenderWidgetHostLatencyTracker;
89 friend resource_coordinator::CoordinationUnitManager;
83 FRIEND_TEST_ALL_PREFIXES(UkmServiceTest, AddEntryWithEmptyMetrics); 90 FRIEND_TEST_ALL_PREFIXES(UkmServiceTest, AddEntryWithEmptyMetrics);
84 FRIEND_TEST_ALL_PREFIXES(UkmServiceTest, EntryBuilderAndSerialization); 91 FRIEND_TEST_ALL_PREFIXES(UkmServiceTest, EntryBuilderAndSerialization);
85 FRIEND_TEST_ALL_PREFIXES(UkmServiceTest, 92 FRIEND_TEST_ALL_PREFIXES(UkmServiceTest,
86 LogsUploadedOnlyWhenHavingSourcesOrEntries); 93 LogsUploadedOnlyWhenHavingSourcesOrEntries);
87 FRIEND_TEST_ALL_PREFIXES(UkmServiceTest, MetricsProviderTest); 94 FRIEND_TEST_ALL_PREFIXES(UkmServiceTest, MetricsProviderTest);
88 FRIEND_TEST_ALL_PREFIXES(UkmServiceTest, PersistAndPurge); 95 FRIEND_TEST_ALL_PREFIXES(UkmServiceTest, PersistAndPurge);
89 FRIEND_TEST_ALL_PREFIXES(UkmServiceTest, WhitelistEntryTest); 96 FRIEND_TEST_ALL_PREFIXES(UkmServiceTest, WhitelistEntryTest);
90 97
91 // Get a new UkmEntryBuilder object for the specified source ID and event, 98 // Get a new UkmEntryBuilder object for the specified source ID and event,
92 // which can get metrics added to. 99 // which can get metrics added to.
93 // 100 //
94 // This API being private is intentional. Any client using UKM needs to 101 // This API being private is intentional. Any client using UKM needs to
95 // declare itself to be a friend of UkmService and go through code review 102 // declare itself to be a friend of UkmService and go through code review
96 // process. 103 // process.
97 std::unique_ptr<UkmEntryBuilder> GetEntryBuilder(SourceId source_id, 104 std::unique_ptr<UkmEntryBuilder> GetEntryBuilder(SourceId source_id,
98 const char* event_name); 105 const char* event_name);
99 106
100 private: 107 private:
101 // Add an entry to the UkmEntry list. 108 // Add an entry to the UkmEntry list.
102 virtual void AddEntry(mojom::UkmEntryPtr entry) = 0; 109 virtual void AddEntry(mojom::UkmEntryPtr entry) = 0;
103 110
104 DISALLOW_COPY_AND_ASSIGN(UkmRecorder); 111 DISALLOW_COPY_AND_ASSIGN(UkmRecorder);
105 }; 112 };
106 113
107 } // namespace ukm 114 } // namespace ukm
108 115
109 #endif // COMPONENTS_UKM_PUBLIC_UKM_RECORDER_H_ 116 #endif // COMPONENTS_UKM_PUBLIC_UKM_RECORDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698