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

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

Issue 2831883003: Do not inherit TaskPriority in TaskTraits. (Closed)
Patch Set: CR-gab-9 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
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 #include "base/task_scheduler/scoped_set_task_priority_for_current_thread.h" 12 #include "base/task_scheduler/scoped_set_task_priority_for_current_thread.h"
13 13
14 namespace base { 14 namespace base {
15 15
16 // Do not rely on defaults hard-coded below beyond the guarantees described in 16 // Do not rely on defaults hard-coded below beyond the guarantees described in
17 // the header; anything else is subject to change. Tasks should explicitly 17 // the header; anything else is subject to change. Tasks should explicitly
18 // request defaults if the behavior is critical to the task. 18 // request defaults if the behavior is critical to the task.
19 TaskTraits::TaskTraits() 19 TaskTraits::TaskTraits()
20 : may_block_(false), 20 : may_block_(false),
21 with_base_sync_primitives_(false), 21 with_base_sync_primitives_(false),
22 priority_set_explicitly_(false),
gab 2017/04/25 17:16:41 Should be set to true in .WithPriority()?
fdoray 2017/04/25 17:57:48 Sorry bad merge.
22 priority_(internal::GetTaskPriorityForCurrentThread()), 23 priority_(internal::GetTaskPriorityForCurrentThread()),
gab 2017/04/25 17:16:41 This doesn't match CL desc.
fdoray 2017/04/25 17:57:48 Sorry bad merge.
23 shutdown_behavior_(TaskShutdownBehavior::SKIP_ON_SHUTDOWN) {} 24 shutdown_behavior_(TaskShutdownBehavior::SKIP_ON_SHUTDOWN) {}
gab 2017/04/25 17:16:41 Use inline member initialization in header for all
fdoray 2017/04/25 17:57:48 We have to choose between initialization in header
gab 2017/04/25 18:01:21 Fast-access matters more than bit savings IMO (i.e
24 25
25 TaskTraits::~TaskTraits() = default; 26 TaskTraits::~TaskTraits() = default;
26 27
27 TaskTraits& TaskTraits::MayBlock() { 28 TaskTraits& TaskTraits::MayBlock() {
28 may_block_ = true; 29 may_block_ = true;
29 return *this; 30 return *this;
30 } 31 }
31 32
32 TaskTraits& TaskTraits::WithBaseSyncPrimitives() { 33 TaskTraits& TaskTraits::WithBaseSyncPrimitives() {
33 with_base_sync_primitives_ = true; 34 with_base_sync_primitives_ = true;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 return os; 78 return os;
78 } 79 }
79 80
80 std::ostream& operator<<(std::ostream& os, 81 std::ostream& operator<<(std::ostream& os,
81 const TaskShutdownBehavior& shutdown_behavior) { 82 const TaskShutdownBehavior& shutdown_behavior) {
82 os << TaskShutdownBehaviorToString(shutdown_behavior); 83 os << TaskShutdownBehaviorToString(shutdown_behavior);
83 return os; 84 return os;
84 } 85 }
85 86
86 } // namespace base 87 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698