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

Side by Side Diff: base/message_loop/message_loop.cc

Issue 2884353004: fuchsia: base_unittests (mostly) compiling (Closed)
Patch Set: Created 3 years, 7 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/message_loop.h" 5 #include "base/message_loop/message_loop.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 28 matching lines...) Expand all
39 // A lazily created thread local storage for quick access to a thread's message 39 // A lazily created thread local storage for quick access to a thread's message
40 // loop, if one exists. 40 // loop, if one exists.
41 base::ThreadLocalPointer<MessageLoop>* GetTLSMessageLoop() { 41 base::ThreadLocalPointer<MessageLoop>* GetTLSMessageLoop() {
42 static auto* lazy_tls_ptr = new base::ThreadLocalPointer<MessageLoop>(); 42 static auto* lazy_tls_ptr = new base::ThreadLocalPointer<MessageLoop>();
43 return lazy_tls_ptr; 43 return lazy_tls_ptr;
44 } 44 }
45 MessageLoop::MessagePumpFactory* message_pump_for_ui_factory_ = NULL; 45 MessageLoop::MessagePumpFactory* message_pump_for_ui_factory_ = NULL;
46 46
47 #if defined(OS_IOS) 47 #if defined(OS_IOS)
48 typedef MessagePumpIOSForIO MessagePumpForIO; 48 typedef MessagePumpIOSForIO MessagePumpForIO;
49 #elif defined(OS_NACL_SFI) 49 #elif defined(OS_NACL_SFI) || defined(OS_FUCHSIA)
50 typedef MessagePumpDefault MessagePumpForIO; 50 typedef MessagePumpDefault MessagePumpForIO;
51 #elif defined(OS_POSIX) 51 #elif defined(OS_POSIX)
52 typedef MessagePumpLibevent MessagePumpForIO; 52 typedef MessagePumpLibevent MessagePumpForIO;
53 #endif 53 #endif
54 54
55 #if !defined(OS_NACL_SFI) 55 #if !defined(OS_NACL_SFI) && !defined(OS_FUCHSIA)
56 MessagePumpForIO* ToPumpIO(MessagePump* pump) { 56 MessagePumpForIO* ToPumpIO(MessagePump* pump) {
57 return static_cast<MessagePumpForIO*>(pump); 57 return static_cast<MessagePumpForIO*>(pump);
58 } 58 }
59 #endif // !defined(OS_NACL_SFI) 59 #endif // !defined(OS_NACL_SFI)
60 60
61 std::unique_ptr<MessagePump> ReturnPump(std::unique_ptr<MessagePump> pump) { 61 std::unique_ptr<MessagePump> ReturnPump(std::unique_ptr<MessagePump> pump) {
62 return pump; 62 return pump;
63 } 63 }
64 64
65 } // namespace 65 } // namespace
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 std::unique_ptr<MessagePump> MessageLoop::CreateMessagePumpForType(Type type) { 161 std::unique_ptr<MessagePump> MessageLoop::CreateMessagePumpForType(Type type) {
162 // TODO(rvargas): Get rid of the OS guards. 162 // TODO(rvargas): Get rid of the OS guards.
163 #if defined(USE_GLIB) && !defined(OS_NACL) 163 #if defined(USE_GLIB) && !defined(OS_NACL)
164 typedef MessagePumpGlib MessagePumpForUI; 164 typedef MessagePumpGlib MessagePumpForUI;
165 #elif (defined(OS_LINUX) && !defined(OS_NACL)) || defined(OS_BSD) 165 #elif (defined(OS_LINUX) && !defined(OS_NACL)) || defined(OS_BSD)
166 typedef MessagePumpLibevent MessagePumpForUI; 166 typedef MessagePumpLibevent MessagePumpForUI;
167 #endif 167 #endif
168 168
169 #if defined(OS_IOS) || defined(OS_MACOSX) 169 #if defined(OS_IOS) || defined(OS_MACOSX)
170 #define MESSAGE_PUMP_UI std::unique_ptr<MessagePump>(MessagePumpMac::Create()) 170 #define MESSAGE_PUMP_UI std::unique_ptr<MessagePump>(MessagePumpMac::Create())
171 #elif defined(OS_NACL) || defined(OS_AIX) 171 #elif defined(OS_NACL) || defined(OS_AIX) || defined(OS_FUCHSIA)
172 // Currently NaCl doesn't have a UI MessageLoop. 172 // Currently NaCl doesn't have a UI MessageLoop.
173 // TODO(abarth): Figure out if we need this. 173 // TODO(abarth): Figure out if we need this.
174 #define MESSAGE_PUMP_UI std::unique_ptr<MessagePump>() 174 #define MESSAGE_PUMP_UI std::unique_ptr<MessagePump>()
175 #else 175 #else
176 #define MESSAGE_PUMP_UI std::unique_ptr<MessagePump>(new MessagePumpForUI()) 176 #define MESSAGE_PUMP_UI std::unique_ptr<MessagePump>(new MessagePumpForUI())
177 #endif 177 #endif
178 178
179 #if defined(OS_MACOSX) 179 #if defined(OS_MACOSX)
180 // Use an OS native runloop on Mac to support timer coalescing. 180 // Use an OS native runloop on Mac to support timer coalescing.
181 #define MESSAGE_PUMP_DEFAULT \ 181 #define MESSAGE_PUMP_DEFAULT \
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 ToPumpIO(pump_.get())->RegisterIOHandler(file, handler); 624 ToPumpIO(pump_.get())->RegisterIOHandler(file, handler);
625 } 625 }
626 626
627 bool MessageLoopForIO::RegisterJobObject(HANDLE job, IOHandler* handler) { 627 bool MessageLoopForIO::RegisterJobObject(HANDLE job, IOHandler* handler) {
628 return ToPumpIO(pump_.get())->RegisterJobObject(job, handler); 628 return ToPumpIO(pump_.get())->RegisterJobObject(job, handler);
629 } 629 }
630 630
631 bool MessageLoopForIO::WaitForIOCompletion(DWORD timeout, IOHandler* filter) { 631 bool MessageLoopForIO::WaitForIOCompletion(DWORD timeout, IOHandler* filter) {
632 return ToPumpIO(pump_.get())->WaitForIOCompletion(timeout, filter); 632 return ToPumpIO(pump_.get())->WaitForIOCompletion(timeout, filter);
633 } 633 }
634 #elif defined(OS_POSIX) 634 #elif defined(OS_POSIX) && !defined(OS_FUCHSIA)
635 bool MessageLoopForIO::WatchFileDescriptor(int fd, 635 bool MessageLoopForIO::WatchFileDescriptor(int fd,
636 bool persistent, 636 bool persistent,
637 Mode mode, 637 Mode mode,
638 FileDescriptorWatcher* controller, 638 FileDescriptorWatcher* controller,
639 Watcher* delegate) { 639 Watcher* delegate) {
640 return ToPumpIO(pump_.get())->WatchFileDescriptor( 640 return ToPumpIO(pump_.get())->WatchFileDescriptor(
641 fd, 641 fd,
642 persistent, 642 persistent,
643 mode, 643 mode,
644 controller, 644 controller,
645 delegate); 645 delegate);
646 } 646 }
647 #endif 647 #endif
648 648
649 #endif // !defined(OS_NACL_SFI) 649 #endif // !defined(OS_NACL_SFI)
650 650
651 } // namespace base 651 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698