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

Side by Side Diff: chrome/browser/metrics/metrics_service.h

Issue 3800001: Factoring GUID generation from metrics to base (Closed)
Patch Set: Adding unit tests. Created 10 years, 2 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
« no previous file with comments | « base/rand_util_win.cc ('k') | chrome/browser/metrics/metrics_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_BROWSER_METRICS_METRICS_SERVICE_H_ 8 #ifndef CHROME_BROWSER_METRICS_METRICS_SERVICE_H_
9 #define CHROME_BROWSER_METRICS_METRICS_SERVICE_H_ 9 #define CHROME_BROWSER_METRICS_METRICS_SERVICE_H_
10 #pragma once 10 #pragma once
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 // idle_since_last_transmission to false and starts the timer (provided 185 // idle_since_last_transmission to false and starts the timer (provided
186 // starting the timer is permitted). 186 // starting the timer is permitted).
187 void HandleIdleSinceLastTransmission(bool in_idle); 187 void HandleIdleSinceLastTransmission(bool in_idle);
188 188
189 // Set up client ID, session ID, etc. 189 // Set up client ID, session ID, etc.
190 void InitializeMetricsState(); 190 void InitializeMetricsState();
191 191
192 // Generates a new client ID to use to identify self to metrics server. 192 // Generates a new client ID to use to identify self to metrics server.
193 static std::string GenerateClientID(); 193 static std::string GenerateClientID();
194 194
195 #if defined(OS_POSIX)
196 // Generates a new client ID to use to identify self to metrics server,
197 // given 128 bits of randomness.
198 static std::string RandomBytesToGUIDString(const uint64 bytes[2]);
199 #endif
200
201 // Schedule the next save of LocalState information. This is called 195 // Schedule the next save of LocalState information. This is called
202 // automatically by the task that performs each save to schedule the next one. 196 // automatically by the task that performs each save to schedule the next one.
203 void ScheduleNextStateSave(); 197 void ScheduleNextStateSave();
204 198
205 // Save the LocalState information immediately. This should not be called by 199 // Save the LocalState information immediately. This should not be called by
206 // anybody other than the scheduler to avoid doing too many writes. When you 200 // anybody other than the scheduler to avoid doing too many writes. When you
207 // make a change, call ScheduleNextStateSave() instead. 201 // make a change, call ScheduleNextStateSave() instead.
208 void SaveLocalState(); 202 void SaveLocalState();
209 203
210 // Called to start recording user experience metrics. 204 // Called to start recording user experience metrics.
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, CorruptSizeOfLogList); 492 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, CorruptSizeOfLogList);
499 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, CorruptChecksumOfLogList); 493 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, CorruptChecksumOfLogList);
500 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, ClientIdGeneratesAllZeroes); 494 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, ClientIdGeneratesAllZeroes);
501 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, ClientIdGeneratesCorrectly); 495 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, ClientIdGeneratesCorrectly);
502 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, ClientIdCorrectlyFormatted); 496 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, ClientIdCorrectlyFormatted);
503 497
504 DISALLOW_COPY_AND_ASSIGN(MetricsService); 498 DISALLOW_COPY_AND_ASSIGN(MetricsService);
505 }; 499 };
506 500
507 #endif // CHROME_BROWSER_METRICS_METRICS_SERVICE_H_ 501 #endif // CHROME_BROWSER_METRICS_METRICS_SERVICE_H_
OLDNEW
« no previous file with comments | « base/rand_util_win.cc ('k') | chrome/browser/metrics/metrics_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698