1 // Copyright 2013 Intel Corporation. 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.
5 #ifndef OZONE_WAYLAND_DISPLAY_POLL_THREAD_H_
6 #define OZONE_WAYLAND_DISPLAY_POLL_THREAD_H_
8 #include "base/synchronization/waitable_event.h"
9 #include "base/threading/thread.h"
12 namespace ozonewayland {
13 // This class lets you poll on a given Wayland display (passed in constructor),
14 // read any pending events coming from Wayland compositor and dispatch them.
15 // Caller should ensure that StopProcessingEvents is called before display is
17 class WaylandDisplayPollThread : public base::Thread {
19 explicit WaylandDisplayPollThread(wl_display* display);
20 ~WaylandDisplayPollThread() override;
22 // Starts polling on wl_display fd and read/flush requests coming from Wayland
24 void StartProcessingEvents();
25 // Stops polling and handling of any events from Wayland compositor.
26 void StopProcessingEvents();
29 void CleanUp() override;
32 static void DisplayRun(WaylandDisplayPollThread* data);
33 base::WaitableEvent polling_; // Is set as long as the thread is polling.
34 base::WaitableEvent stop_polling_;
36 DISALLOW_COPY_AND_ASSIGN(WaylandDisplayPollThread);
39 } // namespace ozonewayland