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

Unified Diff: webrtc/p2p/base/fakesession.h

Issue 1304043008: Replacing SSLIdentity* with scoped_refptr<RTCCertificate> in TransportChannel 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/p2p/base/fakesession.h
diff --git a/webrtc/p2p/base/fakesession.h b/webrtc/p2p/base/fakesession.h
index 5597a44dface14acd8ef4944596a42fc5c6830e8..e8a8c77c706251ede386f1d60d2fb462f8cb9f6a 100644
--- a/webrtc/p2p/base/fakesession.h
+++ b/webrtc/p2p/base/fakesession.h
@@ -47,15 +47,15 @@ class FakeTransportChannel : public TransportChannelImpl,
int component)
: TransportChannelImpl(content_name, component),
transport_(transport),
- dest_(NULL),
+ dest_(nullptr),
state_(STATE_INIT),
async_(false),
- identity_(NULL),
+ certificate_(nullptr),
tommi 2015/09/03 20:06:04 no need to include in initializer list
hbos 2015/09/07 08:11:01 Done.
do_dtls_(false),
role_(ICEROLE_UNKNOWN),
tiebreaker_(0),
remote_ice_mode_(ICEMODE_FULL),
- dtls_fingerprint_("", NULL, 0),
+ dtls_fingerprint_("", nullptr, 0),
ssl_role_(rtc::SSL_CLIENT),
connection_count_(0) {
}
@@ -147,7 +147,7 @@ class FakeTransportChannel : public TransportChannelImpl,
// This simulates the delivery of candidates.
dest_ = dest;
dest_->dest_ = this;
- if (identity_ && dest_->identity_) {
+ if (certificate_ && dest_->certificate_) {
do_dtls_ = true;
dest_->do_dtls_ = true;
NegotiateSrtpCiphers();
@@ -218,13 +218,13 @@ class FakeTransportChannel : public TransportChannelImpl,
delete data;
}
- bool SetLocalIdentity(rtc::SSLIdentity* identity) {
- identity_ = identity;
+ bool SetLocalCertificate(
+ const rtc::scoped_refptr<rtc::RTCCertificate>& certificate) override {
+ certificate_ = certificate;
return true;
}
-
- void SetRemoteCertificate(rtc::FakeSSLCertificate* cert) {
+ void SetRemoteSSLCertificate(rtc::FakeSSLCertificate* cert) {
remote_cert_ = cert;
}
@@ -249,15 +249,16 @@ class FakeTransportChannel : public TransportChannelImpl,
return false;
}
- virtual bool GetLocalIdentity(rtc::SSLIdentity** identity) const {
- if (!identity_)
+ bool GetLocalCertificate(
+ rtc::scoped_refptr<rtc::RTCCertificate>* certificate) const override {
tommi 2015/09/03 20:06:04 I wonder if we should just change this method to r
hbos 2015/09/07 08:11:01 Done, except I made it (non-const non-ref) scoped_
+ if (!certificate_)
return false;
- *identity = identity_->GetReference();
+ *certificate = certificate_;
return true;
}
- virtual bool GetRemoteCertificate(rtc::SSLCertificate** cert) const {
+ bool GetRemoteSSLCertificate(rtc::SSLCertificate** cert) const override {
if (!remote_cert_)
return false;
@@ -307,7 +308,7 @@ class FakeTransportChannel : public TransportChannelImpl,
FakeTransportChannel* dest_;
State state_;
bool async_;
- rtc::SSLIdentity* identity_;
+ rtc::scoped_refptr<rtc::RTCCertificate> certificate_;
rtc::FakeSSLCertificate* remote_cert_;
bool do_dtls_;
std::vector<std::string> srtp_ciphers_;
@@ -350,9 +351,7 @@ class FakeTransport : public Transport {
dest_ = dest;
for (ChannelMap::iterator it = channels_.begin(); it != channels_.end();
++it) {
- // TODO(hbos): SetLocalCertificate
- it->second->SetLocalIdentity(
- certificate_ ? certificate_->identity() : nullptr);
+ it->second->SetLocalCertificate(certificate_);
SetChannelDestination(it->first, it->second);
}
}
@@ -411,11 +410,8 @@ class FakeTransport : public Transport {
FakeTransportChannel* dest_channel = NULL;
if (dest_) {
dest_channel = dest_->GetFakeChannel(component);
- if (dest_channel) {
- // TODO(hbos): SetLocalCertificate
- dest_channel->SetLocalIdentity(
- dest_->certificate_ ? dest_->certificate_->identity() : nullptr);
- }
+ if (dest_channel)
+ dest_channel->SetLocalCertificate(dest_->certificate_);
}
channel->SetDestination(dest_channel);
}

Powered by Google App Engine
This is Rietveld 408576698