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}
This commit is contained in:
Henrik Boström 2016-06-01 15:45:30 +02:00
parent a1ed0b3241
commit cebf0a2728
2 changed files with 3 additions and 42 deletions

View File

@ -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<RefCountedRTCCertificateGenerator>& cert_gen)
: cert_generator_(cert_gen) {
RTC_DCHECK(cert_generator_);
}
void GenerateCertificateAsync(
const rtc::KeyParams& key_params,
const rtc::Optional<uint64_t>& expires_ms,
const rtc::scoped_refptr<rtc::RTCCertificateGeneratorCallback>& callback)
override {
cert_generator_->GenerateCertificateAsync(key_params, expires_ms, callback);
}
private:
rtc::scoped_refptr<RefCountedRTCCertificateGenerator> cert_generator_;
};
} // anonymous namespace
rtc::scoped_refptr<PeerConnectionFactoryInterface>
CreatePeerConnectionFactory() {
rtc::scoped_refptr<PeerConnectionFactory> 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) {

View File

@ -29,9 +29,6 @@ class BasicPacketSocketFactory;
namespace webrtc {
typedef rtc::RefCountedObject<rtc::RTCCertificateGenerator>
RefCountedRTCCertificateGenerator;
class PeerConnectionFactory : public PeerConnectionFactoryInterface {
public:
void SetOptions(const Options& options) override {
@ -128,8 +125,6 @@ class PeerConnectionFactory : public PeerConnectionFactoryInterface {
std::unique_ptr<cricket::WebRtcVideoDecoderFactory> video_decoder_factory_;
std::unique_ptr<rtc::BasicNetworkManager> default_network_manager_;
std::unique_ptr<rtc::BasicPacketSocketFactory> default_socket_factory_;
rtc::scoped_refptr<RefCountedRTCCertificateGenerator> cert_generator_;
};
} // namespace webrtc