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

Side by Side Diff: base/message_loop/message_pump_aurax11.h

Issue 17567007: Made MessagePump a non-thread safe class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 7 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_LOOP_MESSAGE_PUMP_AURAX11_H 5 #ifndef BASE_MESSAGE_LOOP_MESSAGE_PUMP_AURAX11_H
6 #define BASE_MESSAGE_LOOP_MESSAGE_PUMP_AURAX11_H 6 #define BASE_MESSAGE_LOOP_MESSAGE_PUMP_AURAX11_H
7 7
8 #include <bitset> 8 #include <bitset>
9 #include <map> 9 #include <map>
10 10
(...skipping 17 matching lines...) Expand all
28 28
29 // This class implements a message-pump for dispatching X events. 29 // This class implements a message-pump for dispatching X events.
30 // 30 //
31 // If there's a current dispatcher given through RunWithDispatcher(), that 31 // If there's a current dispatcher given through RunWithDispatcher(), that
32 // dispatcher receives events. Otherwise, we route to messages to dispatchers 32 // dispatcher receives events. Otherwise, we route to messages to dispatchers
33 // who have subscribed to messages from a specific X11 window. 33 // who have subscribed to messages from a specific X11 window.
34 class BASE_EXPORT MessagePumpAuraX11 : public MessagePumpGlib, 34 class BASE_EXPORT MessagePumpAuraX11 : public MessagePumpGlib,
35 public MessagePumpDispatcher { 35 public MessagePumpDispatcher {
36 public: 36 public:
37 MessagePumpAuraX11(); 37 MessagePumpAuraX11();
38 virtual ~MessagePumpAuraX11();
38 39
39 // Returns default X Display. 40 // Returns default X Display.
40 static Display* GetDefaultXDisplay(); 41 static Display* GetDefaultXDisplay();
41 42
42 // Returns true if the system supports XINPUT2. 43 // Returns true if the system supports XINPUT2.
43 static bool HasXInput2(); 44 static bool HasXInput2();
44 45
45 // Returns the UI message pump. 46 // Returns the UI message pump.
46 static MessagePumpAuraX11* Current(); 47 static MessagePumpAuraX11* Current();
47 48
(...skipping 17 matching lines...) Expand all
65 // xserver that |w| has been mapped; StructureNotifyMask events on |w| are 66 // xserver that |w| has been mapped; StructureNotifyMask events on |w| are
66 // pulled out from the queue and dispatched out of order. 67 // pulled out from the queue and dispatched out of order.
67 // 68 //
68 // For those that know X11, this is really a wrapper around XWindowEvent 69 // For those that know X11, this is really a wrapper around XWindowEvent
69 // which still makes sure the preempted event is dispatched instead of 70 // which still makes sure the preempted event is dispatched instead of
70 // dropped on the floor. This method exists because mapping a window is 71 // dropped on the floor. This method exists because mapping a window is
71 // asynchronous (and we receive an XEvent when mapped), while there are also 72 // asynchronous (and we receive an XEvent when mapped), while there are also
72 // functions which require a mapped window. 73 // functions which require a mapped window.
73 void BlockUntilWindowMapped(unsigned long xid); 74 void BlockUntilWindowMapped(unsigned long xid);
74 75
75 protected:
76 virtual ~MessagePumpAuraX11();
77
78 private: 76 private:
79 typedef std::map<unsigned long, MessagePumpDispatcher*> DispatchersMap; 77 typedef std::map<unsigned long, MessagePumpDispatcher*> DispatchersMap;
80 78
81 // Initializes the glib event source for X. 79 // Initializes the glib event source for X.
82 void InitXSource(); 80 void InitXSource();
83 81
84 // Dispatches the XEvent and returns true if we should exit the current loop 82 // Dispatches the XEvent and returns true if we should exit the current loop
85 // of message processing. 83 // of message processing.
86 bool ProcessXEvent(MessagePumpDispatcher* dispatcher, XEvent* event); 84 bool ProcessXEvent(MessagePumpDispatcher* dispatcher, XEvent* event);
87 85
(...skipping 25 matching lines...) Expand all
113 unsigned long x_root_window_; 111 unsigned long x_root_window_;
114 112
115 DISALLOW_COPY_AND_ASSIGN(MessagePumpAuraX11); 113 DISALLOW_COPY_AND_ASSIGN(MessagePumpAuraX11);
116 }; 114 };
117 115
118 typedef MessagePumpAuraX11 MessagePumpForUI; 116 typedef MessagePumpAuraX11 MessagePumpForUI;
119 117
120 } // namespace base 118 } // namespace base
121 119
122 #endif // BASE_MESSAGE_LOOP_MESSAGE_PUMP_AURAX11_H 120 #endif // BASE_MESSAGE_LOOP_MESSAGE_PUMP_AURAX11_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698