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

Side by Side Diff: net/ssl/channel_id_service.cc

Issue 2095523002: Make //crypto factories return std::unique_ptr<>s (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix comment Created 4 years, 6 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "net/ssl/channel_id_service.h" 5 #include "net/ssl/channel_id_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 185
186 private: 186 private:
187 void PostAll(int error, std::unique_ptr<crypto::ECPrivateKey> key) { 187 void PostAll(int error, std::unique_ptr<crypto::ECPrivateKey> key) {
188 std::vector<ChannelIDService::Request*> requests; 188 std::vector<ChannelIDService::Request*> requests;
189 requests_.swap(requests); 189 requests_.swap(requests);
190 190
191 for (std::vector<ChannelIDService::Request*>::iterator i = requests.begin(); 191 for (std::vector<ChannelIDService::Request*>::iterator i = requests.begin();
192 i != requests.end(); i++) { 192 i != requests.end(); i++) {
193 std::unique_ptr<crypto::ECPrivateKey> key_copy; 193 std::unique_ptr<crypto::ECPrivateKey> key_copy;
194 if (key) 194 if (key)
195 key_copy.reset(key->Copy()); 195 key_copy = key->Copy();
196 (*i)->Post(error, std::move(key_copy)); 196 (*i)->Post(error, std::move(key_copy));
197 } 197 }
198 } 198 }
199 199
200 std::vector<ChannelIDService::Request*> requests_; 200 std::vector<ChannelIDService::Request*> requests_;
201 bool create_if_missing_; 201 bool create_if_missing_;
202 }; 202 };
203 203
204 // static 204 // static
205 const char ChannelIDService::kEPKIPassword[] = ""; 205 const char ChannelIDService::kEPKIPassword[] = "";
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 } 432 }
433 433
434 void ChannelIDService::GeneratedChannelID( 434 void ChannelIDService::GeneratedChannelID(
435 const std::string& server_identifier, 435 const std::string& server_identifier,
436 int error, 436 int error,
437 std::unique_ptr<ChannelIDStore::ChannelID> channel_id) { 437 std::unique_ptr<ChannelIDStore::ChannelID> channel_id) {
438 DCHECK(CalledOnValidThread()); 438 DCHECK(CalledOnValidThread());
439 439
440 std::unique_ptr<crypto::ECPrivateKey> key; 440 std::unique_ptr<crypto::ECPrivateKey> key;
441 if (error == OK) { 441 if (error == OK) {
442 key.reset(channel_id->key()->Copy()); 442 key = channel_id->key()->Copy();
443 channel_id_store_->SetChannelID(std::move(channel_id)); 443 channel_id_store_->SetChannelID(std::move(channel_id));
444 } 444 }
445 HandleResult(error, server_identifier, std::move(key)); 445 HandleResult(error, server_identifier, std::move(key));
446 } 446 }
447 447
448 void ChannelIDService::HandleResult(int error, 448 void ChannelIDService::HandleResult(int error,
449 const std::string& server_identifier, 449 const std::string& server_identifier,
450 std::unique_ptr<crypto::ECPrivateKey> key) { 450 std::unique_ptr<crypto::ECPrivateKey> key) {
451 DCHECK(CalledOnValidThread()); 451 DCHECK(CalledOnValidThread());
452 452
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 } 521 }
522 522
523 return err; 523 return err;
524 } 524 }
525 525
526 int ChannelIDService::channel_id_count() { 526 int ChannelIDService::channel_id_count() {
527 return channel_id_store_->GetChannelIDCount(); 527 return channel_id_store_->GetChannelIDCount();
528 } 528 }
529 529
530 } // namespace net 530 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698