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

Side by Side Diff: base/message_loop.cc

Issue 7473010: Adding Wayland message loop and gyp build deps (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Removed unnecessary dependencies in base/base.gypi Created 9 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) 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 #include "base/message_loop.h" 5 #include "base/message_loop.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/debug/alias.h" 11 #include "base/debug/alias.h"
12 #include "base/lazy_instance.h" 12 #include "base/lazy_instance.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/message_pump_default.h" 15 #include "base/message_pump_default.h"
16 #include "base/metrics/histogram.h" 16 #include "base/metrics/histogram.h"
17 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" 17 #include "base/third_party/dynamic_annotations/dynamic_annotations.h"
18 #include "base/threading/thread_local.h" 18 #include "base/threading/thread_local.h"
19 #include "base/time.h" 19 #include "base/time.h"
20 #include "base/tracked_objects.h" 20 #include "base/tracked_objects.h"
21 21
22 #if defined(OS_MACOSX) 22 #if defined(OS_MACOSX)
23 #include "base/message_pump_mac.h" 23 #include "base/message_pump_mac.h"
24 #endif 24 #endif
25 #if defined(OS_POSIX)
26 #include "base/message_pump_libevent.h"
27 #endif
28 25
29 #if defined(OS_POSIX) && !defined(OS_MACOSX) 26 #if defined(OS_POSIX) && !defined(OS_MACOSX)
30 #include <gdk/gdk.h> 27 #include <gdk/gdk.h>
31 #include <gdk/gdkx.h> 28 #include <gdk/gdkx.h>
32 #if defined(TOUCH_UI)
33 #include "base/message_pump_x.h"
34 #else
35 #include "base/message_pump_gtk.h"
36 #endif // defined(TOUCH_UI)
37 #endif // defined(OS_POSIX) && !defined(OS_MACOSX) 29 #endif // defined(OS_POSIX) && !defined(OS_MACOSX)
38 30
39 using base::TimeDelta; 31 using base::TimeDelta;
40 using base::TimeTicks; 32 using base::TimeTicks;
41 33
42 namespace { 34 namespace {
43 35
44 // A lazily created thread local storage for quick access to a thread's message 36 // A lazily created thread local storage for quick access to a thread's message
45 // loop, if one exists. This should be safe and free of static constructors. 37 // loop, if one exists. This should be safe and free of static constructors.
46 base::LazyInstance<base::ThreadLocalPointer<MessageLoop> > lazy_tls_ptr( 38 base::LazyInstance<base::ThreadLocalPointer<MessageLoop> > lazy_tls_ptr(
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 DCHECK(!current()) << "should only have one message loop per thread"; 162 DCHECK(!current()) << "should only have one message loop per thread";
171 lazy_tls_ptr.Pointer()->Set(this); 163 lazy_tls_ptr.Pointer()->Set(this);
172 164
173 // TODO(rvargas): Get rid of the OS guards. 165 // TODO(rvargas): Get rid of the OS guards.
174 #if defined(OS_WIN) 166 #if defined(OS_WIN)
175 #define MESSAGE_PUMP_UI new base::MessagePumpForUI() 167 #define MESSAGE_PUMP_UI new base::MessagePumpForUI()
176 #define MESSAGE_PUMP_IO new base::MessagePumpForIO() 168 #define MESSAGE_PUMP_IO new base::MessagePumpForIO()
177 #elif defined(OS_MACOSX) 169 #elif defined(OS_MACOSX)
178 #define MESSAGE_PUMP_UI base::MessagePumpMac::Create() 170 #define MESSAGE_PUMP_UI base::MessagePumpMac::Create()
179 #define MESSAGE_PUMP_IO new base::MessagePumpLibevent() 171 #define MESSAGE_PUMP_IO new base::MessagePumpLibevent()
172 #elif defined(USE_WAYLAND)
173 #define MESSAGE_PUMP_UI new base::MessagePumpWayland()
174 #define MESSAGE_PUMP_IO new base::MessagePumpLibevent()
180 #elif defined(TOUCH_UI) 175 #elif defined(TOUCH_UI)
181 #define MESSAGE_PUMP_UI new base::MessagePumpX() 176 #define MESSAGE_PUMP_UI new base::MessagePumpX()
182 #define MESSAGE_PUMP_IO new base::MessagePumpLibevent() 177 #define MESSAGE_PUMP_IO new base::MessagePumpLibevent()
183 #elif defined(OS_NACL) 178 #elif defined(OS_NACL)
184 // Currently NaCl doesn't have a UI or an IO MessageLoop. 179 // Currently NaCl doesn't have a UI or an IO MessageLoop.
185 // TODO(abarth): Figure out if we need these. 180 // TODO(abarth): Figure out if we need these.
186 #define MESSAGE_PUMP_UI NULL 181 #define MESSAGE_PUMP_UI NULL
187 #define MESSAGE_PUMP_IO NULL 182 #define MESSAGE_PUMP_IO NULL
188 #elif defined(OS_POSIX) // POSIX but not MACOSX. 183 #elif defined(OS_POSIX) // POSIX but not MACOSX.
189 #define MESSAGE_PUMP_UI new base::MessagePumpGtk() 184 #define MESSAGE_PUMP_UI new base::MessagePumpGtk()
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after
866 Watcher *delegate) { 861 Watcher *delegate) {
867 return pump_libevent()->WatchFileDescriptor( 862 return pump_libevent()->WatchFileDescriptor(
868 fd, 863 fd,
869 persistent, 864 persistent,
870 static_cast<base::MessagePumpLibevent::Mode>(mode), 865 static_cast<base::MessagePumpLibevent::Mode>(mode),
871 controller, 866 controller,
872 delegate); 867 delegate);
873 } 868 }
874 869
875 #endif 870 #endif
OLDNEW
« no previous file with comments | « base/message_loop.h ('k') | base/message_pump_wayland.h » ('j') | build/common.gypi » ('J')

Powered by Google App Engine
This is Rietveld 408576698