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

Side by Side Diff: base/message_loop.h

Issue 10826223: Replace PeekMessage for TSF awareness (Closed) Base URL: http://git.chromium.org/chromium/src.git@yukawa
Patch Set: nitpick Created 8 years, 3 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 | « base/base.gypi ('k') | base/message_pump_win.h » ('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) 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 7
8 #include <queue> 8 #include <queue>
9 #include <string> 9 #include <string>
10 10
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 530
531 //----------------------------------------------------------------------------- 531 //-----------------------------------------------------------------------------
532 // MessageLoopForUI extends MessageLoop with methods that are particular to a 532 // MessageLoopForUI extends MessageLoop with methods that are particular to a
533 // MessageLoop instantiated with TYPE_UI. 533 // MessageLoop instantiated with TYPE_UI.
534 // 534 //
535 // This class is typically used like so: 535 // This class is typically used like so:
536 // MessageLoopForUI::current()->...call some method... 536 // MessageLoopForUI::current()->...call some method...
537 // 537 //
538 class BASE_EXPORT MessageLoopForUI : public MessageLoop { 538 class BASE_EXPORT MessageLoopForUI : public MessageLoop {
539 public: 539 public:
540 #if defined(OS_WIN)
541 typedef base::MessagePumpForUI::MessageFilter MessageFilter;
542 #endif
543
540 MessageLoopForUI() : MessageLoop(TYPE_UI) { 544 MessageLoopForUI() : MessageLoop(TYPE_UI) {
541 } 545 }
542 546
543 // Returns the MessageLoopForUI of the current thread. 547 // Returns the MessageLoopForUI of the current thread.
544 static MessageLoopForUI* current() { 548 static MessageLoopForUI* current() {
545 MessageLoop* loop = MessageLoop::current(); 549 MessageLoop* loop = MessageLoop::current();
546 DCHECK(loop); 550 DCHECK(loop);
547 DCHECK_EQ(MessageLoop::TYPE_UI, loop->type()); 551 DCHECK_EQ(MessageLoop::TYPE_UI, loop->type());
548 return static_cast<MessageLoopForUI*>(loop); 552 return static_cast<MessageLoopForUI*>(loop);
549 } 553 }
(...skipping 13 matching lines...) Expand all
563 // On Android, the UI message loop is handled by Java side. So Run() should 567 // On Android, the UI message loop is handled by Java side. So Run() should
564 // never be called. Instead use Start(), which will forward all the native UI 568 // never be called. Instead use Start(), which will forward all the native UI
565 // events to the Java message loop. 569 // events to the Java message loop.
566 void Start(); 570 void Start();
567 #elif !defined(OS_MACOSX) 571 #elif !defined(OS_MACOSX)
568 // Please see message_pump_win/message_pump_glib for definitions of these 572 // Please see message_pump_win/message_pump_glib for definitions of these
569 // methods. 573 // methods.
570 void AddObserver(Observer* observer); 574 void AddObserver(Observer* observer);
571 void RemoveObserver(Observer* observer); 575 void RemoveObserver(Observer* observer);
572 576
577 #if defined(OS_WIN)
578 // Plese see MessagePumpForUI for definitions of this method.
579 void SetMessageFilter(scoped_ptr<MessageFilter> message_filter) {
580 pump_ui()->SetMessageFilter(message_filter.Pass());
581 }
582 #endif
583
573 protected: 584 protected:
574 #if defined(USE_AURA) && defined(USE_X11) && !defined(OS_NACL) 585 #if defined(USE_AURA) && defined(USE_X11) && !defined(OS_NACL)
575 friend class base::MessagePumpAuraX11; 586 friend class base::MessagePumpAuraX11;
576 #endif 587 #endif
577 588
578 // TODO(rvargas): Make this platform independent. 589 // TODO(rvargas): Make this platform independent.
579 base::MessagePumpForUI* pump_ui() { 590 base::MessagePumpForUI* pump_ui() {
580 return static_cast<base::MessagePumpForUI*>(pump_.get()); 591 return static_cast<base::MessagePumpForUI*>(pump_.get());
581 } 592 }
582 #endif // !defined(OS_MACOSX) 593 #endif // !defined(OS_MACOSX)
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 #endif // defined(OS_POSIX) 671 #endif // defined(OS_POSIX)
661 }; 672 };
662 673
663 // Do not add any member variables to MessageLoopForIO! This is important b/c 674 // Do not add any member variables to MessageLoopForIO! This is important b/c
664 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra 675 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra
665 // data that you need should be stored on the MessageLoop's pump_ instance. 676 // data that you need should be stored on the MessageLoop's pump_ instance.
666 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), 677 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO),
667 MessageLoopForIO_should_not_have_extra_member_variables); 678 MessageLoopForIO_should_not_have_extra_member_variables);
668 679
669 #endif // BASE_MESSAGE_LOOP_H_ 680 #endif // BASE_MESSAGE_LOOP_H_
OLDNEW
« no previous file with comments | « base/base.gypi ('k') | base/message_pump_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698