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

Unified Diff: ui/ozone/platform/drm/host/drm_display_host_manager.cc

Issue 2603153003: Use TaskScheduler instead of WorkerPool in drm_display_host_manager.cc. (Closed)
Patch Set: Created 3 years, 12 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/ozone/platform/drm/host/drm_display_host_manager.cc
diff --git a/ui/ozone/platform/drm/host/drm_display_host_manager.cc b/ui/ozone/platform/drm/host/drm_display_host_manager.cc
index edc62b64d21308e809b7e8eb97e76505e0baaa11..b4e7dd3c0e47745efa0097d4e982ed2bd4e9ed77 100644
--- a/ui/ozone/platform/drm/host/drm_display_host_manager.cc
+++ b/ui/ozone/platform/drm/host/drm_display_host_manager.cc
@@ -14,9 +14,9 @@
#include "base/files/file_util.h"
#include "base/memory/ptr_util.h"
#include "base/strings/stringprintf.h"
+#include "base/task_scheduler/post_task.h"
#include "base/threading/thread_restrictions.h"
#include "base/threading/thread_task_runner_handle.h"
-#include "base/threading/worker_pool.h"
#include "ui/display/types/display_snapshot.h"
#include "ui/events/ozone/device/device_event.h"
#include "ui/events/ozone/device/device_manager.h"
@@ -52,10 +52,9 @@ base::FilePath MapDevPathToSysPath(const base::FilePath& device_path) {
base::FilePath("/sys/class/drm").Append(device_path.BaseName()));
}
-void OpenDeviceOnWorkerThread(
- const base::FilePath& device_path,
- const scoped_refptr<base::TaskRunner>& reply_runner,
- const OnOpenDeviceReplyCallback& callback) {
+void OpenDeviceAsync(const base::FilePath& device_path,
+ const scoped_refptr<base::TaskRunner>& reply_runner,
+ const OnOpenDeviceReplyCallback& callback) {
base::FilePath sys_path = MapDevPathToSysPath(device_path);
std::unique_ptr<DrmDeviceHandle> handle(new DrmDeviceHandle());
@@ -245,13 +244,17 @@ void DrmDisplayHostManager::ProcessEvent() {
switch (event.action_type) {
case DeviceEvent::ADD:
if (drm_devices_.find(event.path) == drm_devices_.end()) {
- task_pending_ = base::WorkerPool::PostTask(
+ base::PostTaskWithTraits(
FROM_HERE,
- base::Bind(&OpenDeviceOnWorkerThread, event.path,
+ base::TaskTraits()
+ .WithShutdownBehavior(
+ base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN)
+ .MayBlock(),
+ base::Bind(&OpenDeviceAsync, event.path,
base::ThreadTaskRunnerHandle::Get(),
base::Bind(&DrmDisplayHostManager::OnAddGraphicsDevice,
- weak_ptr_factory_.GetWeakPtr())),
- false /* task_is_slow */);
+ weak_ptr_factory_.GetWeakPtr())));
+ task_pending_ = true;
}
break;
case DeviceEvent::CHANGE:
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698