| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // This file defines a service that collects information about the user | 5 // This file defines a service that collects information about the user |
| 6 // experience in order to help improve future versions of the app. | 6 // experience in order to help improve future versions of the app. |
| 7 | 7 |
| 8 #ifndef CHROME_FRAME_METRICS_SERVICE_H_ | 8 #ifndef CHROME_FRAME_METRICS_SERVICE_H_ |
| 9 #define CHROME_FRAME_METRICS_SERVICE_H_ | 9 #define CHROME_FRAME_METRICS_SERVICE_H_ |
| 10 | 10 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 // Start/stop the metrics recording and uploading machine. These should be | 29 // Start/stop the metrics recording and uploading machine. These should be |
| 30 // used on startup and when the user clicks the checkbox in the prefs. | 30 // used on startup and when the user clicks the checkbox in the prefs. |
| 31 // StartRecordingOnly starts the metrics recording but not reporting, for use | 31 // StartRecordingOnly starts the metrics recording but not reporting, for use |
| 32 // in tests only. | 32 // in tests only. |
| 33 static void Start(); | 33 static void Start(); |
| 34 static void Stop(); | 34 static void Stop(); |
| 35 // Set up client ID, session ID, etc. | 35 // Set up client ID, session ID, etc. |
| 36 void InitializeMetricsState(); | 36 void InitializeMetricsState(); |
| 37 | 37 |
| 38 private: | 38 private: |
| 39 // To enable the default traits object to create an instance of this class. | |
| 40 friend struct base::DefaultLazyInstanceTraits<MetricsService>; | |
| 41 | |
| 42 MetricsService(); | 39 MetricsService(); |
| 43 virtual ~MetricsService(); | 40 virtual ~MetricsService(); |
| 44 // The MetricsService has a lifecycle that is stored as a state. | 41 // The MetricsService has a lifecycle that is stored as a state. |
| 45 // See metrics_service.cc for description of this lifecycle. | 42 // See metrics_service.cc for description of this lifecycle. |
| 46 enum State { | 43 enum State { |
| 47 INITIALIZED, // Constructor was called. | 44 INITIALIZED, // Constructor was called. |
| 48 ACTIVE, // Accumalating log data | 45 ACTIVE, // Accumalating log data |
| 49 STOPPED, // Service has stopped | 46 STOPPED, // Service has stopped |
| 50 }; | 47 }; |
| 51 | 48 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 | 129 |
| 133 // The URL for the metrics server. | 130 // The URL for the metrics server. |
| 134 std::wstring server_url_; | 131 std::wstring server_url_; |
| 135 | 132 |
| 136 // The identifier that's sent to the server with the log reports. | 133 // The identifier that's sent to the server with the log reports. |
| 137 std::string client_id_; | 134 std::string client_id_; |
| 138 | 135 |
| 139 // A number that identifies the how many times the app has been launched. | 136 // A number that identifies the how many times the app has been launched. |
| 140 int session_id_; | 137 int session_id_; |
| 141 | 138 |
| 139 static base::LazyInstance<base::ThreadLocalPointer<MetricsService> > |
| 140 g_metrics_instance_; |
| 141 |
| 142 base::PlatformThreadId thread_; | 142 base::PlatformThreadId thread_; |
| 143 | 143 |
| 144 // Indicates if this is the first uma upload from this instance. | 144 // Indicates if this is the first uma upload from this instance. |
| 145 bool initial_uma_upload_; | 145 bool initial_uma_upload_; |
| 146 | 146 |
| 147 // The transmission timer id returned by SetTimer | 147 // The transmission timer id returned by SetTimer |
| 148 int transmission_timer_id_; | 148 int transmission_timer_id_; |
| 149 | 149 |
| 150 // Used to serialize the Start and Stop operations on the metrics service. | 150 // Used to serialize the Start and Stop operations on the metrics service. |
| 151 static base::Lock metrics_service_lock_; | 151 static base::Lock metrics_service_lock_; |
| 152 | 152 |
| 153 DISALLOW_COPY_AND_ASSIGN(MetricsService); | 153 DISALLOW_COPY_AND_ASSIGN(MetricsService); |
| 154 }; | 154 }; |
| 155 | 155 |
| 156 #endif // CHROME_FRAME_METRICS_SERVICE_H_ | 156 #endif // CHROME_FRAME_METRICS_SERVICE_H_ |
| OLD | NEW |