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

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

Issue 2019423006: Adding more detail to MessageQueue::Dispatch logging. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: 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
OLDNEW
1 /* 1 /*
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 // Never call Stop on the current thread. Instead use the inherited Quit 144 // Never call Stop on the current thread. Instead use the inherited Quit
145 // function which will exit the base MessageQueue without terminating the 145 // function which will exit the base MessageQueue without terminating the
146 // underlying OS thread. 146 // underlying OS thread.
147 virtual void Stop(); 147 virtual void Stop();
148 148
149 // By default, Thread::Run() calls ProcessMessages(kForever). To do other 149 // By default, Thread::Run() calls ProcessMessages(kForever). To do other
150 // work, override Run(). To receive and dispatch messages, call 150 // work, override Run(). To receive and dispatch messages, call
151 // ProcessMessages occasionally. 151 // ProcessMessages occasionally.
152 virtual void Run(); 152 virtual void Run();
153 153
154 virtual void Send(MessageHandler* phandler, 154 virtual void Send(const Location& posted_from,
155 MessageHandler* phandler,
155 uint32_t id = 0, 156 uint32_t id = 0,
156 MessageData* pdata = NULL); 157 MessageData* pdata = NULL);
157 158
158 // Convenience method to invoke a functor on another thread. Caller must 159 // Convenience method to invoke a functor on another thread. Caller must
159 // provide the |ReturnT| template argument, which cannot (easily) be deduced. 160 // provide the |ReturnT| template argument, which cannot (easily) be deduced.
160 // Uses Send() internally, which blocks the current thread until execution 161 // Uses Send() internally, which blocks the current thread until execution
161 // is complete. 162 // is complete.
162 // Ex: bool result = thread.Invoke<bool>(&MyFunctionReturningBool); 163 // Ex: bool result = thread.Invoke<bool>(FROM_HERE, &MyFunctionReturningBool);
163 // NOTE: This function can only be called when synchronous calls are allowed. 164 // NOTE: This function can only be called when synchronous calls are allowed.
164 // See ScopedDisallowBlockingCalls for details. 165 // See ScopedDisallowBlockingCalls for details.
165 template <class ReturnT, class FunctorT> 166 template <class ReturnT, class FunctorT>
166 ReturnT Invoke(const FunctorT& functor) { 167 ReturnT Invoke(const Location& posted_from, const FunctorT& functor) {
167 InvokeBegin(); 168 InvokeBegin();
168 FunctorMessageHandler<ReturnT, FunctorT> handler(functor); 169 FunctorMessageHandler<ReturnT, FunctorT> handler(functor);
169 Send(&handler); 170 Send(posted_from, &handler);
170 InvokeEnd(); 171 InvokeEnd();
171 return handler.result(); 172 return handler.result();
172 } 173 }
173 174
174 // From MessageQueue 175 // From MessageQueue
175 void Clear(MessageHandler* phandler, 176 void Clear(MessageHandler* phandler,
176 uint32_t id = MQID_ANY, 177 uint32_t id = MQID_ANY,
177 MessageList* removed = NULL) override; 178 MessageList* removed = NULL) override;
178 void ReceiveSends() override; 179 void ReceiveSends() override;
179 180
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 328
328 private: 329 private:
329 SocketServer* old_ss_; 330 SocketServer* old_ss_;
330 331
331 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(SocketServerScope); 332 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(SocketServerScope);
332 }; 333 };
333 334
334 } // namespace rtc 335 } // namespace rtc
335 336
336 #endif // WEBRTC_BASE_THREAD_H_ 337 #endif // WEBRTC_BASE_THREAD_H_
OLDNEW
« webrtc/base/messagequeue.cc ('K') | « webrtc/base/stream.cc ('k') | webrtc/base/thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698