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

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

Issue 2828223002: Delete method MessageQueue::set_socketserver (Closed)
Patch Set: Use unique_ptr, fixing one leak in VirtualSocketServerTest. 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 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 } 521 }
522 } 522 }
523 523
524 AutoThread::~AutoThread() { 524 AutoThread::~AutoThread() {
525 Stop(); 525 Stop();
526 if (ThreadManager::Instance()->CurrentThread() == this) { 526 if (ThreadManager::Instance()->CurrentThread() == this) {
527 ThreadManager::Instance()->SetCurrentThread(nullptr); 527 ThreadManager::Instance()->SetCurrentThread(nullptr);
528 } 528 }
529 } 529 }
530 530
531 AutoSocketServerThread::AutoSocketServerThread(SocketServer* ss)
532 : Thread(ss) {
533 old_thread_ = ThreadManager::Instance()->CurrentThread();
534 rtc::ThreadManager::Instance()->SetCurrentThread(this);
535 if (old_thread_) {
536 MessageQueueManager::Remove(old_thread_);
537 }
538 }
539
540 AutoSocketServerThread::~AutoSocketServerThread() {
541 RTC_DCHECK(ThreadManager::Instance()->CurrentThread() == this);
542 // Some tests post destroy messages to this thread. To avoid memory
543 // leaks, we have to process those messages. In particular
544 // P2PTransportChannelPingTest, relying on the message posted in
545 // cricket::Connection::Destroy.
546 ProcessMessages(0);
547 rtc::ThreadManager::Instance()->SetCurrentThread(old_thread_);
548 if (old_thread_) {
549 MessageQueueManager::Add(old_thread_);
550 }
551 }
552
531 } // namespace rtc 553 } // namespace rtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698