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

Side by Side Diff: content/renderer/media/rtc_certificate_generator.cc

Issue 2253053003: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/media/rtc_certificate_generator.h" 5 #include "content/renderer/media/rtc_certificate_generator.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 void GenerateCertificateOnWorkerThread( 82 void GenerateCertificateOnWorkerThread(
83 const blink::WebRTCKeyParams key_params, 83 const blink::WebRTCKeyParams key_params,
84 const rtc::Optional<uint64_t> expires_ms, 84 const rtc::Optional<uint64_t> expires_ms,
85 CertificateCallbackPtr observer) { 85 CertificateCallbackPtr observer) {
86 DCHECK(worker_thread_->BelongsToCurrentThread()); 86 DCHECK(worker_thread_->BelongsToCurrentThread());
87 87
88 rtc::scoped_refptr<rtc::RTCCertificate> certificate = 88 rtc::scoped_refptr<rtc::RTCCertificate> certificate =
89 rtc::RTCCertificateGenerator::GenerateCertificate( 89 rtc::RTCCertificateGenerator::GenerateCertificate(
90 WebRTCKeyParamsToKeyParams(key_params), expires_ms); 90 WebRTCKeyParamsToKeyParams(key_params), expires_ms);
91 91
92 main_thread_->PostTask(FROM_HERE, base::Bind( 92 main_thread_->PostTask(
93 &RTCCertificateGeneratorRequest::DoCallbackOnMainThread, 93 FROM_HERE,
94 this, 94 base::Bind(
95 base::Passed(std::move(observer)), 95 &RTCCertificateGeneratorRequest::DoCallbackOnMainThread, this,
96 base::Passed(base::WrapUnique(new RTCCertificate(certificate))))); 96 base::Passed(std::move(observer)),
97 base::Passed(base::MakeUnique<RTCCertificate>(certificate))));
97 } 98 }
98 99
99 void DoCallbackOnMainThread( 100 void DoCallbackOnMainThread(
100 CertificateCallbackPtr observer, 101 CertificateCallbackPtr observer,
101 std::unique_ptr<blink::WebRTCCertificate> certificate) { 102 std::unique_ptr<blink::WebRTCCertificate> certificate) {
102 DCHECK(main_thread_->BelongsToCurrentThread()); 103 DCHECK(main_thread_->BelongsToCurrentThread());
103 DCHECK(observer); 104 DCHECK(observer);
104 if (certificate) 105 if (certificate)
105 observer->onSuccess(std::move(certificate)); 106 observer->onSuccess(std::move(certificate));
106 else 107 else
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 blink::WebString pem_certificate) { 164 blink::WebString pem_certificate) {
164 rtc::scoped_refptr<rtc::RTCCertificate> certificate = 165 rtc::scoped_refptr<rtc::RTCCertificate> certificate =
165 rtc::RTCCertificate::FromPEM( 166 rtc::RTCCertificate::FromPEM(
166 rtc::RTCCertificatePEM(pem_private_key.utf8(), 167 rtc::RTCCertificatePEM(pem_private_key.utf8(),
167 pem_certificate.utf8())); 168 pem_certificate.utf8()));
168 return std::unique_ptr<blink::WebRTCCertificate>( 169 return std::unique_ptr<blink::WebRTCCertificate>(
169 new RTCCertificate(certificate)); 170 new RTCCertificate(certificate));
170 } 171 }
171 172
172 } // namespace content 173 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698