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

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

Issue 2681283002: Add ability to return moved value from FunctorMessageHandler, Optional. (Closed)
Patch Set: Rename to MoveValue as suggested. Created 3 years, 10 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 | « webrtc/base/optional_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 // Uses Send() internally, which blocks the current thread until execution 161 // Uses Send() internally, which blocks the current thread until execution
162 // is complete. 162 // is complete.
163 // Ex: bool result = thread.Invoke<bool>(RTC_FROM_HERE, 163 // Ex: bool result = thread.Invoke<bool>(RTC_FROM_HERE,
164 // &MyFunctionReturningBool); 164 // &MyFunctionReturningBool);
165 // NOTE: This function can only be called when synchronous calls are allowed. 165 // NOTE: This function can only be called when synchronous calls are allowed.
166 // See ScopedDisallowBlockingCalls for details. 166 // See ScopedDisallowBlockingCalls for details.
167 template <class ReturnT, class FunctorT> 167 template <class ReturnT, class FunctorT>
168 ReturnT Invoke(const Location& posted_from, const FunctorT& functor) { 168 ReturnT Invoke(const Location& posted_from, const FunctorT& functor) {
169 FunctorMessageHandler<ReturnT, FunctorT> handler(functor); 169 FunctorMessageHandler<ReturnT, FunctorT> handler(functor);
170 InvokeInternal(posted_from, &handler); 170 InvokeInternal(posted_from, &handler);
171 return handler.result(); 171 return handler.MoveResult();
172 } 172 }
173 173
174 // From MessageQueue 174 // From MessageQueue
175 void Clear(MessageHandler* phandler, 175 void Clear(MessageHandler* phandler,
176 uint32_t id = MQID_ANY, 176 uint32_t id = MQID_ANY,
177 MessageList* removed = NULL) override; 177 MessageList* removed = NULL) override;
178 void ReceiveSends() override; 178 void ReceiveSends() override;
179 179
180 // ProcessMessages will process I/O and dispatch messages until: 180 // ProcessMessages will process I/O and dispatch messages until:
181 // 1) cms milliseconds have elapsed (returns true) 181 // 1) cms milliseconds have elapsed (returns true)
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 329
330 private: 330 private:
331 SocketServer* old_ss_; 331 SocketServer* old_ss_;
332 332
333 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(SocketServerScope); 333 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(SocketServerScope);
334 }; 334 };
335 335
336 } // namespace rtc 336 } // namespace rtc
337 337
338 #endif // WEBRTC_BASE_THREAD_H_ 338 #endif // WEBRTC_BASE_THREAD_H_
OLDNEW
« no previous file with comments | « webrtc/base/optional_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698