OLD | NEW |
---|---|
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 #include "chrome/browser/browser_process_impl.h" | 5 #include "chrome/browser/browser_process_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/bind_helpers.h" | 13 #include "base/bind_helpers.h" |
14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
15 #include "base/debug/alias.h" | 15 #include "base/debug/alias.h" |
16 #include "base/file_util.h" | 16 #include "base/file_util.h" |
17 #include "base/path_service.h" | 17 #include "base/path_service.h" |
18 #include "base/synchronization/waitable_event.h" | 18 #include "base/synchronization/waitable_event.h" |
19 #include "base/threading/sequenced_worker_pool.h" | |
19 #include "base/threading/thread.h" | 20 #include "base/threading/thread.h" |
20 #include "base/threading/thread_restrictions.h" | 21 #include "base/threading/thread_restrictions.h" |
21 #include "chrome/browser/automation/automation_provider_list.h" | 22 #include "chrome/browser/automation/automation_provider_list.h" |
22 #include "chrome/browser/background/background_mode_manager.h" | 23 #include "chrome/browser/background/background_mode_manager.h" |
23 #include "chrome/browser/chrome_browser_main.h" | 24 #include "chrome/browser/chrome_browser_main.h" |
24 #include "chrome/browser/chrome_content_browser_client.h" | 25 #include "chrome/browser/chrome_content_browser_client.h" |
25 #include "chrome/browser/chrome_plugin_service_filter.h" | 26 #include "chrome/browser/chrome_plugin_service_filter.h" |
26 #include "chrome/browser/component_updater/component_updater_configurator.h" | 27 #include "chrome/browser/component_updater/component_updater_configurator.h" |
27 #include "chrome/browser/component_updater/component_updater_service.h" | 28 #include "chrome/browser/component_updater/component_updater_service.h" |
28 #include "chrome/browser/debugger/remote_debugging_server.h" | 29 #include "chrome/browser/debugger/remote_debugging_server.h" |
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
700 | 701 |
701 FilePath user_data_dir; | 702 FilePath user_data_dir; |
702 PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); | 703 PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); |
703 profile_manager_.reset(new ProfileManager(user_data_dir)); | 704 profile_manager_.reset(new ProfileManager(user_data_dir)); |
704 } | 705 } |
705 | 706 |
706 void BrowserProcessImpl::CreateLocalState() { | 707 void BrowserProcessImpl::CreateLocalState() { |
707 DCHECK(!created_local_state_ && local_state_.get() == NULL); | 708 DCHECK(!created_local_state_ && local_state_.get() == NULL); |
708 created_local_state_ = true; | 709 created_local_state_ = true; |
709 | 710 |
711 scoped_refptr<base::SequencedTaskRunner> sequenced_task_runner = | |
akalin
2012/10/17 21:58:19
is there any way we can pass down the task runner
zel
2012/10/18 00:31:15
Done.
| |
712 BrowserThread::GetBlockingPool()-> | |
713 GetSequencedTaskRunnerWithShutdownBehavior( | |
714 BrowserThread::GetBlockingPool()->GetNamedSequenceToken( | |
715 "local_state_pool"), | |
716 base::SequencedWorkerPool::BLOCK_SHUTDOWN); | |
717 | |
710 FilePath local_state_path; | 718 FilePath local_state_path; |
711 PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path); | 719 PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path); |
712 local_state_.reset( | 720 local_state_.reset( |
713 PrefService::CreatePrefService(local_state_path, policy_service(), NULL, | 721 PrefService::CreatePrefService(local_state_path, policy_service(), NULL, |
714 false)); | 722 false, sequenced_task_runner.get())); |
715 | 723 |
716 // Initialize the prefs of the local state. | 724 // Initialize the prefs of the local state. |
717 chrome::RegisterLocalState(local_state_.get()); | 725 chrome::RegisterLocalState(local_state_.get()); |
718 | 726 |
719 pref_change_registrar_.Init(local_state_.get()); | 727 pref_change_registrar_.Init(local_state_.get()); |
720 | 728 |
721 // Initialize the notification for the default browser setting policy. | 729 // Initialize the notification for the default browser setting policy. |
722 local_state_->RegisterBooleanPref(prefs::kDefaultBrowserSettingEnabled, | 730 local_state_->RegisterBooleanPref(prefs::kDefaultBrowserSettingEnabled, |
723 false); | 731 false); |
724 pref_change_registrar_.Add(prefs::kDefaultBrowserSettingEnabled, this); | 732 pref_change_registrar_.Add(prefs::kDefaultBrowserSettingEnabled, this); |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
945 } | 953 } |
946 | 954 |
947 void BrowserProcessImpl::OnAutoupdateTimer() { | 955 void BrowserProcessImpl::OnAutoupdateTimer() { |
948 if (CanAutorestartForUpdate()) { | 956 if (CanAutorestartForUpdate()) { |
949 DLOG(WARNING) << "Detected update. Restarting browser."; | 957 DLOG(WARNING) << "Detected update. Restarting browser."; |
950 RestartBackgroundInstance(); | 958 RestartBackgroundInstance(); |
951 } | 959 } |
952 } | 960 } |
953 | 961 |
954 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 962 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
OLD | NEW |