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

Side by Side Diff: base/task_scheduler/task_traits.cc

Issue 2871973003: Remove methods associated with the builder pattern from TaskTraits. (Closed)
Patch Set: immutable Created 3 years, 7 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') | no next file » | 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 "base/task_scheduler/task_traits.h" 5 #include "base/task_scheduler/task_traits.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <ostream> 9 #include <ostream>
10 10
11 #include "base/logging.h" 11 #include "base/logging.h"
12 12
13 namespace base { 13 namespace base {
14 14
15 TaskTraits& TaskTraits::MayBlock() {
16 may_block_ = true;
17 return *this;
18 }
19
20 TaskTraits& TaskTraits::WithBaseSyncPrimitives() {
21 with_base_sync_primitives_ = true;
22 return *this;
23 }
24
25 TaskTraits& TaskTraits::WithPriority(TaskPriority priority) {
26 priority_set_explicitly_ = true;
27 priority_ = priority;
28 return *this;
29 }
30
31 TaskTraits& TaskTraits::WithShutdownBehavior(
32 TaskShutdownBehavior shutdown_behavior) {
33 shutdown_behavior_ = shutdown_behavior;
34 return *this;
35 }
36
37 const char* TaskPriorityToString(TaskPriority task_priority) { 15 const char* TaskPriorityToString(TaskPriority task_priority) {
38 switch (task_priority) { 16 switch (task_priority) {
39 case TaskPriority::BACKGROUND: 17 case TaskPriority::BACKGROUND:
40 return "BACKGROUND"; 18 return "BACKGROUND";
41 case TaskPriority::USER_VISIBLE: 19 case TaskPriority::USER_VISIBLE:
42 return "USER_VISIBLE"; 20 return "USER_VISIBLE";
43 case TaskPriority::USER_BLOCKING: 21 case TaskPriority::USER_BLOCKING:
44 return "USER_BLOCKING"; 22 return "USER_BLOCKING";
45 } 23 }
46 NOTREACHED(); 24 NOTREACHED();
(...skipping 19 matching lines...) Expand all
66 return os; 44 return os;
67 } 45 }
68 46
69 std::ostream& operator<<(std::ostream& os, 47 std::ostream& operator<<(std::ostream& os,
70 const TaskShutdownBehavior& shutdown_behavior) { 48 const TaskShutdownBehavior& shutdown_behavior) {
71 os << TaskShutdownBehaviorToString(shutdown_behavior); 49 os << TaskShutdownBehaviorToString(shutdown_behavior);
72 return os; 50 return os;
73 } 51 }
74 52
75 } // namespace base 53 } // namespace base
OLDNEW
« no previous file with comments | « base/task_scheduler/task_traits.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698