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

Side by Side Diff: base/message_loop.h

Issue 7250001: Refactor the glib message-pump, and use it as the base for a gtk message pump and an X message pump. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: media.gyp update Created 9 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 | Annotate | Revision Log
« no previous file with comments | « base/base.gypi ('k') | base/message_loop.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_LOOP_H_ 5 #ifndef BASE_MESSAGE_LOOP_H_
6 #define BASE_MESSAGE_LOOP_H_ 6 #define BASE_MESSAGE_LOOP_H_
7 #pragma once 7 #pragma once
8 8
9 #include <queue> 9 #include <queue>
10 #include <string> 10 #include <string>
11 11
12 #include "base/base_api.h" 12 #include "base/base_api.h"
13 #include "base/basictypes.h" 13 #include "base/basictypes.h"
14 #include "base/callback.h" 14 #include "base/callback.h"
15 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
16 #include "base/message_pump.h" 16 #include "base/message_pump.h"
17 #include "base/observer_list.h" 17 #include "base/observer_list.h"
18 #include "base/synchronization/lock.h" 18 #include "base/synchronization/lock.h"
19 #include "base/task.h" 19 #include "base/task.h"
20 #include "base/time.h" 20 #include "base/time.h"
21 #include "base/tracked.h" 21 #include "base/tracked.h"
22 22
23 #if defined(OS_WIN) 23 #if defined(OS_WIN)
24 // We need this to declare base::MessagePumpWin::Dispatcher, which we should 24 // We need this to declare base::MessagePumpWin::Dispatcher, which we should
25 // really just eliminate. 25 // really just eliminate.
26 #include "base/message_pump_win.h" 26 #include "base/message_pump_win.h"
27 #elif defined(OS_POSIX) 27 #elif defined(OS_POSIX)
28 #include "base/message_pump_libevent.h" 28 #include "base/message_pump_libevent.h"
29 #if !defined(OS_MACOSX) 29 #if !defined(OS_MACOSX)
30 #include "base/message_pump_glib.h" 30 #if defined(TOUCH_UI)
31 #include "base/message_pump_x.h"
32 #else
33 #include "base/message_pump_gtk.h"
34 #endif
31 typedef struct _XDisplay Display; 35 typedef struct _XDisplay Display;
32 #endif 36 #endif
33 #endif 37 #endif
34 #if defined(TOUCH_UI)
35 #include "base/message_pump_glib_x_dispatch.h"
36 #endif
37 38
38 namespace base { 39 namespace base {
39 class Histogram; 40 class Histogram;
40 } 41 }
41 42
42 #if defined(TRACK_ALL_TASK_OBJECTS) 43 #if defined(TRACK_ALL_TASK_OBJECTS)
43 namespace tracked_objects { 44 namespace tracked_objects {
44 class Births; 45 class Births;
45 } 46 }
46 #endif // defined(TRACK_ALL_TASK_OBJECTS) 47 #endif // defined(TRACK_ALL_TASK_OBJECTS)
(...skipping 26 matching lines...) Expand all
73 // // Process hr (the result returned by DoDragDrop(). 74 // // Process hr (the result returned by DoDragDrop().
74 // 75 //
75 // Please be SURE your task is reentrant (nestable) and all global variables 76 // Please be SURE your task is reentrant (nestable) and all global variables
76 // are stable and accessible before calling SetNestableTasksAllowed(true). 77 // are stable and accessible before calling SetNestableTasksAllowed(true).
77 // 78 //
78 class BASE_API MessageLoop : public base::MessagePump::Delegate { 79 class BASE_API MessageLoop : public base::MessagePump::Delegate {
79 public: 80 public:
80 #if defined(OS_WIN) 81 #if defined(OS_WIN)
81 typedef base::MessagePumpWin::Dispatcher Dispatcher; 82 typedef base::MessagePumpWin::Dispatcher Dispatcher;
82 typedef base::MessagePumpForUI::Observer Observer; 83 typedef base::MessagePumpForUI::Observer Observer;
83 #elif defined(TOUCH_UI)
84 typedef base::MessagePumpGlibXDispatcher Dispatcher;
85 typedef base::MessagePumpXObserver Observer;
86 #elif !defined(OS_MACOSX) 84 #elif !defined(OS_MACOSX)
87 typedef base::MessagePumpForUI::Dispatcher Dispatcher; 85 typedef base::MessagePumpDispatcher Dispatcher;
88 typedef base::MessagePumpForUI::Observer Observer; 86 typedef base::MessagePumpObserver Observer;
89 #endif 87 #endif
90 88
91 // A MessageLoop has a particular type, which indicates the set of 89 // A MessageLoop has a particular type, which indicates the set of
92 // asynchronous events it may process in addition to tasks and timers. 90 // asynchronous events it may process in addition to tasks and timers.
93 // 91 //
94 // TYPE_DEFAULT 92 // TYPE_DEFAULT
95 // This type of ML only supports tasks and timers. 93 // This type of ML only supports tasks and timers.
96 // 94 //
97 // TYPE_UI 95 // TYPE_UI
98 // This type of ML also supports native UI events (e.g., Windows messages). 96 // This type of ML also supports native UI events (e.g., Windows messages).
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 #endif // defined(OS_POSIX) 688 #endif // defined(OS_POSIX)
691 }; 689 };
692 690
693 // Do not add any member variables to MessageLoopForIO! This is important b/c 691 // Do not add any member variables to MessageLoopForIO! This is important b/c
694 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra 692 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra
695 // data that you need should be stored on the MessageLoop's pump_ instance. 693 // data that you need should be stored on the MessageLoop's pump_ instance.
696 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), 694 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO),
697 MessageLoopForIO_should_not_have_extra_member_variables); 695 MessageLoopForIO_should_not_have_extra_member_variables);
698 696
699 #endif // BASE_MESSAGE_LOOP_H_ 697 #endif // BASE_MESSAGE_LOOP_H_
OLDNEW
« no previous file with comments | « base/base.gypi ('k') | base/message_loop.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698