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

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

Issue 2828223002: Delete method MessageQueue::set_socketserver (Closed)
Patch Set: Use AutoSocketServerThread at one more place, missed in prev patchset. Created 3 years, 8 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/ssladapter_unittest.cc ('k') | webrtc/base/thread.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 /* 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 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 304
305 class AutoThread : public Thread { 305 class AutoThread : public Thread {
306 public: 306 public:
307 AutoThread(); 307 AutoThread();
308 ~AutoThread() override; 308 ~AutoThread() override;
309 309
310 private: 310 private:
311 RTC_DISALLOW_COPY_AND_ASSIGN(AutoThread); 311 RTC_DISALLOW_COPY_AND_ASSIGN(AutoThread);
312 }; 312 };
313 313
314 // Provides an easy way to install/uninstall a socketserver on a thread. 314 // AutoSocketServerThread automatically installs itself at
315 class SocketServerScope { 315 // construction uninstalls at destruction. If a Thread object is
316 // already associated with the current OS thread, it is temporarily
317 // disassociated and restored by the destructor.
318
319 class AutoSocketServerThread : public Thread {
tommi 2017/04/27 13:57:07 if this is only for tests, can we indicate that in
nisse-webrtc 2017/04/27 14:08:56 It's *almost* test-only ;-/ It's used by peerconn
316 public: 320 public:
317 explicit SocketServerScope(SocketServer* ss) { 321 explicit AutoSocketServerThread(SocketServer* ss);
318 old_ss_ = Thread::Current()->socketserver(); 322 ~AutoSocketServerThread() override;
319 Thread::Current()->set_socketserver(ss);
320 }
321 ~SocketServerScope() {
322 Thread::Current()->set_socketserver(old_ss_);
323 }
324 323
325 private: 324 private:
326 SocketServer* old_ss_; 325 private:
tommi 2017/04/27 13:57:07 super private? :)
nisse-webrtc 2017/04/27 14:08:56 Top-secret! And deleted.
326 rtc::Thread* old_thread_;
327 327
328 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(SocketServerScope); 328 RTC_DISALLOW_COPY_AND_ASSIGN(AutoSocketServerThread);
329 }; 329 };
330 330
331 } // namespace rtc 331 } // namespace rtc
332 332
333 #endif // WEBRTC_BASE_THREAD_H_ 333 #endif // WEBRTC_BASE_THREAD_H_
OLDNEW
« no previous file with comments | « webrtc/base/ssladapter_unittest.cc ('k') | webrtc/base/thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698