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

Side by Side Diff: base/message_loop.h

Issue 10689161: Adds MessageLoopUIApplication for use on iOS. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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>
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 MessageLoop* loop = MessageLoop::current(); 542 MessageLoop* loop = MessageLoop::current();
543 DCHECK(loop); 543 DCHECK(loop);
544 DCHECK_EQ(MessageLoop::TYPE_UI, loop->type()); 544 DCHECK_EQ(MessageLoop::TYPE_UI, loop->type());
545 return static_cast<MessageLoopForUI*>(loop); 545 return static_cast<MessageLoopForUI*>(loop);
546 } 546 }
547 547
548 #if defined(OS_WIN) 548 #if defined(OS_WIN)
549 void DidProcessMessage(const MSG& message); 549 void DidProcessMessage(const MSG& message);
550 #endif // defined(OS_WIN) 550 #endif // defined(OS_WIN)
551 551
552 #if defined(OS_IOS)
553 // On iOS, the main message loop cannot be Run(). Instead call Attach(),
554 // which connects this MessageLoop to the UI thread's CFRunLoop and allows
555 // PostTask() to work.
556 void Attach();
557 #endif
558
552 #if defined(OS_ANDROID) 559 #if defined(OS_ANDROID)
553 // On Android, the UI message loop is handled by Java side. So Run() should 560 // On Android, the UI message loop is handled by Java side. So Run() should
554 // never be called. Instead use Start(), which will forward all the native UI 561 // never be called. Instead use Start(), which will forward all the native UI
555 // events to the Java message loop. 562 // events to the Java message loop.
556 void Start(); 563 void Start();
557 #elif !defined(OS_MACOSX) 564 #elif !defined(OS_MACOSX)
558 // Please see message_pump_win/message_pump_glib for definitions of these 565 // Please see message_pump_win/message_pump_glib for definitions of these
559 // methods. 566 // methods.
560 void AddObserver(Observer* observer); 567 void AddObserver(Observer* observer);
561 void RemoveObserver(Observer* observer); 568 void RemoveObserver(Observer* observer);
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 #endif // defined(OS_POSIX) 652 #endif // defined(OS_POSIX)
646 }; 653 };
647 654
648 // Do not add any member variables to MessageLoopForIO! This is important b/c 655 // Do not add any member variables to MessageLoopForIO! This is important b/c
649 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra 656 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra
650 // data that you need should be stored on the MessageLoop's pump_ instance. 657 // data that you need should be stored on the MessageLoop's pump_ instance.
651 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), 658 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO),
652 MessageLoopForIO_should_not_have_extra_member_variables); 659 MessageLoopForIO_should_not_have_extra_member_variables);
653 660
654 #endif // BASE_MESSAGE_LOOP_H_ 661 #endif // BASE_MESSAGE_LOOP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698