| 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> |
| (...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 | 440 |
| 441 void RundownTaskCounter::Post(base::SequencedTaskRunner* task_runner) { | 441 void RundownTaskCounter::Post(base::SequencedTaskRunner* task_runner) { |
| 442 // As the count starts off at one, it should never get to zero unless | 442 // As the count starts off at one, it should never get to zero unless |
| 443 // TimedWait has been called. | 443 // TimedWait has been called. |
| 444 DCHECK(!base::AtomicRefCountIsZero(&count_)); | 444 DCHECK(!base::AtomicRefCountIsZero(&count_)); |
| 445 | 445 |
| 446 base::AtomicRefCountInc(&count_); | 446 base::AtomicRefCountInc(&count_); |
| 447 | 447 |
| 448 // The task must be non-nestable to guarantee that it runs after all tasks | 448 // The task must be non-nestable to guarantee that it runs after all tasks |
| 449 // currently scheduled on |task_runner| have completed. | 449 // currently scheduled on |task_runner| have completed. |
| 450 task_runner->PostNonNestableTask(FROM_HERE, | 450 task_runner->PostNonNestableTask( |
| 451 base::Bind(&RundownTaskCounter::Decrement, this)); | 451 FROM_HERE, base::BindOnce(&RundownTaskCounter::Decrement, this)); |
| 452 } | 452 } |
| 453 | 453 |
| 454 void RundownTaskCounter::Decrement() { | 454 void RundownTaskCounter::Decrement() { |
| 455 if (!base::AtomicRefCountDec(&count_)) | 455 if (!base::AtomicRefCountDec(&count_)) |
| 456 waitable_event_.Signal(); | 456 waitable_event_.Signal(); |
| 457 } | 457 } |
| 458 | 458 |
| 459 bool RundownTaskCounter::TimedWaitUntil(const base::TimeTicks& end_time) { | 459 bool RundownTaskCounter::TimedWaitUntil(const base::TimeTicks& end_time) { |
| 460 // Decrement the excess count from the constructor. | 460 // Decrement the excess count from the constructor. |
| 461 Decrement(); | 461 Decrement(); |
| (...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1312 | 1312 |
| 1313 void BrowserProcessImpl::ApplyAllowCrossOriginAuthPromptPolicy() { | 1313 void BrowserProcessImpl::ApplyAllowCrossOriginAuthPromptPolicy() { |
| 1314 bool value = local_state()->GetBoolean(prefs::kAllowCrossOriginAuthPrompt); | 1314 bool value = local_state()->GetBoolean(prefs::kAllowCrossOriginAuthPrompt); |
| 1315 ResourceDispatcherHost::Get()->SetAllowCrossOriginAuthPrompt(value); | 1315 ResourceDispatcherHost::Get()->SetAllowCrossOriginAuthPrompt(value); |
| 1316 } | 1316 } |
| 1317 | 1317 |
| 1318 void BrowserProcessImpl::ApplyMetricsReportingPolicy() { | 1318 void BrowserProcessImpl::ApplyMetricsReportingPolicy() { |
| 1319 #if !defined(OS_ANDROID) | 1319 #if !defined(OS_ANDROID) |
| 1320 CHECK(BrowserThread::PostTask( | 1320 CHECK(BrowserThread::PostTask( |
| 1321 BrowserThread::FILE, FROM_HERE, | 1321 BrowserThread::FILE, FROM_HERE, |
| 1322 base::Bind( | 1322 base::BindOnce( |
| 1323 base::IgnoreResult(&GoogleUpdateSettings::SetCollectStatsConsent), | 1323 base::IgnoreResult(&GoogleUpdateSettings::SetCollectStatsConsent), |
| 1324 ChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled()))); | 1324 ChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled()))); |
| 1325 #endif | 1325 #endif |
| 1326 } | 1326 } |
| 1327 | 1327 |
| 1328 void BrowserProcessImpl::CacheDefaultWebClientState() { | 1328 void BrowserProcessImpl::CacheDefaultWebClientState() { |
| 1329 #if defined(OS_CHROMEOS) | 1329 #if defined(OS_CHROMEOS) |
| 1330 cached_default_web_client_state_ = shell_integration::IS_DEFAULT; | 1330 cached_default_web_client_state_ = shell_integration::IS_DEFAULT; |
| 1331 #elif !defined(OS_ANDROID) | 1331 #elif !defined(OS_ANDROID) |
| 1332 cached_default_web_client_state_ = shell_integration::GetDefaultBrowser(); | 1332 cached_default_web_client_state_ = shell_integration::GetDefaultBrowser(); |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1435 } | 1435 } |
| 1436 | 1436 |
| 1437 void BrowserProcessImpl::OnAutoupdateTimer() { | 1437 void BrowserProcessImpl::OnAutoupdateTimer() { |
| 1438 if (CanAutorestartForUpdate()) { | 1438 if (CanAutorestartForUpdate()) { |
| 1439 DLOG(WARNING) << "Detected update. Restarting browser."; | 1439 DLOG(WARNING) << "Detected update. Restarting browser."; |
| 1440 RestartBackgroundInstance(); | 1440 RestartBackgroundInstance(); |
| 1441 } | 1441 } |
| 1442 } | 1442 } |
| 1443 | 1443 |
| 1444 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 1444 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
| OLD | NEW |