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

Side by Side Diff: components/task_scheduler_util/browser/initialization.cc

Issue 2629583003: Remove TaskTraits::with_file_io(). (Closed)
Patch Set: Created 3 years, 11 months 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
« no previous file with comments | « base/task_scheduler/task_traits.h ('k') | content/browser/browser_main_loop.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "components/task_scheduler_util/browser/initialization.h" 5 #include "components/task_scheduler_util/browser/initialization.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 DCHECK_EQ(FOREGROUND_FILE_IO, constant_worker_pool_params.size()); 53 DCHECK_EQ(FOREGROUND_FILE_IO, constant_worker_pool_params.size());
54 constant_worker_pool_params.emplace_back("ForegroundFileIO", 54 constant_worker_pool_params.emplace_back("ForegroundFileIO",
55 ThreadPriority::NORMAL); 55 ThreadPriority::NORMAL);
56 56
57 return GetWorkerPoolParams(constant_worker_pool_params, variation_params); 57 return GetWorkerPoolParams(constant_worker_pool_params, variation_params);
58 } 58 }
59 59
60 size_t BrowserWorkerPoolIndexForTraits(const base::TaskTraits& traits) { 60 size_t BrowserWorkerPoolIndexForTraits(const base::TaskTraits& traits) {
61 const bool is_background = 61 const bool is_background =
62 traits.priority() == base::TaskPriority::BACKGROUND; 62 traits.priority() == base::TaskPriority::BACKGROUND;
63 if (traits.with_file_io()) 63 if (traits.may_block() || traits.with_base_sync_primitives())
64 return is_background ? BACKGROUND_FILE_IO : FOREGROUND_FILE_IO; 64 return is_background ? BACKGROUND_FILE_IO : FOREGROUND_FILE_IO;
65 return is_background ? BACKGROUND : FOREGROUND; 65 return is_background ? BACKGROUND : FOREGROUND;
66 } 66 }
67 67
68 void MaybePerformBrowserTaskSchedulerRedirection() { 68 void MaybePerformBrowserTaskSchedulerRedirection() {
69 // TODO(gab): Remove this when http://crbug.com/622400 concludes. 69 // TODO(gab): Remove this when http://crbug.com/622400 concludes.
70 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( 70 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
71 switches::kDisableBrowserTaskScheduler) && 71 switches::kDisableBrowserTaskScheduler) &&
72 variations::GetVariationParamValue( 72 variations::GetVariationParamValue(
73 kFieldTrialName, "RedirectSequencedWorkerPools") == "true") { 73 kFieldTrialName, "RedirectSequencedWorkerPools") == "true") {
74 const base::TaskPriority max_task_priority = 74 const base::TaskPriority max_task_priority =
75 variations::GetVariationParamValue( 75 variations::GetVariationParamValue(
76 kFieldTrialName, "CapSequencedWorkerPoolsAtUserVisible") == "true" 76 kFieldTrialName, "CapSequencedWorkerPoolsAtUserVisible") == "true"
77 ? base::TaskPriority::USER_VISIBLE 77 ? base::TaskPriority::USER_VISIBLE
78 : base::TaskPriority::HIGHEST; 78 : base::TaskPriority::HIGHEST;
79 base::SequencedWorkerPool::EnableWithRedirectionToTaskSchedulerForProcess( 79 base::SequencedWorkerPool::EnableWithRedirectionToTaskSchedulerForProcess(
80 max_task_priority); 80 max_task_priority);
81 } 81 }
82 } 82 }
83 83
84 } // namespace task_scheduler_util 84 } // namespace task_scheduler_util
OLDNEW
« no previous file with comments | « base/task_scheduler/task_traits.h ('k') | content/browser/browser_main_loop.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698