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

Side by Side Diff: talk/app/webrtc/dtmfsender.cc

Issue 1590333004: Making WebRtcSession fire a destroyed signal. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 11 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 * libjingle 2 * libjingle
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 rtc::Thread* signaling_thread, 92 rtc::Thread* signaling_thread,
93 DtmfProviderInterface* provider) 93 DtmfProviderInterface* provider)
94 : track_(track), 94 : track_(track),
95 observer_(NULL), 95 observer_(NULL),
96 signaling_thread_(signaling_thread), 96 signaling_thread_(signaling_thread),
97 provider_(provider), 97 provider_(provider),
98 duration_(kDtmfDefaultDurationMs), 98 duration_(kDtmfDefaultDurationMs),
99 inter_tone_gap_(kDtmfDefaultGapMs) { 99 inter_tone_gap_(kDtmfDefaultGapMs) {
100 ASSERT(track_ != NULL); 100 ASSERT(track_ != NULL);
101 ASSERT(signaling_thread_ != NULL); 101 ASSERT(signaling_thread_ != NULL);
102 // TODO(deadbeef): Once we can use shared_ptr and weak_ptr,
103 // do that instead of relying on a "destroyed" signal.
102 if (provider_) { 104 if (provider_) {
103 ASSERT(provider_->GetOnDestroyedSignal() != NULL); 105 ASSERT(provider_->GetOnDestroyedSignal() != NULL);
104 provider_->GetOnDestroyedSignal()->connect( 106 provider_->GetOnDestroyedSignal()->connect(
105 this, &DtmfSender::OnProviderDestroyed); 107 this, &DtmfSender::OnProviderDestroyed);
106 } 108 }
107 } 109 }
108 110
109 DtmfSender::~DtmfSender() { 111 DtmfSender::~DtmfSender() {
110 if (provider_) {
111 ASSERT(provider_->GetOnDestroyedSignal() != NULL);
112 provider_->GetOnDestroyedSignal()->disconnect(this);
Taylor Brandstetter 2016/01/16 00:55:10 This doesn't hurt anything, but it's pointless sin
113 }
114 StopSending(); 112 StopSending();
115 } 113 }
116 114
117 void DtmfSender::RegisterObserver(DtmfSenderObserverInterface* observer) { 115 void DtmfSender::RegisterObserver(DtmfSenderObserverInterface* observer) {
118 observer_ = observer; 116 observer_ = observer;
119 } 117 }
120 118
121 void DtmfSender::UnregisterObserver() { 119 void DtmfSender::UnregisterObserver() {
122 observer_ = NULL; 120 observer_ = NULL;
123 } 121 }
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 LOG(LS_INFO) << "The Dtmf provider is deleted. Clear the sending queue."; 246 LOG(LS_INFO) << "The Dtmf provider is deleted. Clear the sending queue.";
249 StopSending(); 247 StopSending();
250 provider_ = NULL; 248 provider_ = NULL;
251 } 249 }
252 250
253 void DtmfSender::StopSending() { 251 void DtmfSender::StopSending() {
254 signaling_thread_->Clear(this); 252 signaling_thread_->Clear(this);
255 } 253 }
256 254
257 } // namespace webrtc 255 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | talk/app/webrtc/webrtcsession.h » ('j') | talk/app/webrtc/webrtcsession_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698