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 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
716 } | 716 } |
717 | 717 |
718 void MetricsService::SaveLocalState() { | 718 void MetricsService::SaveLocalState() { |
719 PrefService* pref = g_browser_process->local_state(); | 719 PrefService* pref = g_browser_process->local_state(); |
720 if (!pref) { | 720 if (!pref) { |
721 NOTREACHED(); | 721 NOTREACHED(); |
722 return; | 722 return; |
723 } | 723 } |
724 | 724 |
725 RecordCurrentState(pref); | 725 RecordCurrentState(pref); |
726 pref->ScheduleSavePersistentPrefs(g_browser_process->file_thread()); | 726 pref->ScheduleSavePersistentPrefs(); |
727 | 727 |
728 // TODO(jar): Does this run down the batteries???? | 728 // TODO(jar): Does this run down the batteries???? |
729 ScheduleNextStateSave(); | 729 ScheduleNextStateSave(); |
730 } | 730 } |
731 | 731 |
732 | 732 |
733 //------------------------------------------------------------------------------ | 733 //------------------------------------------------------------------------------ |
734 // Recording control methods | 734 // Recording control methods |
735 | 735 |
736 void MetricsService::StartRecording() { | 736 void MetricsService::StartRecording() { |
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1285 default: | 1285 default: |
1286 DCHECK(false); | 1286 DCHECK(false); |
1287 break; | 1287 break; |
1288 } | 1288 } |
1289 | 1289 |
1290 DiscardPendingLog(); | 1290 DiscardPendingLog(); |
1291 // Since we sent a log, make sure our in-memory state is recorded to disk. | 1291 // Since we sent a log, make sure our in-memory state is recorded to disk. |
1292 PrefService* local_state = g_browser_process->local_state(); | 1292 PrefService* local_state = g_browser_process->local_state(); |
1293 DCHECK(local_state); | 1293 DCHECK(local_state); |
1294 if (local_state) | 1294 if (local_state) |
1295 local_state->ScheduleSavePersistentPrefs( | 1295 local_state->ScheduleSavePersistentPrefs(); |
1296 g_browser_process->file_thread()); | |
1297 | 1296 |
1298 // Provide a default (free of exponetial backoff, other varances) in case | 1297 // Provide a default (free of exponetial backoff, other varances) in case |
1299 // the server does not specify a value. | 1298 // the server does not specify a value. |
1300 interlog_duration_ = TimeDelta::FromSeconds(kMinSecondsPerLog); | 1299 interlog_duration_ = TimeDelta::FromSeconds(kMinSecondsPerLog); |
1301 | 1300 |
1302 GetSettingsFromResponseData(data); | 1301 GetSettingsFromResponseData(data); |
1303 // Override server specified interlog delay if there are unsent logs to | 1302 // Override server specified interlog delay if there are unsent logs to |
1304 // transmit. | 1303 // transmit. |
1305 if (unsent_logs()) { | 1304 if (unsent_logs()) { |
1306 DCHECK(state_ < SENDING_CURRENT_LOGS); | 1305 DCHECK(state_ < SENDING_CURRENT_LOGS); |
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1865 L"." + key; | 1864 L"." + key; |
1866 prof_prefs->SetInteger(pref_key.c_str(), value); | 1865 prof_prefs->SetInteger(pref_key.c_str(), value); |
1867 } | 1866 } |
1868 | 1867 |
1869 static bool IsSingleThreaded() { | 1868 static bool IsSingleThreaded() { |
1870 static PlatformThreadId thread_id = 0; | 1869 static PlatformThreadId thread_id = 0; |
1871 if (!thread_id) | 1870 if (!thread_id) |
1872 thread_id = PlatformThread::CurrentId(); | 1871 thread_id = PlatformThread::CurrentId(); |
1873 return PlatformThread::CurrentId() == thread_id; | 1872 return PlatformThread::CurrentId() == thread_id; |
1874 } | 1873 } |
OLD | NEW |