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

Unified Diff: ui/ozone/platform/wayland/fake_server.cc

Issue 2431123003: Revert of Use FileDescriptorWatcher in wl::FakeServer. (patchset #1 id:1 of https://codereview.chro… (Closed)
Patch Set: Created 4 years, 2 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 | « ui/ozone/platform/wayland/fake_server.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/ozone/platform/wayland/fake_server.cc
diff --git a/ui/ozone/platform/wayland/fake_server.cc b/ui/ozone/platform/wayland/fake_server.cc
index 1e02b3335d13de611146a4c73b57fd00eb961555..52424c96365ad96abe238f5ac099b637028945ff 100644
--- a/ui/ozone/platform/wayland/fake_server.cc
+++ b/ui/ozone/platform/wayland/fake_server.cc
@@ -367,12 +367,10 @@ bool FakeServer::Start() {
(void)server_fd.release();
base::Thread::Options options;
- options.message_loop_type = MessageLoop::TYPE_IO;
+ options.message_pump_factory =
+ base::Bind(&FakeServer::CreateMessagePump, base::Unretained(this));
if (!base::Thread::StartWithOptions(options))
return false;
- task_runner()->PostTask(FROM_HERE,
- base::Bind(&FakeServer::StartWatchingFileDescriptor,
- base::Unretained(this)));
setenv("WAYLAND_SOCKET", base::UintToString(client_fd.release()).c_str(), 1);
@@ -397,17 +395,19 @@ void FakeServer::DoPause() {
resume_event_.Wait();
}
-void FakeServer::StartWatchingFileDescriptor() {
- controller_ = base::FileDescriptorWatcher::WatchReadable(
- wl_event_loop_get_fd(event_loop_),
- base::Bind(&FakeServer::OnFileCanReadWithoutBlocking,
- base::Unretained(this)));
+std::unique_ptr<base::MessagePump> FakeServer::CreateMessagePump() {
+ auto pump = base::WrapUnique(new base::MessagePumpLibevent);
+ pump->WatchFileDescriptor(wl_event_loop_get_fd(event_loop_), true,
+ base::MessagePumpLibevent::WATCH_READ, &controller_,
+ this);
+ return std::move(pump);
}
-void FakeServer::OnFileCanReadWithoutBlocking() {
+void FakeServer::OnFileCanReadWithoutBlocking(int fd) {
wl_event_loop_dispatch(event_loop_, 0);
wl_display_flush_clients(display_.get());
}
+void FakeServer::OnFileCanWriteWithoutBlocking(int fd) {}
} // namespace wl
« no previous file with comments | « ui/ozone/platform/wayland/fake_server.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698