From cebf0a2728b3a5647258604d9f967ed62315df89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Bostr=C3=B6m?= Date: Wed, 1 Jun 2016 15:45:30 +0200 Subject: [PATCH] Remove PeerConnectionFactory's certificate generator and ref counted wrapper. Clean-up. The idea behind the factory having a certificate generator was that it would reuse it with any peer connection it creates unless otherwise specified. This generator was originally a DtlsIdentityStoreImpl store which preemptively generated RSA-1024 in the background, giving any peer connection using RSA-1024 a head-start (generate before requesting). But now that 1) the store has been replaced by a generator that does not do preemptive generation and 2) the default is ECDSA, not RSA-1024, it is unnecessary for the factory to have this code. BUG=webrtc:5707, webrtc:5708 R=tommi@webrtc.org Review URL: https://codereview.webrtc.org/2021663002 . Cr-Commit-Position: refs/heads/master@{#12993} --- webrtc/api/peerconnectionfactory.cc | 40 +++-------------------------- webrtc/api/peerconnectionfactory.h | 5 ---- 2 files changed, 3 insertions(+), 42 deletions(-) diff --git a/webrtc/api/peerconnectionfactory.cc b/webrtc/api/peerconnectionfactory.cc index 9a58452d2d..178c59bb12 100644 --- a/webrtc/api/peerconnectionfactory.cc +++ b/webrtc/api/peerconnectionfactory.cc @@ -34,33 +34,6 @@ namespace webrtc { -namespace { - -// Passes down the calls to |cert_generator_|. See usage in -// |CreatePeerConnection|. -class RTCCertificateGeneratorWrapper - : public rtc::RTCCertificateGeneratorInterface { - public: - RTCCertificateGeneratorWrapper( - const rtc::scoped_refptr& cert_gen) - : cert_generator_(cert_gen) { - RTC_DCHECK(cert_generator_); - } - - void GenerateCertificateAsync( - const rtc::KeyParams& key_params, - const rtc::Optional& expires_ms, - const rtc::scoped_refptr& callback) - override { - cert_generator_->GenerateCertificateAsync(key_params, expires_ms, callback); - } - - private: - rtc::scoped_refptr cert_generator_; -}; - -} // anonymous namespace - rtc::scoped_refptr CreatePeerConnectionFactory() { rtc::scoped_refptr pc_factory( @@ -143,9 +116,7 @@ PeerConnectionFactory::~PeerConnectionFactory() { channel_manager_.reset(nullptr); // Make sure |worker_thread_| and |signaling_thread_| outlive - // |cert_generator_|, |default_socket_factory_| and - // |default_network_manager_|. - cert_generator_ = nullptr; + // |default_socket_factory_| and |default_network_manager_|. default_socket_factory_ = nullptr; default_network_manager_ = nullptr; @@ -186,9 +157,6 @@ bool PeerConnectionFactory::Initialize() { return false; } - cert_generator_ = - new RefCountedRTCCertificateGenerator(signaling_thread_, network_thread_); - return true; } @@ -278,11 +246,9 @@ PeerConnectionFactory::CreatePeerConnection( RTC_DCHECK(signaling_thread_->IsCurrent()); if (!cert_generator.get()) { - // Because |pc|->Initialize takes ownership of the generator we need a new - // wrapper object that can be deleted without deleting the underlying - // |cert_generator_|, protecting it from being deleted multiple times. + // No certificate generator specified, use the default one. cert_generator.reset( - new RTCCertificateGeneratorWrapper(cert_generator_)); + new rtc::RTCCertificateGenerator(signaling_thread_, network_thread_)); } if (!allocator) { diff --git a/webrtc/api/peerconnectionfactory.h b/webrtc/api/peerconnectionfactory.h index 66561ad9d3..0e52efcc96 100644 --- a/webrtc/api/peerconnectionfactory.h +++ b/webrtc/api/peerconnectionfactory.h @@ -29,9 +29,6 @@ class BasicPacketSocketFactory; namespace webrtc { -typedef rtc::RefCountedObject - RefCountedRTCCertificateGenerator; - class PeerConnectionFactory : public PeerConnectionFactoryInterface { public: void SetOptions(const Options& options) override { @@ -128,8 +125,6 @@ class PeerConnectionFactory : public PeerConnectionFactoryInterface { std::unique_ptr video_decoder_factory_; std::unique_ptr default_network_manager_; std::unique_ptr default_socket_factory_; - - rtc::scoped_refptr cert_generator_; }; } // namespace webrtc