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

Side by Side Diff: base/message_pump_wayland.h

Issue 8872055: Refactor MessagePumpX to dispatch events inside of the source Dispatch function. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: allow recurse Created 9 years 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
« no previous file with comments | « base/message_pump_gtk.cc ('k') | base/message_pump_wayland.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef BASE_MESSAGE_PUMP_WAYLAND_H_ 5 #ifndef BASE_MESSAGE_PUMP_WAYLAND_H_
6 #define BASE_MESSAGE_PUMP_WAYLAND_H_ 6 #define BASE_MESSAGE_PUMP_WAYLAND_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_pump_glib.h" 10 #include "base/message_pump_glib.h"
11 #include "base/message_pump_observer.h" 11 #include "base/message_pump_observer.h"
12 12
13 typedef struct _GMainContext GMainContext;
14 typedef struct _GPollFD GPollFD;
15 typedef struct _GSource GSource;
16
17 namespace base { 13 namespace base {
18 14
19 namespace wayland { 15 namespace wayland {
20 union WaylandEvent; 16 union WaylandEvent;
21 } 17 }
22 18
23 // The documentation for this class is in message_pump_glib.h 19 // The documentation for this class is in message_pump_glib.h
24 // 20 //
25 // The nested loop is exited by either posting a quit, or returning false 21 // The nested loop is exited by either posting a quit, or returning false
26 // from Dispatch. 22 // from Dispatch.
27 class MessagePumpDispatcher { 23 class MessagePumpDispatcher {
28 public: 24 public:
29 enum DispatchStatus { 25 enum DispatchStatus {
30 EVENT_IGNORED, // The event was not processed. 26 EVENT_IGNORED, // The event was not processed.
31 EVENT_PROCESSED, // The event has been processed. 27 EVENT_PROCESSED, // The event has been processed.
32 EVENT_QUIT // The event was processed and the message-loop should 28 EVENT_QUIT // The event was processed and the message-loop should
33 // terminate. 29 // terminate.
34 }; 30 };
35 31
36 // Dispatches the event. If true is returned processing continues as 32 // Dispatches the event. If true is returned processing continues as
37 // normal. If false is returned, the nested loop exits immediately. 33 // normal. If false is returned, the nested loop exits immediately.
38 virtual DispatchStatus Dispatch(wayland::WaylandEvent* event) = 0; 34 virtual DispatchStatus Dispatch(wayland::WaylandEvent* event) = 0;
39 35
40 protected: 36 protected:
41 virtual ~MessagePumpDispatcher() {} 37 virtual ~MessagePumpDispatcher() {}
42 }; 38 };
43 39
44 class BASE_EXPORT MessagePumpWayland : public MessagePumpGlib { 40 typedef MessagePumpGlib MessagePumpForUI;
45
46 public:
47 MessagePumpWayland();
48 virtual ~MessagePumpWayland();
49
50 // Overridden from MessagePumpGlib
51 virtual bool RunOnce(GMainContext* context, bool block) OVERRIDE;
52 private:
53
54 // This is a GLib structure that we can add event sources to.
55 GMainContext* context_;
56
57 DISALLOW_COPY_AND_ASSIGN(MessagePumpWayland);
58 };
59
60 typedef MessagePumpWayland MessagePumpForUI;
61 41
62 } // namespace base 42 } // namespace base
63 43
64 #endif // BASE_MESSAGE_PUMP_WAYLAND_H_ 44 #endif // BASE_MESSAGE_PUMP_WAYLAND_H_
OLDNEW
« no previous file with comments | « base/message_pump_gtk.cc ('k') | base/message_pump_wayland.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698