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

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

Issue 10151009: Disallow UI/IO thread blocking on any other thread. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/io_thread.cc ('k') | chrome/browser/net/predictor.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // Description of the life cycle of a instance of MetricsService. 6 // Description of the life cycle of a instance of MetricsService.
7 // 7 //
8 // OVERVIEW 8 // OVERVIEW
9 // 9 //
10 // A MetricsService instance is typically created at application startup. It 10 // A MetricsService instance is typically created at application startup. It
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 #include "chrome/browser/metrics/metrics_service.h" 145 #include "chrome/browser/metrics/metrics_service.h"
146 146
147 #include "base/bind.h" 147 #include "base/bind.h"
148 #include "base/callback.h" 148 #include "base/callback.h"
149 #include "base/command_line.h" 149 #include "base/command_line.h"
150 #include "base/md5.h" 150 #include "base/md5.h"
151 #include "base/metrics/histogram.h" 151 #include "base/metrics/histogram.h"
152 #include "base/string_number_conversions.h" 152 #include "base/string_number_conversions.h"
153 #include "base/threading/platform_thread.h" 153 #include "base/threading/platform_thread.h"
154 #include "base/threading/thread.h" 154 #include "base/threading/thread.h"
155 #include "base/threading/thread_restrictions.h"
155 #include "base/utf_string_conversions.h" 156 #include "base/utf_string_conversions.h"
156 #include "base/values.h" 157 #include "base/values.h"
157 #include "chrome/browser/bookmarks/bookmark_model.h" 158 #include "chrome/browser/bookmarks/bookmark_model.h"
158 #include "chrome/browser/browser_process.h" 159 #include "chrome/browser/browser_process.h"
159 #include "chrome/browser/extensions/extension_service.h" 160 #include "chrome/browser/extensions/extension_service.h"
160 #include "chrome/browser/extensions/process_map.h" 161 #include "chrome/browser/extensions/process_map.h"
161 #include "chrome/browser/io_thread.h" 162 #include "chrome/browser/io_thread.h"
162 #include "chrome/browser/memory_details.h" 163 #include "chrome/browser/memory_details.h"
163 #include "chrome/browser/metrics/histogram_synchronizer.h" 164 #include "chrome/browser/metrics/histogram_synchronizer.h"
164 #include "chrome/browser/metrics/metrics_log.h" 165 #include "chrome/browser/metrics/metrics_log.h"
(...skipping 1266 matching lines...) Expand 10 before | Expand all | Expand 10 after
1431 PrefService* pref = g_browser_process->local_state(); 1432 PrefService* pref = g_browser_process->local_state();
1432 pref->SetBoolean(prefs::kStabilityExitedCleanly, true); 1433 pref->SetBoolean(prefs::kStabilityExitedCleanly, true);
1433 pref->CommitPendingWrite(); 1434 pref->CommitPendingWrite();
1434 // Hack: TBD: Remove this wait. 1435 // Hack: TBD: Remove this wait.
1435 // We are so concerned that the pref gets written, we are now willing to stall 1436 // We are so concerned that the pref gets written, we are now willing to stall
1436 // the UI thread until we get assurance that a pref-writing task has 1437 // the UI thread until we get assurance that a pref-writing task has
1437 // completed. 1438 // completed.
1438 base::WaitableEvent done_writing(false, false); 1439 base::WaitableEvent done_writing(false, false);
1439 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, 1440 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
1440 base::Bind(Signal, &done_writing)); 1441 base::Bind(Signal, &done_writing));
1442 // http://crbug.com/124954
1443 base::ThreadRestrictions::ScopedAllowWait allow_wait;
1441 done_writing.TimedWait(base::TimeDelta::FromHours(1)); 1444 done_writing.TimedWait(base::TimeDelta::FromHours(1));
1442 1445
1443 // Redundant setting to assure that we always reset this value at shutdown 1446 // Redundant setting to assure that we always reset this value at shutdown
1444 // (and that we don't use some alternate path, and not call LogCleanShutdown). 1447 // (and that we don't use some alternate path, and not call LogCleanShutdown).
1445 clean_shutdown_status_ = CLEANLY_SHUTDOWN; 1448 clean_shutdown_status_ = CLEANLY_SHUTDOWN;
1446 1449
1447 RecordBooleanPrefValue(prefs::kStabilityExitedCleanly, true); 1450 RecordBooleanPrefValue(prefs::kStabilityExitedCleanly, true);
1448 } 1451 }
1449 1452
1450 #if defined(OS_CHROMEOS) 1453 #if defined(OS_CHROMEOS)
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
1670 if (local_state) { 1673 if (local_state) {
1671 const PrefService::Preference* uma_pref = 1674 const PrefService::Preference* uma_pref =
1672 local_state->FindPreference(prefs::kMetricsReportingEnabled); 1675 local_state->FindPreference(prefs::kMetricsReportingEnabled);
1673 if (uma_pref) { 1676 if (uma_pref) {
1674 bool success = uma_pref->GetValue()->GetAsBoolean(&result); 1677 bool success = uma_pref->GetValue()->GetAsBoolean(&result);
1675 DCHECK(success); 1678 DCHECK(success);
1676 } 1679 }
1677 } 1680 }
1678 return result; 1681 return result;
1679 } 1682 }
OLDNEW
« no previous file with comments | « chrome/browser/io_thread.cc ('k') | chrome/browser/net/predictor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698