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

Side by Side Diff: base/message_pump_glib.h

Issue 115812: linux: fix main loop issues with windowless plugins (Closed)
Patch Set: Fixing comments Created 11 years, 6 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
« no previous file with comments | « no previous file | base/message_pump_glib.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) 2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2008 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_GLIB_H_ 5 #ifndef BASE_MESSAGE_PUMP_GLIB_H_
6 #define BASE_MESSAGE_PUMP_GLIB_H_ 6 #define BASE_MESSAGE_PUMP_GLIB_H_
7 7
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 #include <glib.h> 9 #include <glib.h>
10 10
(...skipping 24 matching lines...) Expand all
35 ~MessagePumpForUI(); 35 ~MessagePumpForUI();
36 36
37 virtual void Run(Delegate* delegate); 37 virtual void Run(Delegate* delegate);
38 virtual void Quit(); 38 virtual void Quit();
39 virtual void ScheduleWork(); 39 virtual void ScheduleWork();
40 virtual void ScheduleDelayedWork(const Time& delayed_work_time); 40 virtual void ScheduleDelayedWork(const Time& delayed_work_time);
41 41
42 // Internal methods used for processing the pump callbacks. They are 42 // Internal methods used for processing the pump callbacks. They are
43 // public for simplicity but should not be used directly. HandlePrepare 43 // public for simplicity but should not be used directly. HandlePrepare
44 // is called during the prepare step of glib, and returns a timeout that 44 // is called during the prepare step of glib, and returns a timeout that
45 // will be passed to the poll. HandleDispatch is called after the poll 45 // will be passed to the poll. HandleCheck is called after the poll
46 // has completed. 46 // has completed, and returns whether or not HandleDispatch should be called.
47 // HandleDispatch is called if HandleCheck returned true.
47 int HandlePrepare(); 48 int HandlePrepare();
49 bool HandleCheck();
48 void HandleDispatch(); 50 void HandleDispatch();
49 51
50 // Add an Observer, which will start receiving notifications immediately. 52 // Add an Observer, which will start receiving notifications immediately.
51 void AddObserver(Observer* observer); 53 void AddObserver(Observer* observer);
52 54
53 // Remove an Observer. It is safe to call this method while an Observer is 55 // Remove an Observer. It is safe to call this method while an Observer is
54 // receiving a notification callback. 56 // receiving a notification callback.
55 void RemoveObserver(Observer* observer); 57 void RemoveObserver(Observer* observer);
56 58
57 private: 59 private:
58 // We may make recursive calls to Run, so we save state that needs to be 60 // We may make recursive calls to Run, so we save state that needs to be
59 // separate between them in this structure type. 61 // separate between them in this structure type.
60 struct RunState { 62 struct RunState {
61 Delegate* delegate; 63 Delegate* delegate;
62 64
63 // Used to flag that the current Run() invocation should return ASAP. 65 // Used to flag that the current Run() invocation should return ASAP.
64 bool should_quit; 66 bool should_quit;
65 67
66 // Used to count how many Run() invocations are on the stack. 68 // Used to count how many Run() invocations are on the stack.
67 int run_depth; 69 int run_depth;
68 70
69 // Used internally for controlling whether we want a message pump 71 // This keeps the state of whether the pump got signaled that there was new
70 // iteration to be blocking or not. 72 // work to be done. Since we eat the message on the wake up pipe as soon as
71 bool more_work_is_plausible; 73 // we get it, we keep that state here to stay consistent.
74 bool has_work;
72 }; 75 };
73 76
74 // Invoked from EventDispatcher. Notifies all observers we're about to 77 // Invoked from EventDispatcher. Notifies all observers we're about to
75 // process an event. 78 // process an event.
76 void WillProcessEvent(GdkEvent* event); 79 void WillProcessEvent(GdkEvent* event);
77 80
78 // Invoked from EventDispatcher. Notifies all observers we processed an 81 // Invoked from EventDispatcher. Notifies all observers we processed an
79 // event. 82 // event.
80 void DidProcessEvent(GdkEvent* event); 83 void DidProcessEvent(GdkEvent* event);
81 84
(...skipping 24 matching lines...) Expand all
106 109
107 // List of observers. 110 // List of observers.
108 ObserverList<Observer> observers_; 111 ObserverList<Observer> observers_;
109 112
110 DISALLOW_COPY_AND_ASSIGN(MessagePumpForUI); 113 DISALLOW_COPY_AND_ASSIGN(MessagePumpForUI);
111 }; 114 };
112 115
113 } // namespace base 116 } // namespace base
114 117
115 #endif // BASE_MESSAGE_PUMP_GLIB_H_ 118 #endif // BASE_MESSAGE_PUMP_GLIB_H_
OLDNEW
« no previous file with comments | « no previous file | base/message_pump_glib.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698