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

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

Issue 2828223002: Delete method MessageQueue::set_socketserver (Closed)
Patch Set: Fix memory leak in SSLAdapterTestBase. Created 3 years, 7 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 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 and 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 {
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 rtc::Thread* old_thread_;
327 326
328 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(SocketServerScope); 327 RTC_DISALLOW_COPY_AND_ASSIGN(AutoSocketServerThread);
329 }; 328 };
330 329
331 } // namespace rtc 330 } // namespace rtc
332 331
333 #endif // WEBRTC_BASE_THREAD_H_ 332 #endif // WEBRTC_BASE_THREAD_H_
OLDNEW
« no previous file with comments | « webrtc/base/ssladapter_unittest.cc ('k') | webrtc/base/thread.cc » ('j') | webrtc/base/thread.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698