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

Side by Side Diff: ui/wayland/wayland_message_pump.h

Issue 7457023: Adding a Wayland basic toolkit (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Removed the WaylandDisplay singleton Created 9 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 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 #ifndef UI_WAYLAND_WAYLAND_MESSAGE_PUMP_H_
6 #define UI_WAYLAND_WAYLAND_MESSAGE_PUMP_H_
7
8 #include <glib.h>
9 #include <stdint.h>
10
11 #include "base/basictypes.h"
12
13 class WaylandDisplay;
14
15 // The message pump handles Wayland specific event delivery. This message
16 // pump uses the default glib context, so running a glib main loop with the
17 // default context will allow looping through Wayland events.
18 class WaylandMessagePump {
19 public:
20 WaylandMessagePump(WaylandDisplay* display);
21 virtual ~WaylandMessagePump();
22
23 protected:
24 // These are used to process the pump callbacks.
25 // HandlePrepare: is called during glib's prepare step and returns a timeout
26 // that will be passed to the poll.
27 // HandleCheck: called after HandlePrepare and returns whether
28 // HandleDispatch should be called.
29 // HandleDispatch:is called after HandleCheck returns true and it will
30 // dispatch a Wayland event.
31 virtual int HandlePrepare();
32 virtual bool HandleCheck();
33 virtual void HandleDispatch();
34 private:
35 struct WorkSource : public GSource {
36 WaylandMessagePump* pump;
37 };
38
39 // Actual callbacks for glib. These functions will just call the appropriate
40 // Handle* functions in a WaylandMessagePump object.
41 static gboolean SourcePrepare(GSource* source, gint* timeout);
42 static gboolean SourceCheck(GSource* source);
43 static gboolean SourceDispatch(GSource* source,
44 GSourceFunc callback,
45 gpointer data);
46 // Handles updates to the Wayland mask. This is used to signal when the
47 // compositor is done processing writable events.
48 static int SourceUpdate(uint32_t mask, void* data);
49
50 WaylandDisplay* display_;
51 WorkSource* source_;
52 GPollFD pfd_;
53 uint32_t mask_;
54
55 DISALLOW_COPY_AND_ASSIGN(WaylandMessagePump);
56 };
57
58 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698