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

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

Issue 331513002: [Mac] Use a native MessagePump instead of a MessagePumpDefault (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 #if defined(OS_IOS) || defined(OS_MACOSX) 222 #if defined(OS_IOS) || defined(OS_MACOSX)
223 #define MESSAGE_PUMP_UI scoped_ptr<MessagePump>(MessagePumpMac::Create()) 223 #define MESSAGE_PUMP_UI scoped_ptr<MessagePump>(MessagePumpMac::Create())
224 #elif defined(OS_NACL) 224 #elif defined(OS_NACL)
225 // Currently NaCl doesn't have a UI MessageLoop. 225 // Currently NaCl doesn't have a UI MessageLoop.
226 // TODO(abarth): Figure out if we need this. 226 // TODO(abarth): Figure out if we need this.
227 #define MESSAGE_PUMP_UI scoped_ptr<MessagePump>() 227 #define MESSAGE_PUMP_UI scoped_ptr<MessagePump>()
228 #else 228 #else
229 #define MESSAGE_PUMP_UI scoped_ptr<MessagePump>(new MessagePumpForUI()) 229 #define MESSAGE_PUMP_UI scoped_ptr<MessagePump>(new MessagePumpForUI())
230 #endif 230 #endif
231 231
232 #if defined(OS_MACOSX)
233 // Use an OS native runloop on Mac to support timer coalescing.
234 #define MESSAGE_PUMP_DEFAULT scoped_ptr<MessagePump>(MessagePumpMac::Create())
Mark Mentovai 2014/06/11 21:59:42 We may want a MessagePumpCFRunLoop instead of a Me
235 #else
236 #define MESSAGE_PUMP_DEFAULT scoped_ptr<MessagePump>(new MessagePumpDefault())
237 #endif
238
232 if (type == MessageLoop::TYPE_UI) { 239 if (type == MessageLoop::TYPE_UI) {
233 if (message_pump_for_ui_factory_) 240 if (message_pump_for_ui_factory_)
234 return message_pump_for_ui_factory_(); 241 return message_pump_for_ui_factory_();
235 return MESSAGE_PUMP_UI; 242 return MESSAGE_PUMP_UI;
236 } 243 }
237 if (type == MessageLoop::TYPE_IO) 244 if (type == MessageLoop::TYPE_IO)
238 return scoped_ptr<MessagePump>(new MessagePumpForIO()); 245 return scoped_ptr<MessagePump>(new MessagePumpForIO());
239 246
240 #if defined(OS_ANDROID) 247 #if defined(OS_ANDROID)
241 if (type == MessageLoop::TYPE_JAVA) 248 if (type == MessageLoop::TYPE_JAVA)
242 return scoped_ptr<MessagePump>(new MessagePumpForUI()); 249 return scoped_ptr<MessagePump>(new MessagePumpForUI());
243 #endif 250 #endif
244 251
245 DCHECK_EQ(MessageLoop::TYPE_DEFAULT, type); 252 DCHECK_EQ(MessageLoop::TYPE_DEFAULT, type);
246 return scoped_ptr<MessagePump>(new MessagePumpDefault()); 253 return MESSAGE_PUMP_DEFAULT;
247 } 254 }
248 255
249 void MessageLoop::AddDestructionObserver( 256 void MessageLoop::AddDestructionObserver(
250 DestructionObserver* destruction_observer) { 257 DestructionObserver* destruction_observer) {
251 DCHECK_EQ(this, current()); 258 DCHECK_EQ(this, current());
252 destruction_observers_.AddObserver(destruction_observer); 259 destruction_observers_.AddObserver(destruction_observer);
253 } 260 }
254 261
255 void MessageLoop::RemoveDestructionObserver( 262 void MessageLoop::RemoveDestructionObserver(
256 DestructionObserver* destruction_observer) { 263 DestructionObserver* destruction_observer) {
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 persistent, 740 persistent,
734 mode, 741 mode,
735 controller, 742 controller,
736 delegate); 743 delegate);
737 } 744 }
738 #endif 745 #endif
739 746
740 #endif // !defined(OS_NACL) 747 #endif // !defined(OS_NACL)
741 748
742 } // namespace base 749 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698