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

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

Issue 2356383003: Delete MessageLoop::Run()/RunUntilIdle(). (Closed)
Patch Set: rebase Created 4 years, 2 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 | base/message_loop/message_loop.cc » ('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 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 #ifndef BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ 5 #ifndef BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_
6 #define BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ 6 #define BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <queue> 9 #include <queue>
10 #include <string> 10 #include <string>
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 public: 171 public:
172 virtual void OnBeginNestedMessageLoop() = 0; 172 virtual void OnBeginNestedMessageLoop() = 0;
173 173
174 protected: 174 protected:
175 virtual ~NestingObserver(); 175 virtual ~NestingObserver();
176 }; 176 };
177 177
178 void AddNestingObserver(NestingObserver* observer); 178 void AddNestingObserver(NestingObserver* observer);
179 void RemoveNestingObserver(NestingObserver* observer); 179 void RemoveNestingObserver(NestingObserver* observer);
180 180
181 #if defined(OS_MACOSX) && !defined(OS_IOS)
182 protected:
183 #endif // defined(OS_MACOSX) && !defined(OS_IOS)
184
185 // Deprecated: use RunLoop instead.
186 // Run the message loop.
187 void Run();
188
189 // Deprecated: use RunLoop instead.
190 // Process all pending tasks, windows messages, etc., but don't wait/sleep.
191 // Return as soon as all items that can be run are taken care of.
192 void RunUntilIdle();
193
194 #if defined(OS_MACOSX) && !defined(OS_IOS)
195 public:
196 #endif // defined(OS_MACOSX) && !defined(OS_IOS)
197
198 // Deprecated: use RunLoop instead. 181 // Deprecated: use RunLoop instead.
199 // 182 //
200 // Signals the Run method to return when it becomes idle. It will continue to 183 // Signals the Run method to return when it becomes idle. It will continue to
201 // process pending messages and future messages as long as they are enqueued. 184 // process pending messages and future messages as long as they are enqueued.
202 // Warning: if the MessageLoop remains busy, it may never quit. Only use this 185 // Warning: if the MessageLoop remains busy, it may never quit. Only use this
203 // Quit method when looping procedures (such as web pages) have been shut 186 // Quit method when looping procedures (such as web pages) have been shut
204 // down. 187 // down.
205 // 188 //
206 // This method may only be called on the same thread that called Run, and Run 189 // This method may only be called on the same thread that called Run, and Run
207 // must still be on the call stack. 190 // must still be on the call stack.
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 482
500 //----------------------------------------------------------------------------- 483 //-----------------------------------------------------------------------------
501 // MessageLoopForUI extends MessageLoop with methods that are particular to a 484 // MessageLoopForUI extends MessageLoop with methods that are particular to a
502 // MessageLoop instantiated with TYPE_UI. 485 // MessageLoop instantiated with TYPE_UI.
503 // 486 //
504 // This class is typically used like so: 487 // This class is typically used like so:
505 // MessageLoopForUI::current()->...call some method... 488 // MessageLoopForUI::current()->...call some method...
506 // 489 //
507 class BASE_EXPORT MessageLoopForUI : public MessageLoop { 490 class BASE_EXPORT MessageLoopForUI : public MessageLoop {
508 public: 491 public:
509 using MessageLoop::Run;
510 using MessageLoop::RunUntilIdle;
511
512 MessageLoopForUI() : MessageLoop(TYPE_UI) { 492 MessageLoopForUI() : MessageLoop(TYPE_UI) {
513 } 493 }
514 494
515 explicit MessageLoopForUI(std::unique_ptr<MessagePump> pump); 495 explicit MessageLoopForUI(std::unique_ptr<MessagePump> pump);
516 496
517 // Returns the MessageLoopForUI of the current thread. 497 // Returns the MessageLoopForUI of the current thread.
518 static MessageLoopForUI* current() { 498 static MessageLoopForUI* current() {
519 MessageLoop* loop = MessageLoop::current(); 499 MessageLoop* loop = MessageLoop::current();
520 DCHECK(loop); 500 DCHECK(loop);
521 DCHECK(loop->IsType(MessageLoop::TYPE_UI)); 501 DCHECK(loop->IsType(MessageLoop::TYPE_UI));
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 547
568 //----------------------------------------------------------------------------- 548 //-----------------------------------------------------------------------------
569 // MessageLoopForIO extends MessageLoop with methods that are particular to a 549 // MessageLoopForIO extends MessageLoop with methods that are particular to a
570 // MessageLoop instantiated with TYPE_IO. 550 // MessageLoop instantiated with TYPE_IO.
571 // 551 //
572 // This class is typically used like so: 552 // This class is typically used like so:
573 // MessageLoopForIO::current()->...call some method... 553 // MessageLoopForIO::current()->...call some method...
574 // 554 //
575 class BASE_EXPORT MessageLoopForIO : public MessageLoop { 555 class BASE_EXPORT MessageLoopForIO : public MessageLoop {
576 public: 556 public:
577 using MessageLoop::Run;
578 using MessageLoop::RunUntilIdle;
579
580 MessageLoopForIO() : MessageLoop(TYPE_IO) { 557 MessageLoopForIO() : MessageLoop(TYPE_IO) {
581 } 558 }
582 559
583 // Returns the MessageLoopForIO of the current thread. 560 // Returns the MessageLoopForIO of the current thread.
584 static MessageLoopForIO* current() { 561 static MessageLoopForIO* current() {
585 MessageLoop* loop = MessageLoop::current(); 562 MessageLoop* loop = MessageLoop::current();
586 DCHECK(loop); 563 DCHECK(loop);
587 DCHECK_EQ(MessageLoop::TYPE_IO, loop->type()); 564 DCHECK_EQ(MessageLoop::TYPE_IO, loop->type());
588 return static_cast<MessageLoopForIO*>(loop); 565 return static_cast<MessageLoopForIO*>(loop);
589 } 566 }
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 615
639 // Do not add any member variables to MessageLoopForIO! This is important b/c 616 // Do not add any member variables to MessageLoopForIO! This is important b/c
640 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra 617 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra
641 // data that you need should be stored on the MessageLoop's pump_ instance. 618 // data that you need should be stored on the MessageLoop's pump_ instance.
642 static_assert(sizeof(MessageLoop) == sizeof(MessageLoopForIO), 619 static_assert(sizeof(MessageLoop) == sizeof(MessageLoopForIO),
643 "MessageLoopForIO should not have extra member variables"); 620 "MessageLoopForIO should not have extra member variables");
644 621
645 } // namespace base 622 } // namespace base
646 623
647 #endif // BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ 624 #endif // BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_
OLDNEW
« no previous file with comments | « no previous file | base/message_loop/message_loop.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698