Chromium Code Reviews| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <map> | 10 #include <map> |
| 11 #include <utility> | 11 #include <utility> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/atomic_ref_count.h" | 14 #include "base/atomic_ref_count.h" |
| 15 #include "base/bind.h" | 15 #include "base/bind.h" |
| 16 #include "base/bind_helpers.h" | 16 #include "base/bind_helpers.h" |
| 17 #include "base/command_line.h" | 17 #include "base/command_line.h" |
| 18 #include "base/debug/crash_logging.h" | 18 #include "base/debug/crash_logging.h" |
| 19 #include "base/debug/leak_annotations.h" | 19 #include "base/debug/leak_annotations.h" |
| 20 #include "base/files/file_path.h" | 20 #include "base/files/file_path.h" |
| 21 #include "base/location.h" | 21 #include "base/location.h" |
| 22 #include "base/macros.h" | 22 #include "base/macros.h" |
| 23 #include "base/memory/ptr_util.h" | 23 #include "base/memory/ptr_util.h" |
| 24 #include "base/metrics/field_trial.h" | 24 #include "base/metrics/field_trial.h" |
|
Lei Zhang
2017/05/02 21:32:00
Not used?
nasko
2017/05/03 04:04:19
Done.
| |
| 25 #include "base/metrics/histogram_macros.h" | 25 #include "base/metrics/histogram_macros.h" |
| 26 #include "base/path_service.h" | 26 #include "base/path_service.h" |
| 27 #include "base/single_thread_task_runner.h" | 27 #include "base/single_thread_task_runner.h" |
| 28 #include "base/synchronization/waitable_event.h" | 28 #include "base/synchronization/waitable_event.h" |
| 29 #include "base/threading/sequenced_worker_pool.h" | 29 #include "base/threading/sequenced_worker_pool.h" |
| 30 #include "base/threading/thread.h" | 30 #include "base/threading/thread.h" |
| 31 #include "base/threading/thread_restrictions.h" | 31 #include "base/threading/thread_restrictions.h" |
| 32 #include "base/threading/thread_task_runner_handle.h" | 32 #include "base/threading/thread_task_runner_handle.h" |
| 33 #include "base/time/default_clock.h" | 33 #include "base/time/default_clock.h" |
| 34 #include "base/time/default_tick_clock.h" | 34 #include "base/time/default_tick_clock.h" |
| (...skipping 1036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1071 int max_per_proxy = local_state_->GetInteger(prefs::kMaxConnectionsPerProxy); | 1071 int max_per_proxy = local_state_->GetInteger(prefs::kMaxConnectionsPerProxy); |
| 1072 net::ClientSocketPoolManager::set_max_sockets_per_proxy_server( | 1072 net::ClientSocketPoolManager::set_max_sockets_per_proxy_server( |
| 1073 net::HttpNetworkSession::NORMAL_SOCKET_POOL, | 1073 net::HttpNetworkSession::NORMAL_SOCKET_POOL, |
| 1074 std::max(std::min(max_per_proxy, 99), | 1074 std::max(std::min(max_per_proxy, 99), |
| 1075 net::ClientSocketPoolManager::max_sockets_per_group( | 1075 net::ClientSocketPoolManager::max_sockets_per_group( |
| 1076 net::HttpNetworkSession::NORMAL_SOCKET_POOL))); | 1076 net::HttpNetworkSession::NORMAL_SOCKET_POOL))); |
| 1077 } | 1077 } |
| 1078 | 1078 |
| 1079 void BrowserProcessImpl::PreCreateThreads() { | 1079 void BrowserProcessImpl::PreCreateThreads() { |
| 1080 #if BUILDFLAG(ENABLE_EXTENSIONS) | 1080 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 1081 // Register the chrome-extension scheme to reflect the extension process | 1081 // chrome-extension:// URLs are safe to request anywhere, but may only |
| 1082 // model. Controlled by a field trial, so we can't do this earlier. | 1082 // commit (including in iframes) in extension processes. |
| 1083 base::FieldTrialList::FindFullName("SiteIsolationExtensions"); | 1083 ChildProcessSecurityPolicy::GetInstance()->RegisterWebSafeIsolatedScheme( |
| 1084 if (extensions::IsIsolateExtensionsEnabled()) { | 1084 extensions::kExtensionScheme, true); |
| 1085 // chrome-extension:// URLs are safe to request anywhere, but may only | |
| 1086 // commit (including in iframes) in extension processes. | |
| 1087 ChildProcessSecurityPolicy::GetInstance()->RegisterWebSafeIsolatedScheme( | |
| 1088 extensions::kExtensionScheme, true); | |
| 1089 } else { | |
| 1090 ChildProcessSecurityPolicy::GetInstance()->RegisterWebSafeScheme( | |
| 1091 extensions::kExtensionScheme); | |
| 1092 } | |
| 1093 #endif | 1085 #endif |
| 1094 | 1086 |
| 1095 io_thread_.reset( | 1087 io_thread_.reset( |
| 1096 new IOThread(local_state(), policy_service(), net_log_.get(), | 1088 new IOThread(local_state(), policy_service(), net_log_.get(), |
| 1097 extension_event_router_forwarder())); | 1089 extension_event_router_forwarder())); |
| 1098 } | 1090 } |
| 1099 | 1091 |
| 1100 void BrowserProcessImpl::PreMainMessageLoopRun() { | 1092 void BrowserProcessImpl::PreMainMessageLoopRun() { |
| 1101 TRACE_EVENT0("startup", "BrowserProcessImpl::PreMainMessageLoopRun"); | 1093 TRACE_EVENT0("startup", "BrowserProcessImpl::PreMainMessageLoopRun"); |
| 1102 SCOPED_UMA_HISTOGRAM_TIMER( | 1094 SCOPED_UMA_HISTOGRAM_TIMER( |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1435 } | 1427 } |
| 1436 | 1428 |
| 1437 void BrowserProcessImpl::OnAutoupdateTimer() { | 1429 void BrowserProcessImpl::OnAutoupdateTimer() { |
| 1438 if (CanAutorestartForUpdate()) { | 1430 if (CanAutorestartForUpdate()) { |
| 1439 DLOG(WARNING) << "Detected update. Restarting browser."; | 1431 DLOG(WARNING) << "Detected update. Restarting browser."; |
| 1440 RestartBackgroundInstance(); | 1432 RestartBackgroundInstance(); |
| 1441 } | 1433 } |
| 1442 } | 1434 } |
| 1443 | 1435 |
| 1444 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 1436 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
| OLD | NEW |