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

Side by Side Diff: webrtc/api/dtlsidentitystore.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
« no previous file with comments | « webrtc/api/dtlsidentitystore.h ('k') | webrtc/api/dtlsidentitystore_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2015 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
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 store_(store), 44 store_(store),
45 key_type_(key_type) { 45 key_type_(key_type) {
46 store_->SignalDestroyed.connect(this, &WorkerTask::OnStoreDestroyed); 46 store_->SignalDestroyed.connect(this, &WorkerTask::OnStoreDestroyed);
47 } 47 }
48 48
49 virtual ~WorkerTask() { RTC_DCHECK(signaling_thread_->IsCurrent()); } 49 virtual ~WorkerTask() { RTC_DCHECK(signaling_thread_->IsCurrent()); }
50 50
51 private: 51 private:
52 void GenerateIdentity_w() { 52 void GenerateIdentity_w() {
53 LOG(LS_INFO) << "Generating identity, using keytype " << key_type_; 53 LOG(LS_INFO) << "Generating identity, using keytype " << key_type_;
54 rtc::scoped_ptr<rtc::SSLIdentity> identity( 54 std::unique_ptr<rtc::SSLIdentity> identity(
55 rtc::SSLIdentity::Generate(kIdentityName, key_type_)); 55 rtc::SSLIdentity::Generate(kIdentityName, key_type_));
56 56
57 // Posting to |this| avoids touching |store_| on threads other than 57 // Posting to |this| avoids touching |store_| on threads other than
58 // |signaling_thread_| and thus avoids having to use locks. 58 // |signaling_thread_| and thus avoids having to use locks.
59 IdentityResultMessageData* msg = new IdentityResultMessageData( 59 IdentityResultMessageData* msg = new IdentityResultMessageData(
60 new IdentityResult(key_type_, std::move(identity))); 60 new IdentityResult(key_type_, std::move(identity)));
61 signaling_thread_->Post(this, MSG_GENERATE_IDENTITY_RESULT, msg); 61 signaling_thread_->Post(this, MSG_GENERATE_IDENTITY_RESULT, msg);
62 } 62 }
63 63
64 void OnMessage(rtc::Message* msg) override { 64 void OnMessage(rtc::Message* msg) override {
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 // Enqueue/Post a worker task to do the generation. 179 // Enqueue/Post a worker task to do the generation.
180 ++request_info_[key_type].gen_in_progress_counts_; 180 ++request_info_[key_type].gen_in_progress_counts_;
181 WorkerTask* task = new WorkerTask(this, key_type); // Post 1 task/request. 181 WorkerTask* task = new WorkerTask(this, key_type); // Post 1 task/request.
182 // The WorkerTask is owned by the message data to make sure it will not be 182 // The WorkerTask is owned by the message data to make sure it will not be
183 // leaked even if the task does not get run. 183 // leaked even if the task does not get run.
184 WorkerTaskMessageData* msg = new WorkerTaskMessageData(task); 184 WorkerTaskMessageData* msg = new WorkerTaskMessageData(task);
185 worker_thread_->Post(task, MSG_GENERATE_IDENTITY, msg); 185 worker_thread_->Post(task, MSG_GENERATE_IDENTITY, msg);
186 } 186 }
187 187
188 void DtlsIdentityStoreImpl::OnIdentityGenerated( 188 void DtlsIdentityStoreImpl::OnIdentityGenerated(
189 rtc::KeyType key_type, rtc::scoped_ptr<rtc::SSLIdentity> identity) { 189 rtc::KeyType key_type,
190 std::unique_ptr<rtc::SSLIdentity> identity) {
190 RTC_DCHECK(signaling_thread_->IsCurrent()); 191 RTC_DCHECK(signaling_thread_->IsCurrent());
191 192
192 RTC_DCHECK(request_info_[key_type].gen_in_progress_counts_); 193 RTC_DCHECK(request_info_[key_type].gen_in_progress_counts_);
193 --request_info_[key_type].gen_in_progress_counts_; 194 --request_info_[key_type].gen_in_progress_counts_;
194 195
195 rtc::scoped_refptr<webrtc::DtlsIdentityRequestObserver> observer; 196 rtc::scoped_refptr<webrtc::DtlsIdentityRequestObserver> observer;
196 if (!request_info_[key_type].request_observers_.empty()) { 197 if (!request_info_[key_type].request_observers_.empty()) {
197 observer = request_info_[key_type].request_observers_.front(); 198 observer = request_info_[key_type].request_observers_.front();
198 request_info_[key_type].request_observers_.pop(); 199 request_info_[key_type].request_observers_.pop();
199 } 200 }
(...skipping 21 matching lines...) Expand all
221 key_type == rtc::KT_RSA && // Only necessary for RSA. 222 key_type == rtc::KT_RSA && // Only necessary for RSA.
222 !request_info_[key_type].free_identity_.get() && 223 !request_info_[key_type].free_identity_.get() &&
223 request_info_[key_type].request_observers_.size() == 224 request_info_[key_type].request_observers_.size() ==
224 request_info_[key_type].gen_in_progress_counts_) { 225 request_info_[key_type].gen_in_progress_counts_) {
225 GenerateIdentity(key_type, nullptr); 226 GenerateIdentity(key_type, nullptr);
226 } 227 }
227 } 228 }
228 } 229 }
229 230
230 } // namespace webrtc 231 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/api/dtlsidentitystore.h ('k') | webrtc/api/dtlsidentitystore_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698