Commit f4ff752c authored by Florent Castelli's avatar Florent Castelli Committed by Commit Bot

Onion-soup WebRTCCertficate to rtc::RTCCertificate

Bug: 787254
Change-Id: I44dd447f8799a4b1ff45da609112e46294e89747
Reviewed-on: https://chromium-review.googlesource.com/1175919
Commit-Queue: Florent Castelli <orphis@chromium.org>
Reviewed-by: default avatarGuido Urdaneta <guidou@chromium.org>
Reviewed-by: default avatarPhilip Jägenstedt <foolip@chromium.org>
Reviewed-by: default avatarTommi <tommi@chromium.org>
Reviewed-by: default avatarHarald Alvestrand <hta@chromium.org>
Cr-Commit-Position: refs/heads/master@{#583697}
parent fcab2347
......@@ -382,8 +382,6 @@ target(link_target_type, "renderer") {
"media/webrtc/peer_connection_remote_audio_source.h",
"media/webrtc/peer_connection_tracker.cc",
"media/webrtc/peer_connection_tracker.h",
"media/webrtc/rtc_certificate.cc",
"media/webrtc/rtc_certificate.h",
"media/webrtc/rtc_certificate_generator.cc",
"media/webrtc/rtc_certificate_generator.h",
"media/webrtc/rtc_data_channel_handler.cc",
......
// Copyright (c) 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/renderer/media/webrtc/rtc_certificate.h"
#include <vector>
#include "base/memory/ptr_util.h"
#include "base/strings/string_util.h"
#include "third_party/webrtc/rtc_base/sslidentity.h"
#include "url/gurl.h"
namespace content {
RTCCertificate::RTCCertificate(
const rtc::scoped_refptr<rtc::RTCCertificate>& certificate)
: certificate_(certificate) {
DCHECK(certificate_);
}
RTCCertificate::~RTCCertificate() {
}
std::unique_ptr<blink::WebRTCCertificate> RTCCertificate::ShallowCopy() const {
return base::WrapUnique(new RTCCertificate(certificate_));
}
uint64_t RTCCertificate::Expires() const {
return certificate_->Expires();
}
blink::WebVector<blink::WebRTCDtlsFingerprint> RTCCertificate::GetFingerprints()
const {
std::vector<blink::WebRTCDtlsFingerprint> fingerprints;
std::unique_ptr<rtc::SSLCertificateStats> first_certificate_stats =
certificate_->identity()->certificate().GetStats();
for (rtc::SSLCertificateStats* certificate_stats =
first_certificate_stats.get();
certificate_stats; certificate_stats = certificate_stats->issuer.get()) {
fingerprints.push_back(blink::WebRTCDtlsFingerprint(
blink::WebString::FromUTF8(certificate_stats->fingerprint_algorithm),
blink::WebString::FromUTF8(
base::ToLowerASCII(certificate_stats->fingerprint))));
}
return blink::WebVector<blink::WebRTCDtlsFingerprint>(fingerprints);
}
blink::WebRTCCertificatePEM RTCCertificate::ToPEM() const {
rtc::RTCCertificatePEM pem = certificate_->ToPEM();
return blink::WebRTCCertificatePEM(
blink::WebString::FromUTF8(pem.private_key()),
blink::WebString::FromUTF8(pem.certificate()));
}
bool RTCCertificate::Equals(const blink::WebRTCCertificate& other) const {
return *certificate_ ==
*static_cast<const RTCCertificate&>(other).certificate_;
}
const rtc::scoped_refptr<rtc::RTCCertificate>&
RTCCertificate::rtcCertificate() const {
return certificate_;
}
} // namespace content
// Copyright (c) 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_RENDERER_MEDIA_WEBRTC_RTC_CERTIFICATE_H_
#define CONTENT_RENDERER_MEDIA_WEBRTC_RTC_CERTIFICATE_H_
#include <stdint.h>
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "content/common/content_export.h"
#include "third_party/blink/public/platform/web_rtc_certificate.h"
#include "third_party/webrtc/rtc_base/rtccertificate.h"
#include "third_party/webrtc/rtc_base/scoped_ref_ptr.h"
namespace content {
// Chromium's WebRTCCertificate implementation; wraps a rtc::scoped_refptr to an
// rtc::RTCCertificate. This abstraction layer is necessary because blink does
// not have direct access to WebRTC.
class CONTENT_EXPORT RTCCertificate : public blink::WebRTCCertificate {
public:
RTCCertificate(const rtc::scoped_refptr<rtc::RTCCertificate>& certificate);
~RTCCertificate() override;
// blink::WebRTCCertificate implementation.
std::unique_ptr<blink::WebRTCCertificate> ShallowCopy() const override;
uint64_t Expires() const override;
blink::WebVector<blink::WebRTCDtlsFingerprint> GetFingerprints()
const override;
blink::WebRTCCertificatePEM ToPEM() const override;
bool Equals(const blink::WebRTCCertificate& other) const override;
const rtc::scoped_refptr<rtc::RTCCertificate>& rtcCertificate() const;
private:
rtc::scoped_refptr<rtc::RTCCertificate> certificate_;
DISALLOW_COPY_AND_ASSIGN(RTCCertificate);
};
} // namespace content
#endif // CONTENT_RENDERER_MEDIA_WEBRTC_RTC_CERTIFICATE_H_
......@@ -12,7 +12,6 @@
#include "base/single_thread_task_runner.h"
#include "base/threading/thread_task_runner_handle.h"
#include "content/renderer/media/webrtc/peer_connection_dependency_factory.h"
#include "content/renderer/media/webrtc/rtc_certificate.h"
#include "content/renderer/render_thread_impl.h"
#include "media/media_buildflags.h"
#include "third_party/webrtc/rtc_base/rtccertificate.h"
......@@ -91,15 +90,12 @@ class RTCCertificateGeneratorRequest
main_thread_->PostTask(
FROM_HERE,
base::BindOnce(&RTCCertificateGeneratorRequest::DoCallbackOnMainThread,
this, std::move(observer),
certificate
? std::make_unique<RTCCertificate>(certificate)
: nullptr));
this, std::move(observer), certificate));
}
void DoCallbackOnMainThread(
CertificateCallbackPtr observer,
std::unique_ptr<blink::WebRTCCertificate> certificate) {
rtc::scoped_refptr<rtc::RTCCertificate> certificate) {
DCHECK(main_thread_->BelongsToCurrentThread());
DCHECK(observer);
if (certificate)
......@@ -155,7 +151,7 @@ bool RTCCertificateGenerator::IsSupportedKeyParams(
return WebRTCKeyParamsToKeyParams(key_params).IsValid();
}
std::unique_ptr<blink::WebRTCCertificate> RTCCertificateGenerator::FromPEM(
rtc::scoped_refptr<rtc::RTCCertificate> RTCCertificateGenerator::FromPEM(
blink::WebString pem_private_key,
blink::WebString pem_certificate) {
rtc::scoped_refptr<rtc::RTCCertificate> certificate =
......@@ -163,7 +159,7 @@ std::unique_ptr<blink::WebRTCCertificate> RTCCertificateGenerator::FromPEM(
pem_private_key.Utf8(), pem_certificate.Utf8()));
if (!certificate)
return nullptr;
return std::make_unique<RTCCertificate>(certificate);
return certificate;
}
} // namespace content
......@@ -7,9 +7,9 @@
#include "base/macros.h"
#include "base/single_thread_task_runner.h"
#include "third_party/blink/public/platform/web_rtc_certificate.h"
#include "third_party/blink/public/platform/web_rtc_certificate_generator.h"
#include "third_party/blink/public/platform/web_rtc_key_params.h"
#include "third_party/webrtc/api/peerconnectioninterface.h"
namespace content {
......@@ -32,7 +32,7 @@ class RTCCertificateGenerator : public blink::WebRTCCertificateGenerator {
std::unique_ptr<blink::WebRTCCertificateCallback> observer,
scoped_refptr<base::SingleThreadTaskRunner> task_runner) override;
bool IsSupportedKeyParams(const blink::WebRTCKeyParams& key_params) override;
std::unique_ptr<blink::WebRTCCertificate> FromPEM(
rtc::scoped_refptr<rtc::RTCCertificate> FromPEM(
blink::WebString pem_private_key,
blink::WebString pem_certificate) override;
......
......@@ -30,7 +30,6 @@
#include "content/renderer/media/stream/media_stream_track.h"
#include "content/renderer/media/webrtc/peer_connection_dependency_factory.h"
#include "content/renderer/media/webrtc/peer_connection_tracker.h"
#include "content/renderer/media/webrtc/rtc_certificate.h"
#include "content/renderer/media/webrtc/rtc_data_channel_handler.h"
#include "content/renderer/media/webrtc/rtc_dtmf_sender_handler.h"
#include "content/renderer/media/webrtc/rtc_event_log_output_sink.h"
......@@ -214,11 +213,8 @@ void GetNativeRtcConfiguration(
}
webrtc_config->certificates.clear();
for (const std::unique_ptr<blink::WebRTCCertificate>& blink_certificate :
blink_config.certificates) {
webrtc_config->certificates.push_back(
static_cast<RTCCertificate*>(blink_certificate.get())
->rtcCertificate());
for (const auto& blink_certificate : blink_config.certificates) {
webrtc_config->certificates.push_back(blink_certificate);
}
webrtc_config->ice_candidate_pool_size = blink_config.ice_candidate_pool_size;
......
......@@ -50,7 +50,6 @@
#include "gin/v8_initializer.h" // nogncheck
#endif
#include "content/renderer/media/webrtc/rtc_certificate.h"
#include "third_party/webrtc/rtc_base/rtccertificate.h" // nogncheck
using blink::WebString;
......@@ -145,7 +144,6 @@ TestBlinkWebUnitTestSupport::TestBlinkWebUnitTestSupport()
gin::V8Initializer::LoadV8Natives();
#endif
scoped_refptr<base::SingleThreadTaskRunner> dummy_task_runner;
std::unique_ptr<base::ThreadTaskRunnerHandle> dummy_task_runner_handle;
if (!base::ThreadTaskRunnerHandle::IsSet()) {
......@@ -332,15 +330,13 @@ class TestWebRTCCertificateGenerator
bool IsSupportedKeyParams(const blink::WebRTCKeyParams& key_params) override {
return false;
}
std::unique_ptr<blink::WebRTCCertificate> FromPEM(
rtc::scoped_refptr<rtc::RTCCertificate> FromPEM(
blink::WebString pem_private_key,
blink::WebString pem_certificate) override {
rtc::scoped_refptr<rtc::RTCCertificate> certificate =
rtc::RTCCertificate::FromPEM(rtc::RTCCertificatePEM(
pem_private_key.Utf8(), pem_certificate.Utf8()));
if (!certificate)
return nullptr;
return std::make_unique<RTCCertificate>(certificate);
return certificate;
}
};
......
......@@ -331,7 +331,6 @@ source_set("blink_headers") {
"platform/web_resource_timing_info.h",
"platform/web_rtc_answer_options.h",
"platform/web_rtc_api_name.h",
"platform/web_rtc_certificate.h",
"platform/web_rtc_certificate_generator.h",
"platform/web_rtc_configuration.h",
"platform/web_rtc_data_channel_handler.h",
......
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_RTC_CERTIFICATE_H_
#define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_RTC_CERTIFICATE_H_
#include "third_party/blink/public/platform/web_vector.h"
#include "third_party/blink/public/platform/web_rtc_key_params.h"
#include "third_party/blink/public/platform/web_string.h"
#include <memory>
namespace blink {
// https://w3c.github.io/webrtc-pc/#rtcdtlsfingerprint*
class WebRTCDtlsFingerprint {
public:
WebRTCDtlsFingerprint(WebString algorithm, WebString value)
: algorithm_(algorithm), value_(value) {}
WebString Algorithm() const { return algorithm_; }
WebString Value() const { return value_; }
private:
WebString algorithm_;
WebString value_;
};
// Corresponds to |rtc::RTCCertificatePEM| in WebRTC.
// See |WebRTCCertificate::ToPEM| and |WebRTCCertificateGenerator::FromPEM|.
class WebRTCCertificatePEM {
public:
WebRTCCertificatePEM(WebString private_key, WebString certificate)
: private_key_(private_key), certificate_(certificate) {}
WebString PrivateKey() const { return private_key_; }
WebString Certificate() const { return certificate_; }
private:
WebString private_key_;
WebString certificate_;
};
// WebRTCCertificate is an interface defining what Blink needs to know about
// certificates, hiding Chromium and WebRTC layer implementation details. It is
// possible to create shallow copies of the WebRTCCertificate. When all copies
// are destroyed, the implementation specific data must be freed.
// WebRTCCertificate objects thus act as references to the reference counted
// internal data.
class WebRTCCertificate {
public:
WebRTCCertificate() = default;
virtual ~WebRTCCertificate() = default;
// Copies the WebRTCCertificate object without copying the underlying
// implementation specific (WebRTC layer) certificate. When all copies are
// destroyed the underlying data is freed.
virtual std::unique_ptr<WebRTCCertificate> ShallowCopy() const = 0;
// Returns the expiration time in ms relative to epoch, 1970-01-01T00:00:00Z.
virtual uint64_t Expires() const = 0;
virtual WebVector<WebRTCDtlsFingerprint> GetFingerprints() const = 0;
// Creates a PEM strings representation of the certificate. See also
// |WebRTCCertificateGenerator::FromPEM|.
virtual WebRTCCertificatePEM ToPEM() const = 0;
// Checks if the two certificate objects represent the same certificate value,
// as should be the case for a clone and the original.
virtual bool Equals(const WebRTCCertificate& other) const = 0;
private:
WebRTCCertificate(const WebRTCCertificate&) = delete;
WebRTCCertificate& operator=(const WebRTCCertificate&) = delete;
};
} // namespace blink
#endif // THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_RTC_CERTIFICATE_H_
......@@ -32,9 +32,9 @@
#define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_RTC_CERTIFICATE_GENERATOR_H_
#include "third_party/blink/public/platform/web_callbacks.h"
#include "third_party/blink/public/platform/web_rtc_certificate.h"
#include "third_party/blink/public/platform/web_rtc_key_params.h"
#include "third_party/blink/public/platform/web_string.h"
#include "third_party/webrtc/api/peerconnectioninterface.h"
#include <memory>
......@@ -45,7 +45,7 @@ class SingleThreadTaskRunner;
namespace blink {
using WebRTCCertificateCallback =
WebCallbacks<std::unique_ptr<WebRTCCertificate>, void>;
WebCallbacks<rtc::scoped_refptr<rtc::RTCCertificate>, void>;
// Interface defining a class that can generate WebRTCCertificates
// asynchronously.
......@@ -72,8 +72,8 @@ class WebRTCCertificateGenerator {
virtual bool IsSupportedKeyParams(const WebRTCKeyParams&) = 0;
// Creates a certificate from the PEM strings. See also
// |WebRTCCertificate::ToPEM|.
virtual std::unique_ptr<WebRTCCertificate> FromPEM(
// |rtc::RTCCertificate::ToPEM|.
virtual rtc::scoped_refptr<rtc::RTCCertificate> FromPEM(
blink::WebString pem_private_key,
blink::WebString pem_certificate) = 0;
};
......
......@@ -32,7 +32,6 @@
#define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_RTC_CONFIGURATION_H_
#include "third_party/blink/public/platform/web_common.h"
#include "third_party/blink/public/platform/web_rtc_certificate.h"
#include "third_party/blink/public/platform/web_vector.h"
#include "third_party/webrtc/api/peerconnectioninterface.h"
......@@ -51,7 +50,7 @@ struct WebRTCConfiguration {
webrtc::PeerConnectionInterface::kBundlePolicyBalanced;
webrtc::PeerConnectionInterface::RtcpMuxPolicy rtcp_mux_policy =
webrtc::PeerConnectionInterface::kRtcpMuxPolicyRequire;
WebVector<std::unique_ptr<WebRTCCertificate>> certificates;
WebVector<rtc::scoped_refptr<rtc::RTCCertificate>> certificates;
int ice_candidate_pool_size = 0;
WebRTCSdpSemantics sdp_semantics = WebRTCSdpSemantics::kDefault;
};
......
......@@ -51,7 +51,7 @@ ScriptWrappable* V8ScriptValueDeserializerForModules::ReadDOMObject(
Platform::Current()->CreateRTCCertificateGenerator());
if (!certificate_generator)
return nullptr;
std::unique_ptr<WebRTCCertificate> certificate =
rtc::scoped_refptr<rtc::RTCCertificate> certificate =
certificate_generator->FromPEM(pem_private_key, pem_certificate);
if (!certificate)
return nullptr;
......
......@@ -48,10 +48,10 @@ bool V8ScriptValueSerializerForModules::WriteDOMObject(
}
if (wrapper_type_info == &V8RTCCertificate::wrapperTypeInfo) {
RTCCertificate* certificate = wrappable->ToImpl<RTCCertificate>();
WebRTCCertificatePEM pem = certificate->Certificate().ToPEM();
rtc::RTCCertificatePEM pem = certificate->Certificate()->ToPEM();
WriteTag(kRTCCertificateTag);
WriteUTF8String(pem.PrivateKey());
WriteUTF8String(pem.Certificate());
WriteUTF8String(pem.private_key().c_str());
WriteUTF8String(pem.certificate().c_str());
return true;
}
return false;
......
......@@ -157,7 +157,7 @@ TEST(V8ScriptValueSerializerForModulesTest, RoundTripRTCCertificate) {
V8TestingScope scope;
// Make a certificate with the existing key above.
std::unique_ptr<WebRTCCertificate> web_certificate =
rtc::scoped_refptr<rtc::RTCCertificate> web_certificate =
certificate_generator->FromPEM(
WebString::FromUTF8(kEcdsaPrivateKey, sizeof(kEcdsaPrivateKey)),
WebString::FromUTF8(kEcdsaCertificate, sizeof(kEcdsaCertificate)));
......@@ -171,9 +171,9 @@ TEST(V8ScriptValueSerializerForModulesTest, RoundTripRTCCertificate) {
ASSERT_TRUE(V8RTCCertificate::hasInstance(result, scope.GetIsolate()));
RTCCertificate* new_certificate =
V8RTCCertificate::ToImpl(result.As<v8::Object>());
WebRTCCertificatePEM pem = new_certificate->Certificate().ToPEM();
EXPECT_EQ(kEcdsaPrivateKey, pem.PrivateKey());
EXPECT_EQ(kEcdsaCertificate, pem.Certificate());
rtc::RTCCertificatePEM pem = new_certificate->Certificate()->ToPEM();
EXPECT_EQ(kEcdsaPrivateKey, pem.private_key());
EXPECT_EQ(kEcdsaCertificate, pem.certificate());
}
TEST(V8ScriptValueSerializerForModulesTest, DecodeRTCCertificate) {
......@@ -198,9 +198,9 @@ TEST(V8ScriptValueSerializerForModulesTest, DecodeRTCCertificate) {
ASSERT_TRUE(V8RTCCertificate::hasInstance(result, scope.GetIsolate()));
RTCCertificate* new_certificate =
V8RTCCertificate::ToImpl(result.As<v8::Object>());
WebRTCCertificatePEM pem = new_certificate->Certificate().ToPEM();
EXPECT_EQ(kEcdsaPrivateKey, pem.PrivateKey());
EXPECT_EQ(kEcdsaCertificate, pem.Certificate());
rtc::RTCCertificatePEM pem = new_certificate->Certificate()->ToPEM();
EXPECT_EQ(kEcdsaPrivateKey, pem.private_key());
EXPECT_EQ(kEcdsaCertificate, pem.certificate());
}
TEST(V8ScriptValueSerializerForModulesTest, DecodeInvalidRTCCertificate) {
......
......@@ -36,29 +36,31 @@
namespace blink {
RTCCertificate::RTCCertificate(std::unique_ptr<WebRTCCertificate> certificate)
: certificate_(base::WrapUnique(certificate.release())) {}
std::unique_ptr<WebRTCCertificate> RTCCertificate::CertificateShallowCopy()
const {
return certificate_->ShallowCopy();
}
RTCCertificate::RTCCertificate(
rtc::scoped_refptr<rtc::RTCCertificate> certificate)
: certificate_(std::move(certificate)) {}
DOMTimeStamp RTCCertificate::expires() const {
return static_cast<DOMTimeStamp>(certificate_->Expires());
}
HeapVector<RTCDtlsFingerprint> RTCCertificate::getFingerprints() {
WebVector<WebRTCDtlsFingerprint> web_fingerprints =
certificate_->GetFingerprints();
DCHECK(!web_fingerprints.IsEmpty());
HeapVector<RTCDtlsFingerprint> fingerprints(web_fingerprints.size());
for (size_t i = 0; i < fingerprints.size(); ++i) {
DCHECK(!web_fingerprints[i].Algorithm().IsEmpty());
DCHECK(!web_fingerprints[i].Value().IsEmpty());
fingerprints[i].setAlgorithm(web_fingerprints[i].Algorithm());
fingerprints[i].setValue(web_fingerprints[i].Value());
std::unique_ptr<rtc::SSLCertificateStats> first_certificate_stats =
certificate_->ssl_certificate().GetStats();
HeapVector<RTCDtlsFingerprint> fingerprints;
for (rtc::SSLCertificateStats* certificate_stats =
first_certificate_stats.get();
certificate_stats; certificate_stats = certificate_stats->issuer.get()) {
fingerprints.emplace_back();
auto& fingerprint = fingerprints.back();
fingerprint.setAlgorithm(WTF::String::FromUTF8(
certificate_stats->fingerprint_algorithm.c_str()));
fingerprint.setValue(
WTF::String::FromUTF8(certificate_stats->fingerprint.c_str())
.LowerASCII());
}
return fingerprints;
}
......
......@@ -33,7 +33,6 @@
#include <memory>
#include "third_party/blink/public/platform/web_rtc_certificate.h"
#include "third_party/blink/renderer/core/dom/dom_time_stamp.h"
#include "third_party/blink/renderer/modules/modules_export.h"
#include "third_party/blink/renderer/modules/peerconnection/rtc_dtls_fingerprint.h"
......@@ -41,6 +40,7 @@
#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
#include "third_party/blink/renderer/platform/wtf/vector.h"
#include "third_party/webrtc/rtc_base/rtccertificate.h"
namespace blink {
......@@ -49,18 +49,18 @@ class MODULES_EXPORT RTCCertificate final : public ScriptWrappable {
public:
// Takes ownership of the certificate.
RTCCertificate(std::unique_ptr<WebRTCCertificate>);
RTCCertificate(rtc::scoped_refptr<rtc::RTCCertificate>);
// Returns a new WebRTCCertificate shallow copy.
std::unique_ptr<WebRTCCertificate> CertificateShallowCopy() const;
const WebRTCCertificate& Certificate() const { return *certificate_; }
const rtc::scoped_refptr<rtc::RTCCertificate>& Certificate() const {
return certificate_;
}
// Returns the expiration time in ms relative to epoch, 1970-01-01T00:00:00Z.
DOMTimeStamp expires() const;
HeapVector<RTCDtlsFingerprint> getFingerprints();
private:
std::unique_ptr<WebRTCCertificate> certificate_;
rtc::scoped_refptr<rtc::RTCCertificate> certificate_;
};
} // namespace blink
......
......@@ -43,7 +43,6 @@
#include "third_party/blink/public/platform/web_crypto_algorithm_params.h"
#include "third_party/blink/public/platform/web_media_stream.h"
#include "third_party/blink/public/platform/web_rtc_answer_options.h"
#include "third_party/blink/public/platform/web_rtc_certificate.h"
#include "third_party/blink/public/platform/web_rtc_certificate_generator.h"
#include "third_party/blink/public/platform/web_rtc_configuration.h"
#include "third_party/blink/public/platform/web_rtc_data_channel_handler.h"
......@@ -114,6 +113,7 @@
#include "third_party/blink/renderer/platform/peerconnection/rtc_offer_options_platform.h"
#include "third_party/blink/renderer/platform/runtime_enabled_features.h"
#include "third_party/blink/renderer/platform/wtf/time.h"
#include "third_party/webrtc/api/peerconnectioninterface.h"
namespace blink {
......@@ -241,7 +241,7 @@ class WebRTCCertificateObserver : public WebRTCCertificateCallback {
explicit WebRTCCertificateObserver(ScriptPromiseResolver* resolver)
: resolver_(resolver) {}
void OnSuccess(std::unique_ptr<WebRTCCertificate> certificate) override {
void OnSuccess(rtc::scoped_refptr<rtc::RTCCertificate> certificate) override {
resolver_->Resolve(new RTCCertificate(std::move(certificate)));
}
......@@ -364,10 +364,10 @@ WebRTCConfiguration ParseConfiguration(ExecutionContext* context,
if (configuration.hasCertificates()) {
const HeapVector<Member<RTCCertificate>>& certificates =
configuration.certificates();
WebVector<std::unique_ptr<WebRTCCertificate>> certificates_copy(
WebVector<rtc::scoped_refptr<rtc::RTCCertificate>> certificates_copy(
certificates.size());
for (size_t i = 0; i < certificates.size(); ++i) {
certificates_copy[i] = certificates[i]->CertificateShallowCopy();
certificates_copy[i] = certificates[i]->Certificate();
}
web_configuration.certificates = std::move(certificates_copy);
}
......@@ -496,7 +496,7 @@ RTCPeerConnection* RTCPeerConnection::Create(
// Make sure no certificates have expired.
if (configuration.certificates.size() > 0) {
DOMTimeStamp now = ConvertSecondsToDOMTimeStamp(CurrentTime());
for (const std::unique_ptr<WebRTCCertificate>& certificate :
for (const rtc::scoped_refptr<rtc::RTCCertificate>& certificate :
configuration.certificates) {
DOMTimeStamp expires = certificate->Expires();
if (expires <= now) {
......
......@@ -9,7 +9,7 @@ namespace blink {
bool InternalsRTCCertificate::rtcCertificateEquals(Internals& internals,
RTCCertificate* a,
RTCCertificate* b) {
return a->Certificate().Equals(b->Certificate());
return a->Certificate() == b->Certificate();
}
} // namespace blink
......@@ -260,9 +260,6 @@ _CONFIG = [
# Blink uses UKM for logging e.g. always-on leak detection (crbug/757374)
'ukm::.+',
# WebRTC classes
'webrtc::.+',
],
'disallowed': ['.+'],
},
......@@ -395,6 +392,16 @@ _CONFIG = [
],
'allowed': ['crypto::.+'],
},
{
'paths': [
'third_party/blink/renderer/modules/peerconnection',
'third_party/blink/renderer/bindings/modules/v8/serialization',
],
'allowed': [
'webrtc::.+',
'rtc::.+',
]
}
]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment