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

Side by Side Diff: base/message_loop.h

Issue 10479018: Add base::RunLoop and update ui_test_utils to use it to reduce flakiness (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: change Quit to QuitNow in places where it makes sense Created 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | base/message_loop.cc » ('j') | chrome/test/base/ui_test_utils.cc » ('J')
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 #pragma once 7 #pragma once
8 8
9 #include <queue> 9 #include <queue>
10 #include <string> 10 #include <string>
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 void Quit(); 235 void Quit();
236 236
237 // This method is a variant of Quit, that does not wait for pending messages 237 // This method is a variant of Quit, that does not wait for pending messages
238 // to be processed before returning from Run. 238 // to be processed before returning from Run.
239 void QuitNow(); 239 void QuitNow();
240 240
241 // Invokes Quit on the current MessageLoop when run. Useful to schedule an 241 // Invokes Quit on the current MessageLoop when run. Useful to schedule an
242 // arbitrary MessageLoop to Quit. 242 // arbitrary MessageLoop to Quit.
243 static base::Closure QuitClosure(); 243 static base::Closure QuitClosure();
244 244
245 // Invokes QuitNow on the current MessageLoop when run. Useful to schedule an
246 // arbitrary MessageLoop to QuitNow.
247 static base::Closure QuitNowClosure();
248
245 // Returns the type passed to the constructor. 249 // Returns the type passed to the constructor.
246 Type type() const { return type_; } 250 Type type() const { return type_; }
247 251
248 // Optional call to connect the thread name with this loop. 252 // Optional call to connect the thread name with this loop.
249 void set_thread_name(const std::string& thread_name) { 253 void set_thread_name(const std::string& thread_name) {
250 DCHECK(thread_name_.empty()) << "Should not rename this thread!"; 254 DCHECK(thread_name_.empty()) << "Should not rename this thread!";
251 thread_name_ = thread_name; 255 thread_name_ = thread_name;
252 } 256 }
253 const std::string& thread_name() const { return thread_name_; } 257 const std::string& thread_name() const { return thread_name_; }
254 258
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 #endif // defined(OS_POSIX) 663 #endif // defined(OS_POSIX)
660 }; 664 };
661 665
662 // Do not add any member variables to MessageLoopForIO! This is important b/c 666 // Do not add any member variables to MessageLoopForIO! This is important b/c
663 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra 667 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra
664 // data that you need should be stored on the MessageLoop's pump_ instance. 668 // data that you need should be stored on the MessageLoop's pump_ instance.
665 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), 669 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO),
666 MessageLoopForIO_should_not_have_extra_member_variables); 670 MessageLoopForIO_should_not_have_extra_member_variables);
667 671
668 #endif // BASE_MESSAGE_LOOP_H_ 672 #endif // BASE_MESSAGE_LOOP_H_
OLDNEW
« no previous file with comments | « no previous file | base/message_loop.cc » ('j') | chrome/test/base/ui_test_utils.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698