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

Unified Diff: talk/app/webrtc/peerconnectionfactory.cc

Issue 1176383004: DtlsIdentityStore[Interface/Impl] updated, DtlsIdentityService to be removed (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Merge w master AFTER the landing of 1268363002. "CreatePC(service,store)" using store instead of service. Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « talk/app/webrtc/peerconnectionfactory.h ('k') | talk/app/webrtc/peerconnectionfactory_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: talk/app/webrtc/peerconnectionfactory.cc
diff --git a/talk/app/webrtc/peerconnectionfactory.cc b/talk/app/webrtc/peerconnectionfactory.cc
index 3524af7932a4f92f60da84e552f742d1a2aaa7ac..26765d21097ff81a791b4ac54b64fa207eb0d48c 100644
--- a/talk/app/webrtc/peerconnectionfactory.cc
+++ b/talk/app/webrtc/peerconnectionfactory.cc
@@ -28,8 +28,6 @@
#include "talk/app/webrtc/peerconnectionfactory.h"
#include "talk/app/webrtc/audiotrack.h"
-#include "talk/app/webrtc/dtlsidentityservice.h"
-#include "talk/app/webrtc/dtlsidentitystore.h"
#include "talk/app/webrtc/localaudiosource.h"
#include "talk/app/webrtc/mediastreamproxy.h"
#include "talk/app/webrtc/mediastreamtrackproxy.h"
@@ -49,6 +47,30 @@
namespace webrtc {
+namespace {
+
+// Passes down the calls to |store_|. See usage in CreatePeerConnection.
+class DtlsIdentityStoreWrapper : public DtlsIdentityStoreInterface {
+ public:
+ DtlsIdentityStoreWrapper(
+ const rtc::scoped_refptr<RefCountedDtlsIdentityStore>& store)
+ : store_(store) {
+ DCHECK(store_);
+ }
+
+ void RequestIdentity(
+ rtc::KeyType key_type,
+ const rtc::scoped_refptr<webrtc::DtlsIdentityRequestObserver>&
+ observer) override {
+ store_->RequestIdentity(key_type, observer);
+ }
+
+ private:
+ rtc::scoped_refptr<RefCountedDtlsIdentityStore> store_;
+};
+
+} // anonymous namespace
+
rtc::scoped_refptr<PeerConnectionFactoryInterface>
CreatePeerConnectionFactory() {
rtc::scoped_refptr<PeerConnectionFactory> pc_factory(
@@ -130,12 +152,12 @@ PeerConnectionFactory::PeerConnectionFactory(
PeerConnectionFactory::~PeerConnectionFactory() {
DCHECK(signaling_thread_->IsCurrent());
- channel_manager_.reset(NULL);
- default_allocator_factory_ = NULL;
+ channel_manager_.reset(nullptr);
+ default_allocator_factory_ = nullptr;
// Make sure |worker_thread_| and |signaling_thread_| outlive
// |dtls_identity_store_|.
- dtls_identity_store_.reset(NULL);
+ dtls_identity_store_ = nullptr;
if (owns_ptrs_) {
if (wraps_current_thread_)
@@ -169,9 +191,8 @@ bool PeerConnectionFactory::Initialize() {
return false;
}
- dtls_identity_store_.reset(
- new DtlsIdentityStore(signaling_thread_, worker_thread_));
- dtls_identity_store_->Initialize();
+ dtls_identity_store_ = new RefCountedDtlsIdentityStore(
+ signaling_thread_, worker_thread_);
return true;
}
@@ -205,13 +226,17 @@ PeerConnectionFactory::CreatePeerConnection(
const PeerConnectionInterface::RTCConfiguration& configuration,
const MediaConstraintsInterface* constraints,
PortAllocatorFactoryInterface* allocator_factory,
- DTLSIdentityServiceInterface* dtls_identity_service,
+ rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store,
PeerConnectionObserver* observer) {
DCHECK(signaling_thread_->IsCurrent());
DCHECK(allocator_factory || default_allocator_factory_);
- if (!dtls_identity_service) {
- dtls_identity_service = new DtlsIdentityService(dtls_identity_store_.get());
+ if (!dtls_identity_store.get()) {
+ // Because |pc|->Initialize takes ownership of the store we need a new
+ // wrapper object that can be deleted without deleting the underlying
+ // |dtls_identity_store_|, protecting it from being deleted multiple times.
+ dtls_identity_store.reset(
+ new DtlsIdentityStoreWrapper(dtls_identity_store_));
}
PortAllocatorFactoryInterface* chosen_allocator_factory =
@@ -224,7 +249,7 @@ PeerConnectionFactory::CreatePeerConnection(
configuration,
constraints,
chosen_allocator_factory,
- dtls_identity_service,
+ dtls_identity_store.Pass(),
observer)) {
return NULL;
}
« no previous file with comments | « talk/app/webrtc/peerconnectionfactory.h ('k') | talk/app/webrtc/peerconnectionfactory_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698