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

Side by Side Diff: base/threading/thread.h

Issue 1180153002: base: Remove MessageLoopProxy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
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_THREADING_THREAD_H_ 5 #ifndef BASE_THREADING_THREAD_H_
6 #define BASE_THREADING_THREAD_H_ 6 #define BASE_THREADING_THREAD_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/base_export.h" 10 #include "base/base_export.h"
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 // Returns the message loop for this thread. Use the MessageLoop's 148 // Returns the message loop for this thread. Use the MessageLoop's
149 // PostTask methods to execute code on the thread. This only returns 149 // PostTask methods to execute code on the thread. This only returns
150 // non-null after a successful call to Start. After Stop has been called, 150 // non-null after a successful call to Start. After Stop has been called,
151 // this will return NULL. 151 // this will return NULL.
152 // 152 //
153 // NOTE: You must not call this MessageLoop's Quit method directly. Use 153 // NOTE: You must not call this MessageLoop's Quit method directly. Use
154 // the Thread's Stop method instead. 154 // the Thread's Stop method instead.
155 // 155 //
156 MessageLoop* message_loop() const { return message_loop_; } 156 MessageLoop* message_loop() const { return message_loop_; }
157 157
158 // Returns a MessageLoopProxy for this thread. Use the MessageLoopProxy's
159 // PostTask methods to execute code on the thread. Returns NULL if the thread
160 // is not running (e.g. before Start or after Stop have been called). Callers
161 // can hold on to this even after the thread is gone; in this situation,
162 // attempts to PostTask() will fail.
163 //
164 // Note: This method is deprecated. Callers should call task_runner() instead
165 // and use the TaskRunner interfaces for safely interfacing with the Thread.
166 scoped_refptr<MessageLoopProxy> message_loop_proxy() const {
167 return message_loop_ ? message_loop_->message_loop_proxy() : NULL;
168 }
169
170 // Returns a TaskRunner for this thread. Use the TaskRunner's PostTask 158 // Returns a TaskRunner for this thread. Use the TaskRunner's PostTask
171 // methods to execute code on the thread. Returns NULL if the thread is not 159 // methods to execute code on the thread. Returns NULL if the thread is not
172 // running (e.g. before Start or after Stop have been called). Callers can 160 // running (e.g. before Start or after Stop have been called). Callers can
173 // hold on to this even after the thread is gone; in this situation, attempts 161 // hold on to this even after the thread is gone; in this situation, attempts
174 // to PostTask() will fail. 162 // to PostTask() will fail.
175 scoped_refptr<SingleThreadTaskRunner> task_runner() const { 163 scoped_refptr<SingleThreadTaskRunner> task_runner() const {
176 return message_loop_ ? message_loop_->task_runner() : nullptr; 164 return message_loop_ ? message_loop_->task_runner() : nullptr;
177 } 165 }
178 166
179 // Returns the name of this thread (for display in debugger too). 167 // Returns the name of this thread (for display in debugger too).
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 scoped_ptr<WaitableEvent> start_event_; 240 scoped_ptr<WaitableEvent> start_event_;
253 241
254 friend void ThreadQuitHelper(); 242 friend void ThreadQuitHelper();
255 243
256 DISALLOW_COPY_AND_ASSIGN(Thread); 244 DISALLOW_COPY_AND_ASSIGN(Thread);
257 }; 245 };
258 246
259 } // namespace base 247 } // namespace base
260 248
261 #endif // BASE_THREADING_THREAD_H_ 249 #endif // BASE_THREADING_THREAD_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698