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" | |
25 #include "base/metrics/histogram_macros.h" | 24 #include "base/metrics/histogram_macros.h" |
26 #include "base/path_service.h" | 25 #include "base/path_service.h" |
27 #include "base/single_thread_task_runner.h" | 26 #include "base/single_thread_task_runner.h" |
28 #include "base/synchronization/waitable_event.h" | 27 #include "base/synchronization/waitable_event.h" |
29 #include "base/threading/sequenced_worker_pool.h" | 28 #include "base/threading/sequenced_worker_pool.h" |
30 #include "base/threading/thread.h" | 29 #include "base/threading/thread.h" |
31 #include "base/threading/thread_restrictions.h" | 30 #include "base/threading/thread_restrictions.h" |
32 #include "base/threading/thread_task_runner_handle.h" | 31 #include "base/threading/thread_task_runner_handle.h" |
33 #include "base/time/default_clock.h" | 32 #include "base/time/default_clock.h" |
34 #include "base/time/default_tick_clock.h" | 33 #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); | 1070 int max_per_proxy = local_state_->GetInteger(prefs::kMaxConnectionsPerProxy); |
1072 net::ClientSocketPoolManager::set_max_sockets_per_proxy_server( | 1071 net::ClientSocketPoolManager::set_max_sockets_per_proxy_server( |
1073 net::HttpNetworkSession::NORMAL_SOCKET_POOL, | 1072 net::HttpNetworkSession::NORMAL_SOCKET_POOL, |
1074 std::max(std::min(max_per_proxy, 99), | 1073 std::max(std::min(max_per_proxy, 99), |
1075 net::ClientSocketPoolManager::max_sockets_per_group( | 1074 net::ClientSocketPoolManager::max_sockets_per_group( |
1076 net::HttpNetworkSession::NORMAL_SOCKET_POOL))); | 1075 net::HttpNetworkSession::NORMAL_SOCKET_POOL))); |
1077 } | 1076 } |
1078 | 1077 |
1079 void BrowserProcessImpl::PreCreateThreads() { | 1078 void BrowserProcessImpl::PreCreateThreads() { |
1080 #if BUILDFLAG(ENABLE_EXTENSIONS) | 1079 #if BUILDFLAG(ENABLE_EXTENSIONS) |
1081 // Register the chrome-extension scheme to reflect the extension process | 1080 // 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. | 1081 // commit (including in iframes) in extension processes. |
1083 base::FieldTrialList::FindFullName("SiteIsolationExtensions"); | 1082 ChildProcessSecurityPolicy::GetInstance()->RegisterWebSafeIsolatedScheme( |
1084 if (extensions::IsIsolateExtensionsEnabled()) { | 1083 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 | 1084 #endif |
1094 | 1085 |
1095 io_thread_.reset( | 1086 io_thread_.reset( |
1096 new IOThread(local_state(), policy_service(), net_log_.get(), | 1087 new IOThread(local_state(), policy_service(), net_log_.get(), |
1097 extension_event_router_forwarder())); | 1088 extension_event_router_forwarder())); |
1098 } | 1089 } |
1099 | 1090 |
1100 void BrowserProcessImpl::PreMainMessageLoopRun() { | 1091 void BrowserProcessImpl::PreMainMessageLoopRun() { |
1101 TRACE_EVENT0("startup", "BrowserProcessImpl::PreMainMessageLoopRun"); | 1092 TRACE_EVENT0("startup", "BrowserProcessImpl::PreMainMessageLoopRun"); |
1102 SCOPED_UMA_HISTOGRAM_TIMER( | 1093 SCOPED_UMA_HISTOGRAM_TIMER( |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1435 } | 1426 } |
1436 | 1427 |
1437 void BrowserProcessImpl::OnAutoupdateTimer() { | 1428 void BrowserProcessImpl::OnAutoupdateTimer() { |
1438 if (CanAutorestartForUpdate()) { | 1429 if (CanAutorestartForUpdate()) { |
1439 DLOG(WARNING) << "Detected update. Restarting browser."; | 1430 DLOG(WARNING) << "Detected update. Restarting browser."; |
1440 RestartBackgroundInstance(); | 1431 RestartBackgroundInstance(); |
1441 } | 1432 } |
1442 } | 1433 } |
1443 | 1434 |
1444 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 1435 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
OLD | NEW |