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

Side by Side Diff: chrome/browser/chromeos/login/wizard_controller.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
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/login/wizard_controller.h" 5 #include "chrome/browser/chromeos/login/wizard_controller.h"
6 6
7 #include <gdk/gdk.h> 7 #include <gdk/gdk.h>
8 #include <signal.h> 8 #include <signal.h>
9 #include <sys/types.h> 9 #include <sys/types.h>
10 10
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/command_line.h" 14 #include "base/command_line.h"
15 #include "base/file_util.h" 15 #include "base/file_util.h"
16 #include "base/logging.h" 16 #include "base/logging.h"
17 #include "base/threading/thread_restrictions.h"
17 #include "chrome/browser/browser_process.h" 18 #include "chrome/browser/browser_process.h"
18 #include "chrome/browser/chromeos/cros/cros_library.h" 19 #include "chrome/browser/chromeos/cros/cros_library.h"
19 #include "chrome/browser/chromeos/cros/cryptohome_library.h" 20 #include "chrome/browser/chromeos/cros/cryptohome_library.h"
20 #include "chrome/browser/chromeos/cros/input_method_library.h" 21 #include "chrome/browser/chromeos/cros/input_method_library.h"
21 #include "chrome/browser/chromeos/cros/login_library.h" 22 #include "chrome/browser/chromeos/cros/login_library.h"
22 #include "chrome/browser/chromeos/cros/system_library.h" 23 #include "chrome/browser/chromeos/cros/system_library.h"
23 #include "chrome/browser/chromeos/customization_document.h" 24 #include "chrome/browser/chromeos/customization_document.h"
24 #include "chrome/browser/chromeos/input_method/input_method_util.h" 25 #include "chrome/browser/chromeos/input_method/input_method_util.h"
25 #include "chrome/browser/chromeos/language_preferences.h" 26 #include "chrome/browser/chromeos/language_preferences.h"
26 #include "chrome/browser/chromeos/login/account_screen.h" 27 #include "chrome/browser/chromeos/login/account_screen.h"
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 // Launch browser after controller is deleted and its windows are closed. 186 // Launch browser after controller is deleted and its windows are closed.
186 chromeos::LoginUtils::Get()->EnableBrowserLaunch(true); 187 chromeos::LoginUtils::Get()->EnableBrowserLaunch(true);
187 BrowserThread::PostTask( 188 BrowserThread::PostTask(
188 BrowserThread::UI, 189 BrowserThread::UI,
189 FROM_HERE, 190 FROM_HERE,
190 NewRunnableFunction(&chromeos::LoginUtils::DoBrowserLaunch, 191 NewRunnableFunction(&chromeos::LoginUtils::DoBrowserLaunch,
191 ProfileManager::GetDefaultProfile())); 192 ProfileManager::GetDefaultProfile()));
192 } 193 }
193 194
194 const chromeos::StartupCustomizationDocument* LoadStartupManifest() { 195 const chromeos::StartupCustomizationDocument* LoadStartupManifest() {
195 // Load partner customization startup manifest if it is available. 196 // Loading manifest causes us to do blocking IO on UI thread.
197 // Temporarily allow it until we fix http://crosbug.com/11103
198 base::ThreadRestrictions::ScopedAllowIO allow_io;
196 FilePath startup_manifest_path(kStartupCustomizationManifestPath); 199 FilePath startup_manifest_path(kStartupCustomizationManifestPath);
197 if (file_util::PathExists(startup_manifest_path)) { 200 if (file_util::PathExists(startup_manifest_path)) {
198 scoped_ptr<chromeos::StartupCustomizationDocument> customization( 201 scoped_ptr<chromeos::StartupCustomizationDocument> customization(
199 new chromeos::StartupCustomizationDocument()); 202 new chromeos::StartupCustomizationDocument());
200 bool manifest_loaded = customization->LoadManifestFromFile( 203 bool manifest_loaded = customization->LoadManifestFromFile(
201 startup_manifest_path); 204 startup_manifest_path);
202 if (manifest_loaded) { 205 if (manifest_loaded) {
203 VLOG(1) << "Startup manifest loaded successfully"; 206 VLOG(1) << "Startup manifest loaded successfully";
204 return customization.release(); 207 return customization.release();
205 } 208 }
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 SaveBoolPreferenceForced(kEulaAccepted, true); 824 SaveBoolPreferenceForced(kEulaAccepted, true);
822 } 825 }
823 826
824 // static 827 // static
825 void WizardController::MarkOobeCompleted() { 828 void WizardController::MarkOobeCompleted() {
826 SaveBoolPreferenceForced(kOobeComplete, true); 829 SaveBoolPreferenceForced(kOobeComplete, true);
827 } 830 }
828 831
829 // static 832 // static
830 bool WizardController::IsDeviceRegistered() { 833 bool WizardController::IsDeviceRegistered() {
834 // Checking for flag file causes us to do blocking IO on UI thread.
835 // Temporarily allow it until we fix http://crbug.com/70131
836 base::ThreadRestrictions::ScopedAllowIO allow_io;
831 FilePath oobe_complete_flag_file_path(kOobeCompleteFlagFilePath); 837 FilePath oobe_complete_flag_file_path(kOobeCompleteFlagFilePath);
832 return file_util::PathExists(oobe_complete_flag_file_path); 838 return file_util::PathExists(oobe_complete_flag_file_path);
833 } 839 }
834 840
835 // static 841 // static
836 bool WizardController::IsRegisterScreenDefined() { 842 bool WizardController::IsRegisterScreenDefined() {
837 const chromeos::StartupCustomizationDocument* manifest = NULL; 843 const chromeos::StartupCustomizationDocument* manifest = NULL;
838 // This method will be called from ExistingUserController too 844 // This method will be called from ExistingUserController too
839 // when Wizard instance doesn't exist. 845 // when Wizard instance doesn't exist.
840 if (default_controller()) 846 if (default_controller())
841 manifest = default_controller()->GetCustomization(); 847 manifest = default_controller()->GetCustomization();
842 else 848 else
843 manifest = LoadStartupManifest(); 849 manifest = LoadStartupManifest();
844 return IsRegistrationScreenValid(manifest); 850 return IsRegistrationScreenValid(manifest);
845 } 851 }
846 852
847 // static 853 // static
848 void WizardController::MarkDeviceRegistered() { 854 void WizardController::MarkDeviceRegistered() {
855 // Creating flag file causes us to do blocking IO on UI thread.
856 // Temporarily allow it until we fix http://crbug.com/70131
857 base::ThreadRestrictions::ScopedAllowIO allow_io;
849 // Create flag file for boot-time init scripts. 858 // Create flag file for boot-time init scripts.
850 FilePath oobe_complete_path(kOobeCompleteFlagFilePath); 859 FilePath oobe_complete_path(kOobeCompleteFlagFilePath);
851 FILE* oobe_flag_file = file_util::OpenFile(oobe_complete_path, "w+b"); 860 FILE* oobe_flag_file = file_util::OpenFile(oobe_complete_path, "w+b");
852 DCHECK(oobe_flag_file != NULL) << kOobeCompleteFlagFilePath; 861 DCHECK(oobe_flag_file != NULL) << kOobeCompleteFlagFilePath;
853 if (oobe_flag_file != NULL) 862 if (oobe_flag_file != NULL)
854 file_util::CloseFile(oobe_flag_file); 863 file_util::CloseFile(oobe_flag_file);
855 } 864 }
856 865
857 /////////////////////////////////////////////////////////////////////////////// 866 ///////////////////////////////////////////////////////////////////////////////
858 // WizardController, chromeos::ScreenObserver overrides: 867 // WizardController, chromeos::ScreenObserver overrides:
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
1002 // chromeos::LanguageSwitchMenu::SwitchLanguage here before 1011 // chromeos::LanguageSwitchMenu::SwitchLanguage here before
1003 // EmitLoginPromptReady. 1012 // EmitLoginPromptReady.
1004 const std::string current_locale = 1013 const std::string current_locale =
1005 g_browser_process->local_state()->GetString( 1014 g_browser_process->local_state()->GetString(
1006 prefs::kApplicationLocale); 1015 prefs::kApplicationLocale);
1007 VLOG(1) << "Current locale: " << current_locale; 1016 VLOG(1) << "Current locale: " << current_locale;
1008 if (current_locale.empty()) { 1017 if (current_locale.empty()) {
1009 locale = controller->GetCustomization()->initial_locale(); 1018 locale = controller->GetCustomization()->initial_locale();
1010 VLOG(1) << "Initial locale: " << locale; 1019 VLOG(1) << "Initial locale: " << locale;
1011 if (!locale.empty()) { 1020 if (!locale.empty()) {
1021 // Reloading resource bundle causes us to do blocking IO on UI thread.
1022 // Temporarily allow it until we fix http://crosbug.com/11102
1023 base::ThreadRestrictions::ScopedAllowIO allow_io;
1012 const std::string loaded_locale = 1024 const std::string loaded_locale =
1013 ResourceBundle::ReloadSharedInstance(locale); 1025 ResourceBundle::ReloadSharedInstance(locale);
1014 CHECK(!loaded_locale.empty()) << "Locale could not be found for " 1026 CHECK(!loaded_locale.empty()) << "Locale could not be found for "
1015 << locale; 1027 << locale;
1016 } 1028 }
1017 } 1029 }
1018 } 1030 }
1019 1031
1020 controller->ShowBackground(screen_bounds); 1032 controller->ShowBackground(screen_bounds);
1021 controller->Init(first_screen_name, screen_bounds); 1033 controller->Init(first_screen_name, screen_bounds);
(...skipping 15 matching lines...) Expand all
1037 // user has changed to during OOBE. 1049 // user has changed to during OOBE.
1038 if (!timezone_name.empty()) { 1050 if (!timezone_name.empty()) {
1039 icu::TimeZone* timezone = icu::TimeZone::createTimeZone( 1051 icu::TimeZone* timezone = icu::TimeZone::createTimeZone(
1040 icu::UnicodeString::fromUTF8(timezone_name)); 1052 icu::UnicodeString::fromUTF8(timezone_name));
1041 chromeos::CrosLibrary::Get()->GetSystemLibrary()->SetTimezone(timezone); 1053 chromeos::CrosLibrary::Get()->GetSystemLibrary()->SetTimezone(timezone);
1042 } 1054 }
1043 } 1055 }
1044 } 1056 }
1045 1057
1046 } // namespace browser 1058 } // namespace browser
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/update_screen.cc ('k') | chrome/browser/chromeos/metrics_cros_settings_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698