Resize destination bus to the actual number of decoded frames.
[chromium-blink-merge.git] / base / message_loop / message_pump_gtk.h
blob947ab885afec34a61b2249c98c223da7af89eaff
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
3 // found in the LICENSE file.
5 #ifndef BASE_MESSAGE_LOOP_MESSAGE_PUMP_GTK_H_
6 #define BASE_MESSAGE_LOOP_MESSAGE_PUMP_GTK_H_
8 #include "base/message_loop/message_pump_glib.h"
10 typedef union _GdkEvent GdkEvent;
11 typedef struct _XDisplay Display;
13 namespace base {
15 // The documentation for this class is in message_pump_glib.h
16 class MessagePumpObserver {
17 public:
18 // This method is called before processing a message.
19 virtual void WillProcessEvent(GdkEvent* event) = 0;
21 // This method is called after processing a message.
22 virtual void DidProcessEvent(GdkEvent* event) = 0;
24 protected:
25 virtual ~MessagePumpObserver() {}
28 // The documentation for this class is in message_pump_glib.h
30 // The nested loop is exited by either posting a quit, or returning false
31 // from Dispatch.
32 class MessagePumpDispatcher {
33 public:
34 // Dispatches the event. If true is returned processing continues as
35 // normal. If false is returned, the nested loop exits immediately.
36 virtual bool Dispatch(GdkEvent* event) = 0;
38 protected:
39 virtual ~MessagePumpDispatcher() {}
42 // This class implements a message-pump for dispatching GTK events.
43 class BASE_EXPORT MessagePumpGtk : public MessagePumpGlib {
44 public:
45 MessagePumpGtk();
46 virtual ~MessagePumpGtk();
48 // Dispatch an available GdkEvent. Essentially this allows a subclass to do
49 // some task before/after calling the default handler (EventDispatcher).
50 void DispatchEvents(GdkEvent* event);
52 // Returns default X Display.
53 static Display* GetDefaultXDisplay();
55 private:
56 // Invoked from EventDispatcher. Notifies all observers we're about to
57 // process an event.
58 void WillProcessEvent(GdkEvent* event);
60 // Invoked from EventDispatcher. Notifies all observers we processed an
61 // event.
62 void DidProcessEvent(GdkEvent* event);
64 // Callback prior to gdk dispatching an event.
65 static void EventDispatcher(GdkEvent* event, void* data);
67 DISALLOW_COPY_AND_ASSIGN(MessagePumpGtk);
70 typedef MessagePumpGtk MessagePumpForUI;
72 } // namespace base
74 #endif // BASE_MESSAGE_LOOP_MESSAGE_PUMP_GTK_H_