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 "content/browser/browser_main_loop.h" | 5 #include "content/browser/browser_main_loop.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 399 moderate_threshold_mb, critical_threshold_mb); | 399 moderate_threshold_mb, critical_threshold_mb); |
| 400 } | 400 } |
| 401 | 401 |
| 402 // In absence of valid switches use the automatic defaults. | 402 // In absence of valid switches use the automatic defaults. |
| 403 return base::MakeUnique<base::win::MemoryPressureMonitor>(); | 403 return base::MakeUnique<base::win::MemoryPressureMonitor>(); |
| 404 } | 404 } |
| 405 #endif // defined(OS_WIN) | 405 #endif // defined(OS_WIN) |
| 406 | 406 |
| 407 enum WorkerPoolType : size_t { | 407 enum WorkerPoolType : size_t { |
| 408 BACKGROUND = 0, | 408 BACKGROUND = 0, |
| 409 BACKGROUND_FILE_IO, | 409 BACKGROUND_BLOCKING, |
| 410 FOREGROUND, | 410 FOREGROUND, |
| 411 FOREGROUND_FILE_IO, | 411 FOREGROUND_BLOCKING, |
| 412 WORKER_POOL_COUNT // Always last. | 412 WORKER_POOL_COUNT // Always last. |
| 413 }; | 413 }; |
| 414 | 414 |
| 415 std::vector<base::SchedulerWorkerPoolParams> | 415 std::vector<base::SchedulerWorkerPoolParams> |
| 416 GetDefaultSchedulerWorkerPoolParams() { | 416 GetDefaultSchedulerWorkerPoolParams() { |
| 417 using StandbyThreadPolicy = | 417 using StandbyThreadPolicy = |
| 418 base::SchedulerWorkerPoolParams::StandbyThreadPolicy; | 418 base::SchedulerWorkerPoolParams::StandbyThreadPolicy; |
| 419 using ThreadPriority = base::ThreadPriority; | 419 using ThreadPriority = base::ThreadPriority; |
| 420 std::vector<base::SchedulerWorkerPoolParams> params_vector; | 420 std::vector<base::SchedulerWorkerPoolParams> params_vector; |
| 421 #if defined(OS_ANDROID) | 421 #if defined(OS_ANDROID) |
| 422 params_vector.emplace_back( | 422 params_vector.emplace_back( |
| 423 "Background", ThreadPriority::BACKGROUND, StandbyThreadPolicy::ONE, | 423 "Background", ThreadPriority::BACKGROUND, StandbyThreadPolicy::ONE, |
| 424 base::RecommendedMaxNumberOfThreadsInPool(2, 8, 0.1, 0), | 424 base::RecommendedMaxNumberOfThreadsInPool(2, 8, 0.1, 0), |
| 425 base::TimeDelta::FromSeconds(30)); | 425 base::TimeDelta::FromSeconds(30)); |
| 426 params_vector.emplace_back( | 426 params_vector.emplace_back( |
| 427 "BackgroundFileIO", ThreadPriority::BACKGROUND, StandbyThreadPolicy::ONE, | 427 "BackgroundBlocking", ThreadPriority::BACKGROUND, |
| 428 base::RecommendedMaxNumberOfThreadsInPool(2, 8, 0.1, 0), | 428 StandbyThreadPolicy::ONE, |
| 429 base::TimeDelta::FromSeconds(30)); | 429 base::RecommendedMaxNumberOfThreadsInPool(2, 8, 0.1, 0), |
| 430 base::TimeDelta::FromSeconds(30)); | |
| 430 params_vector.emplace_back( | 431 params_vector.emplace_back( |
| 431 "Foreground", ThreadPriority::NORMAL, StandbyThreadPolicy::ONE, | 432 "Foreground", ThreadPriority::NORMAL, StandbyThreadPolicy::ONE, |
| 432 base::RecommendedMaxNumberOfThreadsInPool(3, 8, 0.3, 0), | 433 base::RecommendedMaxNumberOfThreadsInPool(3, 8, 0.3, 0), |
| 433 base::TimeDelta::FromSeconds(30)); | 434 base::TimeDelta::FromSeconds(30)); |
| 434 params_vector.emplace_back( | 435 params_vector.emplace_back( |
| 435 "ForegroundFileIO", ThreadPriority::NORMAL, StandbyThreadPolicy::ONE, | 436 "ForegroundBlocking", ThreadPriority::NORMAL, StandbyThreadPolicy::ONE, |
| 436 base::RecommendedMaxNumberOfThreadsInPool(3, 8, 0.1, 0), | 437 base::RecommendedMaxNumberOfThreadsInPool(3, 8, 0.3, 0), |
|
fdoray
2017/02/16 16:27:40
0.1 -> 0.3 to match the existing server default co
| |
| 437 base::TimeDelta::FromSeconds(30)); | 438 base::TimeDelta::FromSeconds(30)); |
| 438 #else | 439 #else |
| 439 params_vector.emplace_back( | 440 params_vector.emplace_back( |
| 440 "Background", ThreadPriority::BACKGROUND, StandbyThreadPolicy::ONE, | 441 "Background", ThreadPriority::BACKGROUND, StandbyThreadPolicy::ONE, |
| 441 base::RecommendedMaxNumberOfThreadsInPool(3, 8, 0.1, 0), | 442 base::RecommendedMaxNumberOfThreadsInPool(3, 8, 0.1, 0), |
| 442 base::TimeDelta::FromSeconds(30)); | 443 base::TimeDelta::FromSeconds(30)); |
| 443 params_vector.emplace_back( | 444 params_vector.emplace_back( |
| 444 "BackgroundFileIO", ThreadPriority::BACKGROUND, StandbyThreadPolicy::ONE, | 445 "BackgroundBlocking", ThreadPriority::BACKGROUND, |
| 445 base::RecommendedMaxNumberOfThreadsInPool(3, 8, 0.1, 0), | 446 StandbyThreadPolicy::ONE, |
| 446 base::TimeDelta::FromSeconds(30)); | 447 base::RecommendedMaxNumberOfThreadsInPool(3, 8, 0.1, 0), |
| 448 base::TimeDelta::FromSeconds(30)); | |
| 447 params_vector.emplace_back( | 449 params_vector.emplace_back( |
| 448 "Foreground", ThreadPriority::NORMAL, StandbyThreadPolicy::ONE, | 450 "Foreground", ThreadPriority::NORMAL, StandbyThreadPolicy::ONE, |
| 449 base::RecommendedMaxNumberOfThreadsInPool(8, 32, 0.3, 0), | 451 base::RecommendedMaxNumberOfThreadsInPool(8, 32, 0.3, 0), |
| 450 base::TimeDelta::FromSeconds(30)); | 452 base::TimeDelta::FromSeconds(30)); |
| 451 // Tasks posted to SequencedWorkerPool or BrowserThreadImpl may be redirected | 453 // Tasks posted to SequencedWorkerPool or BrowserThreadImpl may be redirected |
| 452 // to this pool. Since COM STA is initialized in these environments, it must | 454 // to this pool. Since COM STA is initialized in these environments, it must |
| 453 // also be initialized in this pool. | 455 // also be initialized in this pool. |
| 454 params_vector.emplace_back( | 456 params_vector.emplace_back( |
| 455 "ForegroundFileIO", ThreadPriority::NORMAL, StandbyThreadPolicy::ONE, | 457 "ForegroundBlocking", ThreadPriority::NORMAL, StandbyThreadPolicy::ONE, |
| 456 base::RecommendedMaxNumberOfThreadsInPool(8, 32, 0.3, 0), | 458 base::RecommendedMaxNumberOfThreadsInPool(8, 32, 0.3, 0), |
| 457 base::TimeDelta::FromSeconds(30), | 459 base::TimeDelta::FromSeconds(30), |
| 458 base::SchedulerBackwardCompatibility::INIT_COM_STA); | 460 base::SchedulerBackwardCompatibility::INIT_COM_STA); |
| 459 #endif | 461 #endif |
| 460 DCHECK_EQ(WORKER_POOL_COUNT, params_vector.size()); | 462 DCHECK_EQ(WORKER_POOL_COUNT, params_vector.size()); |
| 461 return params_vector; | 463 return params_vector; |
| 462 } | 464 } |
| 463 | 465 |
| 464 // Returns the worker pool index for |traits| defaulting to FOREGROUND or | 466 // Returns the worker pool index for |traits| defaulting to FOREGROUND or |
| 465 // FOREGROUND_FILE_IO on any other priorities based off of worker pools defined | 467 // FOREGROUND_BLOCKING on any other priorities based off of worker pools defined |
| 466 // in GetDefaultSchedulerWorkerPoolParams(). | 468 // in GetDefaultSchedulerWorkerPoolParams(). |
| 467 size_t DefaultBrowserWorkerPoolIndexForTraits(const base::TaskTraits& traits) { | 469 size_t DefaultBrowserWorkerPoolIndexForTraits(const base::TaskTraits& traits) { |
| 468 const bool is_background = | 470 const bool is_background = |
| 469 traits.priority() == base::TaskPriority::BACKGROUND; | 471 traits.priority() == base::TaskPriority::BACKGROUND; |
| 470 if (traits.may_block() || traits.with_base_sync_primitives()) | 472 if (traits.may_block() || traits.with_base_sync_primitives()) |
| 471 return is_background ? BACKGROUND_FILE_IO : FOREGROUND_FILE_IO; | 473 return is_background ? BACKGROUND_BLOCKING : FOREGROUND_BLOCKING; |
| 472 | 474 |
| 473 return is_background ? BACKGROUND : FOREGROUND; | 475 return is_background ? BACKGROUND : FOREGROUND; |
| 474 } | 476 } |
| 475 | 477 |
| 476 } // namespace | 478 } // namespace |
| 477 | 479 |
| 478 #if defined(USE_X11) && !defined(OS_CHROMEOS) | 480 #if defined(USE_X11) && !defined(OS_CHROMEOS) |
| 479 namespace internal { | 481 namespace internal { |
| 480 | 482 |
| 481 // Forwards GPUInfo updates to ui::XVisualManager | 483 // Forwards GPUInfo updates to ui::XVisualManager |
| (...skipping 1314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1796 audio_thread_->task_runner(), audio_thread_->worker_task_runner(), | 1798 audio_thread_->task_runner(), audio_thread_->worker_task_runner(), |
| 1797 MediaInternals::GetInstance()); | 1799 MediaInternals::GetInstance()); |
| 1798 } | 1800 } |
| 1799 CHECK(audio_manager_); | 1801 CHECK(audio_manager_); |
| 1800 | 1802 |
| 1801 audio_system_ = media::AudioSystemImpl::Create(audio_manager_.get()); | 1803 audio_system_ = media::AudioSystemImpl::Create(audio_manager_.get()); |
| 1802 CHECK(audio_system_); | 1804 CHECK(audio_system_); |
| 1803 } | 1805 } |
| 1804 | 1806 |
| 1805 } // namespace content | 1807 } // namespace content |
| OLD | NEW |