Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(167)

Side by Side Diff: content/public/browser/content_browser_client.cc

Issue 2539263003: Move Task Scheduler Initialization From chrome/browser to Content (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/public/browser/content_browser_client.h" 5 #include "content/public/browser/content_browser_client.h"
6 6
7 #include "base/bind.h"
7 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
8 #include "base/guid.h" 9 #include "base/guid.h"
10 #include "base/task_scheduler/initialization_util.h"
11 #include "base/task_scheduler/scheduler_worker_pool_params.h"
12 #include "base/time/time.h"
9 #include "build/build_config.h" 13 #include "build/build_config.h"
10 #include "content/public/browser/client_certificate_delegate.h" 14 #include "content/public/browser/client_certificate_delegate.h"
11 #include "content/public/browser/memory_coordinator_delegate.h" 15 #include "content/public/browser/memory_coordinator_delegate.h"
12 #include "content/public/browser/navigation_ui_data.h" 16 #include "content/public/browser/navigation_ui_data.h"
13 #include "content/public/browser/vpn_service_proxy.h" 17 #include "content/public/browser/vpn_service_proxy.h"
14 #include "content/public/common/sandbox_type.h" 18 #include "content/public/common/sandbox_type.h"
15 #include "media/base/cdm_factory.h" 19 #include "media/base/cdm_factory.h"
16 #include "media/media_features.h" 20 #include "media/media_features.h"
17 #include "storage/browser/quota/quota_manager.h" 21 #include "storage/browser/quota/quota_manager.h"
18 #include "ui/gfx/image/image_skia.h" 22 #include "ui/gfx/image/image_skia.h"
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 std::unique_ptr<base::Value> ContentBrowserClient::GetServiceManifestOverlay( 431 std::unique_ptr<base::Value> ContentBrowserClient::GetServiceManifestOverlay(
428 const std::string& name) { 432 const std::string& name) {
429 return nullptr; 433 return nullptr;
430 } 434 }
431 435
432 std::unique_ptr<MemoryCoordinatorDelegate> 436 std::unique_ptr<MemoryCoordinatorDelegate>
433 ContentBrowserClient::GetMemoryCoordinatorDelegate() { 437 ContentBrowserClient::GetMemoryCoordinatorDelegate() {
434 return std::unique_ptr<MemoryCoordinatorDelegate>(); 438 return std::unique_ptr<MemoryCoordinatorDelegate>();
435 } 439 }
436 440
441 void ContentBrowserClient::GetTaskSchedulerInitializationParams(
442 std::vector<base::SchedulerWorkerPoolParams>* params_vector,
443 base::TaskScheduler::WorkerPoolIndexForTraitsCallback*
444 index_to_traits_callback) {
445 enum WorkerPoolType : size_t {
446 BACKGROUND_WORKER_POOL = 0,
447 BACKGROUND_FILE_IO_WORKER_POOL,
448 FOREGROUND_WORKER_POOL,
449 FOREGROUND_FILE_IO_WORKER_POOL,
450 WORKER_POOL_COUNT // Always last.
451 };
452 using IORestriction = base::SchedulerWorkerPoolParams::IORestriction;
453 using StandbyThreadPolicy =
454 base::SchedulerWorkerPoolParams::StandbyThreadPolicy;
455 using ThreadPriority = base::ThreadPriority;
456 params_vector->emplace_back(
457 "Background", ThreadPriority::BACKGROUND, IORestriction::DISALLOWED,
458 StandbyThreadPolicy::ONE,
459 base::RecommendedMaxNumberOfThreadsInPool(3, 8, 0.1, 0),
460 base::TimeDelta::FromSeconds(30));
461 params_vector->emplace_back(
462 "BackgroundFileIO", ThreadPriority::BACKGROUND, IORestriction::ALLOWED,
463 StandbyThreadPolicy::ONE,
464 base::RecommendedMaxNumberOfThreadsInPool(3, 8, 0.1, 0),
465 base::TimeDelta::FromSeconds(30));
466 params_vector->emplace_back(
467 "Foreground", ThreadPriority::NORMAL, IORestriction::DISALLOWED,
468 StandbyThreadPolicy::ONE,
469 base::RecommendedMaxNumberOfThreadsInPool(8, 32, 0.3, 0),
470 base::TimeDelta::FromSeconds(30));
471 params_vector->emplace_back(
472 "ForegroundFileIO", ThreadPriority::NORMAL, IORestriction::ALLOWED,
473 StandbyThreadPolicy::ONE,
474 base::RecommendedMaxNumberOfThreadsInPool(8, 32, 0.3, 0),
475 base::TimeDelta::FromSeconds(30));
476 DCHECK(params_vector->size() == WorkerPoolType::WORKER_POOL_COUNT);
gab 2016/11/30 22:36:58 DCHECK_EQ
robliao 2016/12/06 01:31:30 Done.
477 *index_to_traits_callback = base::Bind(
478 [](const base::TaskTraits& traits) -> size_t {
479 const bool is_background =
480 traits.priority() == base::TaskPriority::BACKGROUND;
481 if (traits.with_file_io()) {
482 return is_background ? BACKGROUND_FILE_IO_WORKER_POOL
483 : FOREGROUND_FILE_IO_WORKER_POOL;
484 }
485 return is_background ? BACKGROUND_WORKER_POOL : FOREGROUND_WORKER_POOL;
486 });
487 }
488
437 } // namespace content 489 } // namespace content
OLDNEW
« content/browser/browser_main_loop.cc ('K') | « content/public/browser/content_browser_client.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698