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

Side by Side Diff: chrome/browser/chromeos/metrics_cros_settings_provider.cc

Issue 6272012: Temporary whitelist several cases of disk I/O on the UI threads in cros. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/chrome/browser/chromeos
Patch Set: remove UI thread restriction, nits Created 9 years, 11 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/chromeos/login/wizard_controller.cc ('k') | chrome/common/logging_chrome.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 #include "chrome/browser/chromeos/metrics_cros_settings_provider.h" 5 #include "chrome/browser/chromeos/metrics_cros_settings_provider.h"
6 6
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "base/threading/thread_restrictions.h"
8 #include "base/values.h" 9 #include "base/values.h"
9 #include "chrome/browser/chromeos/cros_settings.h" 10 #include "chrome/browser/chromeos/cros_settings.h"
10 #include "chrome/browser/chromeos/cros_settings_names.h" 11 #include "chrome/browser/chromeos/cros_settings_names.h"
11 #include "chrome/browser/chromeos/login/user_manager.h" 12 #include "chrome/browser/chromeos/login/user_manager.h"
12 #include "chrome/browser/ui/options/options_util.h" 13 #include "chrome/browser/ui/options/options_util.h"
13 #include "chrome/installer/util/google_update_settings.h" 14 #include "chrome/installer/util/google_update_settings.h"
14 15
15 #if defined(USE_LINUX_BREAKPAD) 16 #if defined(USE_LINUX_BREAKPAD)
16 #include "chrome/app/breakpad_linux.h" 17 #include "chrome/app/breakpad_linux.h"
17 #endif 18 #endif
(...skipping 18 matching lines...) Expand all
36 } 37 }
37 38
38 // static 39 // static
39 bool MetricsCrosSettingsProvider::SetMetricsStatus(bool enabled) { 40 bool MetricsCrosSettingsProvider::SetMetricsStatus(bool enabled) {
40 // We must be not logged in (on EULA page) or logged is as an owner to be able 41 // We must be not logged in (on EULA page) or logged is as an owner to be able
41 // to modify the setting. 42 // to modify the setting.
42 UserManager *user = UserManager::Get(); 43 UserManager *user = UserManager::Get();
43 if (user->user_is_logged_in() && !user->current_user_is_owner()) 44 if (user->user_is_logged_in() && !user->current_user_is_owner())
44 return false; 45 return false;
45 VLOG(1) << "Setting cros stats/crash metric reporting to " << enabled; 46 VLOG(1) << "Setting cros stats/crash metric reporting to " << enabled;
46 if (enabled != GoogleUpdateSettings::GetCollectStatsConsent()) { 47 bool collect_stats_consent = false;
48 {
49 // Loading consent file state causes us to do blocking IO on UI thread.
50 // Temporarily allow it until we fix http://crbug.com/62626
51 base::ThreadRestrictions::ScopedAllowIO allow_io;
52 collect_stats_consent = GoogleUpdateSettings::GetCollectStatsConsent();
53 }
54 if (enabled != collect_stats_consent) {
47 bool new_enabled = OptionsUtil::ResolveMetricsReportingEnabled(enabled); 55 bool new_enabled = OptionsUtil::ResolveMetricsReportingEnabled(enabled);
48 #if defined(USE_LINUX_BREAKPAD) 56 #if defined(USE_LINUX_BREAKPAD)
49 if (new_enabled) 57 if (new_enabled)
50 InitCrashReporter(); 58 InitCrashReporter();
51 // Else, if (!new_enabled), we should have turned crash reporting off 59 // Else, if (!new_enabled), we should have turned crash reporting off
52 // here, but there is no API for that currently (while we use 60 // here, but there is no API for that currently (while we use
53 // BreakPad). But this is not a big deal: crash reporting will be off 61 // BreakPad). But this is not a big deal: crash reporting will be off
54 // after reboot for the current process while other Chrome processes 62 // after reboot for the current process while other Chrome processes
55 // will start when the setting is already set up. Other ChromeOS 63 // will start when the setting is already set up. Other ChromeOS
56 // processes does not use BreakPad. 64 // processes does not use BreakPad.
57 #endif 65 #endif
58 return new_enabled == enabled; 66 return new_enabled == enabled;
59 } 67 }
60 return false; 68 return false;
61 } 69 }
62 70
63 // static 71 // static
64 bool MetricsCrosSettingsProvider::GetMetricsStatus() { 72 bool MetricsCrosSettingsProvider::GetMetricsStatus() {
73 // Loading consent file state causes us to do blocking IO on UI thread.
74 // Temporarily allow it until we fix http://crbug.com/62626
75 base::ThreadRestrictions::ScopedAllowIO allow_io;
65 return GoogleUpdateSettings::GetCollectStatsConsent(); 76 return GoogleUpdateSettings::GetCollectStatsConsent();
66 } 77 }
67 78
68 bool MetricsCrosSettingsProvider::HandlesSetting(const std::string& path) { 79 bool MetricsCrosSettingsProvider::HandlesSetting(const std::string& path) {
69 return ::StartsWithASCII(path, kStatsReportingPref, true); 80 return ::StartsWithASCII(path, kStatsReportingPref, true);
70 } 81 }
71 82
72 }; // namespace chromeos 83 }; // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/wizard_controller.cc ('k') | chrome/common/logging_chrome.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698