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

Side by Side Diff: webrtc/base/rtccertificategenerator.cc

Issue 1920043002: Replace scoped_ptr with unique_ptr in webrtc/base/ (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebased Created 4 years, 7 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 /* 1 /*
2 * Copyright 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2016 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #include "webrtc/base/rtccertificategenerator.h" 11 #include "webrtc/base/rtccertificategenerator.h"
12 12
13 #include <algorithm> 13 #include <algorithm>
14 #include <memory>
14 15
15 #include "webrtc/base/checks.h" 16 #include "webrtc/base/checks.h"
16 #include "webrtc/base/sslidentity.h" 17 #include "webrtc/base/sslidentity.h"
17 18
18 namespace rtc { 19 namespace rtc {
19 20
20 namespace { 21 namespace {
21 22
22 // A certificates' subject and issuer name. 23 // A certificates' subject and issuer name.
23 const char kIdentityName[] = "WebRTC"; 24 const char kIdentityName[] = "WebRTC";
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 // TODO(torbjorng): Stop using |time_t|, its type is unspecified. It it safe 118 // TODO(torbjorng): Stop using |time_t|, its type is unspecified. It it safe
118 // to assume it can hold up to a year's worth of seconds (and more), but 119 // to assume it can hold up to a year's worth of seconds (and more), but
119 // |SSLIdentity::Generate| should stop relying on |time_t|. 120 // |SSLIdentity::Generate| should stop relying on |time_t|.
120 // See bugs.webrtc.org/5720. 121 // See bugs.webrtc.org/5720.
121 time_t cert_lifetime_s = static_cast<time_t>(expires_s); 122 time_t cert_lifetime_s = static_cast<time_t>(expires_s);
122 identity = SSLIdentity::GenerateWithExpiration( 123 identity = SSLIdentity::GenerateWithExpiration(
123 kIdentityName, key_params, cert_lifetime_s); 124 kIdentityName, key_params, cert_lifetime_s);
124 } 125 }
125 if (!identity) 126 if (!identity)
126 return nullptr; 127 return nullptr;
127 scoped_ptr<SSLIdentity> identity_sptr(identity); 128 std::unique_ptr<SSLIdentity> identity_sptr(identity);
128 return RTCCertificate::Create(std::move(identity_sptr)); 129 return RTCCertificate::Create(std::move(identity_sptr));
129 } 130 }
130 131
131 RTCCertificateGenerator::RTCCertificateGenerator( 132 RTCCertificateGenerator::RTCCertificateGenerator(
132 Thread* signaling_thread, Thread* worker_thread) 133 Thread* signaling_thread, Thread* worker_thread)
133 : signaling_thread_(signaling_thread), 134 : signaling_thread_(signaling_thread),
134 worker_thread_(worker_thread) { 135 worker_thread_(worker_thread) {
135 RTC_DCHECK(signaling_thread_); 136 RTC_DCHECK(signaling_thread_);
136 RTC_DCHECK(worker_thread_); 137 RTC_DCHECK(worker_thread_);
137 } 138 }
(...skipping 10 matching lines...) Expand all
148 // until the task has completed (independent of |RTCCertificateGenerator|). 149 // until the task has completed (independent of |RTCCertificateGenerator|).
149 ScopedRefMessageData<RTCCertificateGenerationTask>* msg_data = 150 ScopedRefMessageData<RTCCertificateGenerationTask>* msg_data =
150 new ScopedRefMessageData<RTCCertificateGenerationTask>( 151 new ScopedRefMessageData<RTCCertificateGenerationTask>(
151 new RefCountedObject<RTCCertificateGenerationTask>( 152 new RefCountedObject<RTCCertificateGenerationTask>(
152 signaling_thread_, worker_thread_, key_params, expires_ms, 153 signaling_thread_, worker_thread_, key_params, expires_ms,
153 callback)); 154 callback));
154 worker_thread_->Post(msg_data->data().get(), MSG_GENERATE, msg_data); 155 worker_thread_->Post(msg_data->data().get(), MSG_GENERATE, msg_data);
155 } 156 }
156 157
157 } // namespace rtc 158 } // namespace rtc
OLDNEW
« no previous file with comments | « webrtc/base/rtccertificate_unittests.cc ('k') | webrtc/base/rtccertificategenerator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698