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