1 // Copyright 2018 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "components/exo/wayland/wayland_watcher.h" 6 7 #include "base/task/current_thread.h" 8 #include "components/exo/wayland/server.h" 9 10 namespace exo { 11 namespace wayland { 12 WaylandWatcher(wayland::Server * server)13WaylandWatcher::WaylandWatcher(wayland::Server* server) 14 : controller_(FROM_HERE), server_(server) { 15 base::CurrentUIThread::Get()->WatchFileDescriptor( 16 server_->GetFileDescriptor(), 17 true, // persistent 18 base::MessagePumpForUI::WATCH_READ, &controller_, this); 19 } 20 ~WaylandWatcher()21WaylandWatcher::~WaylandWatcher() {} 22 OnFileCanReadWithoutBlocking(int fd)23void WaylandWatcher::OnFileCanReadWithoutBlocking(int fd) { 24 server_->Dispatch(base::TimeDelta()); 25 server_->Flush(); 26 } 27 OnFileCanWriteWithoutBlocking(int fd)28void WaylandWatcher::OnFileCanWriteWithoutBlocking(int fd) { 29 NOTREACHED(); 30 } 31 32 } // namespace wayland 33 } // namespace exo 34