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

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: Fixes for compile errors. Created 4 years, 8 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 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 // Enqueue/Post a worker task to do the generation. 185 // Enqueue/Post a worker task to do the generation.
186 ++request_info_[key_type].gen_in_progress_counts_; 186 ++request_info_[key_type].gen_in_progress_counts_;
187 WorkerTask* task = new WorkerTask(this, key_type); // Post 1 task/request. 187 WorkerTask* task = new WorkerTask(this, key_type); // Post 1 task/request.
188 // The WorkerTask is owned by the message data to make sure it will not be 188 // The WorkerTask is owned by the message data to make sure it will not be
189 // leaked even if the task does not get run. 189 // leaked even if the task does not get run.
190 WorkerTaskMessageData* msg = new WorkerTaskMessageData(task); 190 WorkerTaskMessageData* msg = new WorkerTaskMessageData(task);
191 worker_thread_->Post(task, MSG_GENERATE_IDENTITY, msg); 191 worker_thread_->Post(task, MSG_GENERATE_IDENTITY, msg);
192 } 192 }
193 193
194 void DtlsIdentityStoreImpl::OnIdentityGenerated( 194 void DtlsIdentityStoreImpl::OnIdentityGenerated(
195 rtc::KeyType key_type, rtc::scoped_ptr<rtc::SSLIdentity> identity) { 195 rtc::KeyType key_type, std::unique_ptr<rtc::SSLIdentity> identity) {
196 RTC_DCHECK(signaling_thread_->IsCurrent()); 196 RTC_DCHECK(signaling_thread_->IsCurrent());
197 197
198 RTC_DCHECK(request_info_[key_type].gen_in_progress_counts_); 198 RTC_DCHECK(request_info_[key_type].gen_in_progress_counts_);
199 --request_info_[key_type].gen_in_progress_counts_; 199 --request_info_[key_type].gen_in_progress_counts_;
200 200
201 rtc::scoped_refptr<webrtc::DtlsIdentityRequestObserver> observer; 201 rtc::scoped_refptr<webrtc::DtlsIdentityRequestObserver> observer;
202 if (!request_info_[key_type].request_observers_.empty()) { 202 if (!request_info_[key_type].request_observers_.empty()) {
203 observer = request_info_[key_type].request_observers_.front(); 203 observer = request_info_[key_type].request_observers_.front();
204 request_info_[key_type].request_observers_.pop(); 204 request_info_[key_type].request_observers_.pop();
205 } 205 }
(...skipping 21 matching lines...) Expand all
227 key_type == rtc::KT_RSA && // Only necessary for RSA. 227 key_type == rtc::KT_RSA && // Only necessary for RSA.
228 !request_info_[key_type].free_identity_.get() && 228 !request_info_[key_type].free_identity_.get() &&
229 request_info_[key_type].request_observers_.size() <= 229 request_info_[key_type].request_observers_.size() <=
230 request_info_[key_type].gen_in_progress_counts_) { 230 request_info_[key_type].gen_in_progress_counts_) {
231 GenerateIdentity(key_type, nullptr); 231 GenerateIdentity(key_type, nullptr);
232 } 232 }
233 } 233 }
234 } 234 }
235 235
236 } // namespace webrtc 236 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698