OLD | NEW |
---|---|
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 | 5 |
6 | 6 |
7 //------------------------------------------------------------------------------ | 7 //------------------------------------------------------------------------------ |
8 // Description of the life cycle of a instance of MetricsService. | 8 // Description of the life cycle of a instance of MetricsService. |
9 // | 9 // |
10 // OVERVIEW | 10 // OVERVIEW |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
342 logged_samples_(), | 342 logged_samples_(), |
343 interlog_duration_(TimeDelta::FromSeconds(kInitialInterlogDuration)), | 343 interlog_duration_(TimeDelta::FromSeconds(kInitialInterlogDuration)), |
344 log_event_limit_(kInitialEventLimit), | 344 log_event_limit_(kInitialEventLimit), |
345 timer_pending_(false) { | 345 timer_pending_(false) { |
346 DCHECK(IsSingleThreaded()); | 346 DCHECK(IsSingleThreaded()); |
347 InitializeMetricsState(); | 347 InitializeMetricsState(); |
348 } | 348 } |
349 | 349 |
350 MetricsService::~MetricsService() { | 350 MetricsService::~MetricsService() { |
351 SetRecording(false); | 351 SetRecording(false); |
352 if (pending_log_) { | |
darin (slow to review)
2009/01/28 09:18:27
nit: there's no need to null-check a pointer befor
| |
353 delete pending_log_; | |
354 pending_log_ = NULL; | |
355 } | |
356 if (current_log_) { | |
357 delete current_log_; | |
358 current_log_ = NULL; | |
359 } | |
352 } | 360 } |
353 | 361 |
354 void MetricsService::SetUserPermitsUpload(bool enabled) { | 362 void MetricsService::SetUserPermitsUpload(bool enabled) { |
355 HandleIdleSinceLastTransmission(false); | 363 HandleIdleSinceLastTransmission(false); |
356 user_permits_upload_ = enabled; | 364 user_permits_upload_ = enabled; |
357 } | 365 } |
358 | 366 |
359 void MetricsService::Start() { | 367 void MetricsService::Start() { |
360 SetRecording(true); | 368 SetRecording(true); |
361 SetReporting(true); | 369 SetReporting(true); |
(...skipping 1391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1753 L"." + key; | 1761 L"." + key; |
1754 prof_prefs->SetInteger(pref_key.c_str(), value); | 1762 prof_prefs->SetInteger(pref_key.c_str(), value); |
1755 } | 1763 } |
1756 | 1764 |
1757 static bool IsSingleThreaded() { | 1765 static bool IsSingleThreaded() { |
1758 static int thread_id = 0; | 1766 static int thread_id = 0; |
1759 if (!thread_id) | 1767 if (!thread_id) |
1760 thread_id = GetCurrentThreadId(); | 1768 thread_id = GetCurrentThreadId(); |
1761 return GetCurrentThreadId() == thread_id; | 1769 return GetCurrentThreadId() == thread_id; |
1762 } | 1770 } |
OLD | NEW |