Chromium Code Reviews| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 42 // uploading reports that contain fine grained performance metrics including | 42 // uploading reports that contain fine grained performance metrics including |
| 43 // URLs for top-level navigations. | 43 // URLs for top-level navigations. |
| 44 class UkmService : public base::SupportsWeakPtr<UkmService> { | 44 class UkmService : public base::SupportsWeakPtr<UkmService> { |
| 45 public: | 45 public: |
| 46 // Constructs a UkmService. | 46 // Constructs a UkmService. |
| 47 // Calling code is responsible for ensuring that the lifetime of | 47 // Calling code is responsible for ensuring that the lifetime of |
| 48 // |pref_service| is longer than the lifetime of UkmService. | 48 // |pref_service| is longer than the lifetime of UkmService. |
| 49 UkmService(PrefService* pref_service, metrics::MetricsServiceClient* client); | 49 UkmService(PrefService* pref_service, metrics::MetricsServiceClient* client); |
| 50 virtual ~UkmService(); | 50 virtual ~UkmService(); |
| 51 | 51 |
| 52 // Get the new source ID. | |
|
Bryan McQuade
2017/03/01 22:46:35
let's expand this comment to say something like 'E
Zhen Wang
2017/03/01 22:51:42
Done.
| |
| 53 static int32_t GetNewSourceID(); | |
|
Zhen Wang
2017/03/01 22:44:24
We probably do not need static here. The benefit o
Bryan McQuade
2017/03/01 22:46:35
I think static is totally fine - I'd use static he
| |
| 54 | |
| 52 // Update the URL on the source keyed to the given source ID. If the source | 55 // Update the URL on the source keyed to the given source ID. If the source |
| 53 // does not exist, it will create a new UkmSource object. | 56 // does not exist, it will create a new UkmSource object. |
| 54 void UpdateSourceURL(int32_t source_id, const GURL& url); | 57 void UpdateSourceURL(int32_t source_id, const GURL& url); |
| 55 | 58 |
| 56 // Initializes the UKM service. | 59 // Initializes the UKM service. |
| 57 void Initialize(); | 60 void Initialize(); |
| 58 | 61 |
| 59 // Enables/disables recording control if data is allowed to be collected. | 62 // Enables/disables recording control if data is allowed to be collected. |
| 60 void EnableRecording(); | 63 void EnableRecording(); |
| 61 void DisableRecording(); | 64 void DisableRecording(); |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 176 // Weak pointers factory used to post task on different threads. All weak | 179 // Weak pointers factory used to post task on different threads. All weak |
| 177 // pointers managed by this factory have the same lifetime as UkmService. | 180 // pointers managed by this factory have the same lifetime as UkmService. |
| 178 base::WeakPtrFactory<UkmService> self_ptr_factory_; | 181 base::WeakPtrFactory<UkmService> self_ptr_factory_; |
| 179 | 182 |
| 180 DISALLOW_COPY_AND_ASSIGN(UkmService); | 183 DISALLOW_COPY_AND_ASSIGN(UkmService); |
| 181 }; | 184 }; |
| 182 | 185 |
| 183 } // namespace ukm | 186 } // namespace ukm |
| 184 | 187 |
| 185 #endif // COMPONENTS_UKM_UKM_SERVICE_H_ | 188 #endif // COMPONENTS_UKM_UKM_SERVICE_H_ |
| OLD | NEW |