| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2013 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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 | 138 |
| 139 if (certificate) { | 139 if (certificate) { |
| 140 // Use |certificate|. | 140 // Use |certificate|. |
| 141 certificate_request_state_ = CERTIFICATE_WAITING; | 141 certificate_request_state_ = CERTIFICATE_WAITING; |
| 142 | 142 |
| 143 LOG(LS_VERBOSE) << "DTLS-SRTP enabled; has certificate parameter."; | 143 LOG(LS_VERBOSE) << "DTLS-SRTP enabled; has certificate parameter."; |
| 144 // We already have a certificate but we wait to do |SetIdentity|; if we do | 144 // We already have a certificate but we wait to do |SetIdentity|; if we do |
| 145 // it in the constructor then the caller has not had a chance to connect to | 145 // it in the constructor then the caller has not had a chance to connect to |
| 146 // |SignalCertificateReady|. | 146 // |SignalCertificateReady|. |
| 147 signaling_thread_->Post( | 147 signaling_thread_->Post( |
| 148 this, MSG_USE_CONSTRUCTOR_CERTIFICATE, | 148 RTC_FROM_HERE, this, MSG_USE_CONSTRUCTOR_CERTIFICATE, |
| 149 new rtc::ScopedRefMessageData<rtc::RTCCertificate>(certificate)); | 149 new rtc::ScopedRefMessageData<rtc::RTCCertificate>(certificate)); |
| 150 } else { | 150 } else { |
| 151 // Generate certificate. | 151 // Generate certificate. |
| 152 certificate_request_state_ = CERTIFICATE_WAITING; | 152 certificate_request_state_ = CERTIFICATE_WAITING; |
| 153 | 153 |
| 154 rtc::scoped_refptr<WebRtcCertificateGeneratorCallback> callback( | 154 rtc::scoped_refptr<WebRtcCertificateGeneratorCallback> callback( |
| 155 new rtc::RefCountedObject<WebRtcCertificateGeneratorCallback>()); | 155 new rtc::RefCountedObject<WebRtcCertificateGeneratorCallback>()); |
| 156 callback->SignalRequestFailed.connect( | 156 callback->SignalRequestFailed.connect( |
| 157 this, &WebRtcSessionDescriptionFactory::OnCertificateRequestFailed); | 157 this, &WebRtcSessionDescriptionFactory::OnCertificateRequestFailed); |
| 158 callback->SignalCertificateReady.connect( | 158 callback->SignalCertificateReady.connect( |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 ((request.type == CreateSessionDescriptionRequest::kOffer) ? | 443 ((request.type == CreateSessionDescriptionRequest::kOffer) ? |
| 444 "CreateOffer" : "CreateAnswer") + reason); | 444 "CreateOffer" : "CreateAnswer") + reason); |
| 445 create_session_description_requests_.pop(); | 445 create_session_description_requests_.pop(); |
| 446 } | 446 } |
| 447 } | 447 } |
| 448 | 448 |
| 449 void WebRtcSessionDescriptionFactory::PostCreateSessionDescriptionFailed( | 449 void WebRtcSessionDescriptionFactory::PostCreateSessionDescriptionFailed( |
| 450 CreateSessionDescriptionObserver* observer, const std::string& error) { | 450 CreateSessionDescriptionObserver* observer, const std::string& error) { |
| 451 CreateSessionDescriptionMsg* msg = new CreateSessionDescriptionMsg(observer); | 451 CreateSessionDescriptionMsg* msg = new CreateSessionDescriptionMsg(observer); |
| 452 msg->error = error; | 452 msg->error = error; |
| 453 signaling_thread_->Post(this, MSG_CREATE_SESSIONDESCRIPTION_FAILED, msg); | 453 signaling_thread_->Post(RTC_FROM_HERE, this, |
| 454 MSG_CREATE_SESSIONDESCRIPTION_FAILED, msg); |
| 454 LOG(LS_ERROR) << "Create SDP failed: " << error; | 455 LOG(LS_ERROR) << "Create SDP failed: " << error; |
| 455 } | 456 } |
| 456 | 457 |
| 457 void WebRtcSessionDescriptionFactory::PostCreateSessionDescriptionSucceeded( | 458 void WebRtcSessionDescriptionFactory::PostCreateSessionDescriptionSucceeded( |
| 458 CreateSessionDescriptionObserver* observer, | 459 CreateSessionDescriptionObserver* observer, |
| 459 SessionDescriptionInterface* description) { | 460 SessionDescriptionInterface* description) { |
| 460 CreateSessionDescriptionMsg* msg = new CreateSessionDescriptionMsg(observer); | 461 CreateSessionDescriptionMsg* msg = new CreateSessionDescriptionMsg(observer); |
| 461 msg->description.reset(description); | 462 msg->description.reset(description); |
| 462 signaling_thread_->Post(this, MSG_CREATE_SESSIONDESCRIPTION_SUCCESS, msg); | 463 signaling_thread_->Post(RTC_FROM_HERE, this, |
| 464 MSG_CREATE_SESSIONDESCRIPTION_SUCCESS, msg); |
| 463 } | 465 } |
| 464 | 466 |
| 465 void WebRtcSessionDescriptionFactory::OnCertificateRequestFailed() { | 467 void WebRtcSessionDescriptionFactory::OnCertificateRequestFailed() { |
| 466 ASSERT(signaling_thread_->IsCurrent()); | 468 ASSERT(signaling_thread_->IsCurrent()); |
| 467 | 469 |
| 468 LOG(LS_ERROR) << "Asynchronous certificate generation request failed."; | 470 LOG(LS_ERROR) << "Asynchronous certificate generation request failed."; |
| 469 certificate_request_state_ = CERTIFICATE_FAILED; | 471 certificate_request_state_ = CERTIFICATE_FAILED; |
| 470 | 472 |
| 471 FailPendingRequests(kFailedDueToIdentityFailed); | 473 FailPendingRequests(kFailedDueToIdentityFailed); |
| 472 } | 474 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 486 if (create_session_description_requests_.front().type == | 488 if (create_session_description_requests_.front().type == |
| 487 CreateSessionDescriptionRequest::kOffer) { | 489 CreateSessionDescriptionRequest::kOffer) { |
| 488 InternalCreateOffer(create_session_description_requests_.front()); | 490 InternalCreateOffer(create_session_description_requests_.front()); |
| 489 } else { | 491 } else { |
| 490 InternalCreateAnswer(create_session_description_requests_.front()); | 492 InternalCreateAnswer(create_session_description_requests_.front()); |
| 491 } | 493 } |
| 492 create_session_description_requests_.pop(); | 494 create_session_description_requests_.pop(); |
| 493 } | 495 } |
| 494 } | 496 } |
| 495 } // namespace webrtc | 497 } // namespace webrtc |
| OLD | NEW |