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

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

Issue 1311903004: Replacing SSLIdentity* with scoped_refptr<RTCCertificate> in TransportDescriptionFactory layer (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 3 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 | « talk/app/webrtc/webrtcsession_unittest.cc ('k') | talk/session/media/mediasession_unittest.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 * libjingle 2 * libjingle
3 * Copyright 2013 Google Inc. 3 * Copyright 2013 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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 // Skip MSG_USE_CONSTRUCTOR_CERTIFICATE because we don't want to trigger 248 // Skip MSG_USE_CONSTRUCTOR_CERTIFICATE because we don't want to trigger
249 // SetIdentity-related callbacks in the destructor. This can be a problem 249 // SetIdentity-related callbacks in the destructor. This can be a problem
250 // when WebRtcSession listens to the callback but it was the WebRtcSession 250 // when WebRtcSession listens to the callback but it was the WebRtcSession
251 // destructor that caused WebRtcSessionDescriptionFactory's destruction. 251 // destructor that caused WebRtcSessionDescriptionFactory's destruction.
252 // The callback is then ignored, leaking memory allocated by OnMessage for 252 // The callback is then ignored, leaking memory allocated by OnMessage for
253 // MSG_USE_CONSTRUCTOR_CERTIFICATE. 253 // MSG_USE_CONSTRUCTOR_CERTIFICATE.
254 delete msg.pdata; 254 delete msg.pdata;
255 } 255 }
256 } 256 }
257 257
258 transport_desc_factory_.set_identity(NULL); 258 transport_desc_factory_.set_certificate(nullptr);
259 } 259 }
260 260
261 void WebRtcSessionDescriptionFactory::CreateOffer( 261 void WebRtcSessionDescriptionFactory::CreateOffer(
262 CreateSessionDescriptionObserver* observer, 262 CreateSessionDescriptionObserver* observer,
263 const PeerConnectionInterface::RTCOfferAnswerOptions& options) { 263 const PeerConnectionInterface::RTCOfferAnswerOptions& options) {
264 cricket::MediaSessionOptions session_options; 264 cricket::MediaSessionOptions session_options;
265 265
266 std::string error = "CreateOffer"; 266 std::string error = "CreateOffer";
267 if (certificate_request_state_ == CERTIFICATE_FAILED) { 267 if (certificate_request_state_ == CERTIFICATE_FAILED) {
268 error += kFailedDueToIdentityFailed; 268 error += kFailedDueToIdentityFailed;
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 } 515 }
516 516
517 void WebRtcSessionDescriptionFactory::SetCertificate( 517 void WebRtcSessionDescriptionFactory::SetCertificate(
518 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate) { 518 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate) {
519 DCHECK(certificate); 519 DCHECK(certificate);
520 LOG(LS_VERBOSE) << "Setting new certificate"; 520 LOG(LS_VERBOSE) << "Setting new certificate";
521 521
522 certificate_request_state_ = CERTIFICATE_SUCCEEDED; 522 certificate_request_state_ = CERTIFICATE_SUCCEEDED;
523 SignalCertificateReady(certificate); 523 SignalCertificateReady(certificate);
524 524
525 // TODO(hbos): set_certificate 525 transport_desc_factory_.set_certificate(certificate);
526 transport_desc_factory_.set_identity(certificate->identity());
527 transport_desc_factory_.set_secure(cricket::SEC_ENABLED); 526 transport_desc_factory_.set_secure(cricket::SEC_ENABLED);
528 527
529 while (!create_session_description_requests_.empty()) { 528 while (!create_session_description_requests_.empty()) {
530 if (create_session_description_requests_.front().type == 529 if (create_session_description_requests_.front().type ==
531 CreateSessionDescriptionRequest::kOffer) { 530 CreateSessionDescriptionRequest::kOffer) {
532 InternalCreateOffer(create_session_description_requests_.front()); 531 InternalCreateOffer(create_session_description_requests_.front());
533 } else { 532 } else {
534 InternalCreateAnswer(create_session_description_requests_.front()); 533 InternalCreateAnswer(create_session_description_requests_.front());
535 } 534 }
536 create_session_description_requests_.pop(); 535 create_session_description_requests_.pop();
537 } 536 }
538 } 537 }
539 } // namespace webrtc 538 } // namespace webrtc
OLDNEW
« no previous file with comments | « talk/app/webrtc/webrtcsession_unittest.cc ('k') | talk/session/media/mediasession_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698