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

Side by Side Diff: remoting/base/auto_thread.cc

Issue 1942053002: Deletes base::MessageLoop::set_thread_name(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: uses PlatformThread::GetName Created 4 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
« no previous file with comments | « ios/web/web_thread_impl.cc ('k') | sync/engine/sync_scheduler_impl.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) 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 #include "remoting/base/auto_thread.h" 5 #include "remoting/base/auto_thread.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/synchronization/waitable_event.h" 9 #include "base/synchronization/waitable_event.h"
10 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" 10 #include "base/third_party/dynamic_annotations/dynamic_annotations.h"
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 delete this; 181 delete this;
182 } 182 }
183 183
184 void AutoThread::ThreadMain() { 184 void AutoThread::ThreadMain() {
185 // The message loop for this thread. 185 // The message loop for this thread.
186 base::MessageLoop message_loop(startup_data_->loop_type); 186 base::MessageLoop message_loop(startup_data_->loop_type);
187 187
188 // Complete the initialization of our AutoThread object. 188 // Complete the initialization of our AutoThread object.
189 base::PlatformThread::SetName(name_); 189 base::PlatformThread::SetName(name_);
190 ANNOTATE_THREAD_NAME(name_.c_str()); // Tell the name to race detector. 190 ANNOTATE_THREAD_NAME(name_.c_str()); // Tell the name to race detector.
191 message_loop.set_thread_name(name_);
192 191
193 // Return an AutoThreadTaskRunner that will cleanly quit this thread when 192 // Return an AutoThreadTaskRunner that will cleanly quit this thread when
194 // no more references to it remain. 193 // no more references to it remain.
195 startup_data_->task_runner = 194 startup_data_->task_runner =
196 new AutoThreadTaskRunner(message_loop.task_runner(), 195 new AutoThreadTaskRunner(message_loop.task_runner(),
197 base::Bind(&AutoThread::QuitThread, 196 base::Bind(&AutoThread::QuitThread,
198 base::Unretained(this), 197 base::Unretained(this),
199 message_loop.task_runner())); 198 message_loop.task_runner()));
200 199
201 startup_data_->event.Signal(); 200 startup_data_->event.Signal();
202 // startup_data_ can't be touched anymore since the starting thread is now 201 // startup_data_ can't be touched anymore since the starting thread is now
203 // unlocked. 202 // unlocked.
204 203
205 #if defined(OS_WIN) 204 #if defined(OS_WIN)
206 // Initialize COM on the thread, if requested. 205 // Initialize COM on the thread, if requested.
207 std::unique_ptr<base::win::ScopedCOMInitializer> com_initializer( 206 std::unique_ptr<base::win::ScopedCOMInitializer> com_initializer(
208 CreateComInitializer(com_init_type_)); 207 CreateComInitializer(com_init_type_));
209 #endif 208 #endif
210 209
211 message_loop.Run(); 210 message_loop.Run();
212 211
213 // Assert that MessageLoop::QuitWhenIdle was called by AutoThread::QuitThread. 212 // Assert that MessageLoop::QuitWhenIdle was called by AutoThread::QuitThread.
214 DCHECK(was_quit_properly_); 213 DCHECK(was_quit_properly_);
215 } 214 }
216 215
217 } // namespace base 216 } // namespace base
OLDNEW
« no previous file with comments | « ios/web/web_thread_impl.cc ('k') | sync/engine/sync_scheduler_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698