Chromium Code Reviews| Index: ui/ozone/platform/dri/dri_wrapper.cc |
| diff --git a/ui/ozone/platform/dri/dri_wrapper.cc b/ui/ozone/platform/dri/dri_wrapper.cc |
| index 929dd27d8a45fd88f38269c6d35a38dac9530113..14939ac527217593264d1daeff3572b16d6a4af5 100644 |
| --- a/ui/ozone/platform/dri/dri_wrapper.cc |
| +++ b/ui/ozone/platform/dri/dri_wrapper.cc |
| @@ -19,6 +19,7 @@ |
| #include "third_party/skia/include/core/SkImageInfo.h" |
| #include "ui/ozone/platform/dri/dri_util.h" |
| #include "ui/ozone/platform/dri/hardware_display_plane_manager_legacy.h" |
| +#include "ui/ozone/platform/dri/io_helper_thread.h" |
| namespace ui { |
| @@ -144,11 +145,8 @@ class DriWrapper::IOWatcher |
| DISALLOW_COPY_AND_ASSIGN(IOWatcher); |
| }; |
| -DriWrapper::DriWrapper(const char* device_path, bool use_sync_flips) |
| - : fd_(-1), |
| - use_sync_flips_(use_sync_flips), |
| - device_path_(device_path), |
| - io_thread_("DriIOThread") { |
| +DriWrapper::DriWrapper(const char* device_path, IOHelperThread* io_thread) |
| + : fd_(-1), device_path_(device_path), io_thread_(io_thread) { |
| plane_manager_.reset(new HardwareDisplayPlaneManagerLegacy()); |
| } |
| @@ -169,13 +167,11 @@ void DriWrapper::Initialize() { |
| } |
| void DriWrapper::InitializeIOWatcher() { |
| - if (!use_sync_flips_ && !watcher_) { |
| - if (!io_thread_.StartWithOptions( |
| - base::Thread::Options(base::MessageLoop::TYPE_IO, 0))) |
| - LOG(FATAL) << "Failed to start the IO helper thread"; |
| + if (!io_thread_->IsRunning()) |
|
alexst (slow to review)
2015/01/22 15:27:48
We should do this in https://code.google.com/p/chr
dnicoara
2015/01/22 22:50:14
Done.
|
| + io_thread_->Initialize(); |
| - watcher_ = new IOWatcher(fd_, io_thread_.task_runner()); |
| - } |
| + if (!watcher_) |
| + watcher_ = new IOWatcher(fd_, io_thread_->task_runner()); |
| } |
| ScopedDrmCrtcPtr DriWrapper::GetCrtc(uint32_t crtc_id) { |
| @@ -278,7 +274,7 @@ bool DriWrapper::PageFlip(uint32_t crtc_id, |
| payload.get())) { |
| // If successful the payload will be removed by a PageFlip event. |
| ignore_result(payload.release()); |
| - if (use_sync_flips_) { |
| + if (!io_thread_) { |
| TRACE_EVENT1("dri", "OnDrmEvent", "socket", fd_); |
| drmEventContext event; |