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

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

Issue 83001: ImportantFileWriter (Closed)
Patch Set: share more code Created 11 years, 7 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 | « chrome/browser/importer/importer.cc ('k') | chrome/browser/metrics/metrics_service_uitest.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) 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
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
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
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 }
OLDNEW
« no previous file with comments | « chrome/browser/importer/importer.cc ('k') | chrome/browser/metrics/metrics_service_uitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698