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

Side by Side Diff: base/message_loop.h

Issue 652089: Add MessageLoop::QuitNow and use it to terminate a sync IPC.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | base/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 (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 // messages. This method may only be called on the same thread that called 151 // messages. This method may only be called on the same thread that called
152 // Run, and Run must still be on the call stack. 152 // Run, and Run must still be on the call stack.
153 // 153 //
154 // Use QuitTask if you need to Quit another thread's MessageLoop, but note 154 // Use QuitTask if you need to Quit another thread's MessageLoop, but note
155 // that doing so is fairly dangerous if the target thread makes nested calls 155 // that doing so is fairly dangerous if the target thread makes nested calls
156 // to MessageLoop::Run. The problem being that you won't know which nested 156 // to MessageLoop::Run. The problem being that you won't know which nested
157 // run loop you are quiting, so be careful! 157 // run loop you are quiting, so be careful!
158 // 158 //
159 void Quit(); 159 void Quit();
160 160
161 // This method is a variant of Quit, that does not wait for pending messages
162 // to be processed before returning from Run.
163 void QuitNow();
164
161 // Invokes Quit on the current MessageLoop when run. Useful to schedule an 165 // Invokes Quit on the current MessageLoop when run. Useful to schedule an
162 // arbitrary MessageLoop to Quit. 166 // arbitrary MessageLoop to Quit.
163 class QuitTask : public Task { 167 class QuitTask : public Task {
164 public: 168 public:
165 virtual void Run() { 169 virtual void Run() {
166 MessageLoop::current()->Quit(); 170 MessageLoop::current()->Quit();
167 } 171 }
168 }; 172 };
169 173
170 // A MessageLoop has a particular type, which indicates the set of 174 // A MessageLoop has a particular type, which indicates the set of
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 #endif // defined(OS_POSIX) 535 #endif // defined(OS_POSIX)
532 }; 536 };
533 537
534 // Do not add any member variables to MessageLoopForIO! This is important b/c 538 // Do not add any member variables to MessageLoopForIO! This is important b/c
535 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra 539 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra
536 // data that you need should be stored on the MessageLoop's pump_ instance. 540 // data that you need should be stored on the MessageLoop's pump_ instance.
537 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), 541 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO),
538 MessageLoopForIO_should_not_have_extra_member_variables); 542 MessageLoopForIO_should_not_have_extra_member_variables);
539 543
540 #endif // BASE_MESSAGE_LOOP_H_ 544 #endif // BASE_MESSAGE_LOOP_H_
OLDNEW
« no previous file with comments | « no previous file | base/message_loop.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698