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

Unified Diff: device/usb/usb_service.h

Issue 2864473002: Declare TaskTraits for blocking USB tasks in a constexpr (Closed)
Patch Set: Rebased 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | device/usb/usb_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/usb/usb_service.h
diff --git a/device/usb/usb_service.h b/device/usb/usb_service.h
index b8c4ffa0ca4201dc8243b6b76933d9ab8f3bbd00..2ac6bb8799feb144fa6df51f9d6b0f14b9a7e03f 100644
--- a/device/usb/usb_service.h
+++ b/device/usb/usb_service.h
@@ -18,6 +18,7 @@
#include "base/observer_list.h"
#include "base/sequenced_task_runner.h"
#include "base/single_thread_task_runner.h"
+#include "base/task_scheduler/task_traits.h"
#include "base/threading/non_thread_safe.h"
namespace device {
@@ -49,10 +50,16 @@ class UsbService : public base::NonThreadSafe {
virtual void WillDestroyUsbService();
};
+ // These task traits are to be used for posting blocking tasks to the task
+ // scheduler.
+ static constexpr base::TaskTraits kBlockingTaskTraits = {
+ base::MayBlock(), base::TaskPriority::USER_VISIBLE,
+ base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN};
+
// Returns nullptr when initialization fails.
static std::unique_ptr<UsbService> Create();
- // Creates a SequencedTaskRunner appropriate for blocking I/O operations.
+ // Creates a SequencedTaskRunner with kBlockingTaskTraits.
static scoped_refptr<base::SequencedTaskRunner> CreateBlockingTaskRunner();
virtual ~UsbService();
« no previous file with comments | « no previous file | device/usb/usb_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698