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

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

Issue 1394803004: Don't use base::MessageLoop::{Quit,QuitClosure} in remoting/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 | « remoting/base/auto_thread.h ('k') | remoting/base/auto_thread_task_runner_unittest.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/third_party/dynamic_annotations/dynamic_annotations.h" 9 #include "base/third_party/dynamic_annotations/dynamic_annotations.h"
10 #include "base/threading/thread_local.h" 10 #include "base/threading/thread_local.h"
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 157
158 void AutoThread::QuitThread( 158 void AutoThread::QuitThread(
159 scoped_refptr<base::SingleThreadTaskRunner> task_runner) { 159 scoped_refptr<base::SingleThreadTaskRunner> task_runner) {
160 if (!task_runner->BelongsToCurrentThread()) { 160 if (!task_runner->BelongsToCurrentThread()) {
161 task_runner->PostTask(FROM_HERE, base::Bind(&AutoThread::QuitThread, 161 task_runner->PostTask(FROM_HERE, base::Bind(&AutoThread::QuitThread,
162 base::Unretained(this), 162 base::Unretained(this),
163 task_runner)); 163 task_runner));
164 return; 164 return;
165 } 165 }
166 166
167 base::MessageLoop::current()->Quit(); 167 base::MessageLoop::current()->QuitWhenIdle();
168 was_quit_properly_ = true; 168 was_quit_properly_ = true;
169 169
170 if (joiner_.get()) { 170 if (joiner_.get()) {
171 joiner_->PostTask( 171 joiner_->PostTask(
172 FROM_HERE, 172 FROM_HERE,
173 base::Bind(&AutoThread::JoinAndDeleteThread, base::Unretained(this))); 173 base::Bind(&AutoThread::JoinAndDeleteThread, base::Unretained(this)));
174 } 174 }
175 } 175 }
176 176
177 void AutoThread::JoinAndDeleteThread() { 177 void AutoThread::JoinAndDeleteThread() {
(...skipping 22 matching lines...) Expand all
200 // unlocked. 200 // unlocked.
201 201
202 #if defined(OS_WIN) 202 #if defined(OS_WIN)
203 // Initialize COM on the thread, if requested. 203 // Initialize COM on the thread, if requested.
204 scoped_ptr<base::win::ScopedCOMInitializer> com_initializer( 204 scoped_ptr<base::win::ScopedCOMInitializer> com_initializer(
205 CreateComInitializer(com_init_type_)); 205 CreateComInitializer(com_init_type_));
206 #endif 206 #endif
207 207
208 message_loop.Run(); 208 message_loop.Run();
209 209
210 // Assert that MessageLoop::Quit was called by AutoThread::QuitThread. 210 // Assert that MessageLoop::QuitWhenIdle was called by AutoThread::QuitThread.
211 DCHECK(was_quit_properly_); 211 DCHECK(was_quit_properly_);
212 } 212 }
213 213
214 } // namespace base 214 } // namespace base
OLDNEW
« no previous file with comments | « remoting/base/auto_thread.h ('k') | remoting/base/auto_thread_task_runner_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698