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

Unified Diff: base/message_loop.h

Issue 7529003: Make base::MessageLoops have names at construction time (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make message loop name optional. Created 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/message_loop.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/message_loop.h
diff --git a/base/message_loop.h b/base/message_loop.h
index 9d500d7dd898a0e8e344328b310352823f8c6392..df349c8a7d6f67ef4299c558f3ecdca2961c325a 100644
--- a/base/message_loop.h
+++ b/base/message_loop.h
@@ -107,7 +107,8 @@ class BASE_API MessageLoop : public base::MessagePump::Delegate {
// Normally, it is not necessary to instantiate a MessageLoop. Instead, it
// is typical to make use of the current thread's MessageLoop instance.
- explicit MessageLoop(Type type = TYPE_DEFAULT);
+ explicit MessageLoop(Type type = TYPE_DEFAULT,
+ const char* thread_name = NULL);
virtual ~MessageLoop();
// Returns the MessageLoop object for the current thread, or null if none.
@@ -255,11 +256,7 @@ class BASE_API MessageLoop : public base::MessagePump::Delegate {
// Returns the type passed to the constructor.
Type type() const { return type_; }
- // Optional call to connect the thread name with this loop.
- void set_thread_name(const std::string& thread_name) {
- DCHECK(thread_name_.empty()) << "Should not rename this thread!";
- thread_name_ = thread_name;
- }
+ // Returns the name associated with this message loop's thread.
const std::string& thread_name() const { return thread_name_; }
// Enables or disables the recursive task processing. This happens in the case
@@ -569,7 +566,8 @@ class BASE_API MessageLoop : public base::MessagePump::Delegate {
//
class BASE_API MessageLoopForUI : public MessageLoop {
public:
- MessageLoopForUI() : MessageLoop(TYPE_UI) {
+ MessageLoopForUI(const char* thread_name)
+ : MessageLoop(thread_name, TYPE_UI) {
}
// Returns the MessageLoopForUI of the current thread.
@@ -631,7 +629,8 @@ class BASE_API MessageLoopForIO : public MessageLoop {
#endif
- MessageLoopForIO() : MessageLoop(TYPE_IO) {
+ MessageLoopForIO(const char* thread_name)
+ : MessageLoop(thread_name, TYPE_IO) {
}
// Returns the MessageLoopForIO of the current thread.
« 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