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

Side by Side Diff: net/cert/internal/path_builder.cc

Issue 2259823002: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 3 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/cert/internal/path_builder.h" 5 #include "net/cert/internal/path_builder.h"
6 6
7 #include <set> 7 #include <set>
8 #include <unordered_set> 8 #include <unordered_set>
9 9
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 return CompletionStatus::SYNC; 569 return CompletionStatus::SYNC;
570 } 570 }
571 571
572 if (next_issuer_.IsCertificate()) { 572 if (next_issuer_.IsCertificate()) {
573 // Skip this cert if it is already in the chain. 573 // Skip this cert if it is already in the chain.
574 if (cur_path_.IsPresent(next_issuer_.cert.get())) { 574 if (cur_path_.IsPresent(next_issuer_.cert.get())) {
575 next_state_ = STATE_GET_NEXT_ISSUER; 575 next_state_ = STATE_GET_NEXT_ISSUER;
576 return CompletionStatus::SYNC; 576 return CompletionStatus::SYNC;
577 } 577 }
578 578
579 cur_path_.Append(base::WrapUnique(new CertIssuersIter( 579 cur_path_.Append(base::MakeUnique<CertIssuersIter>(
580 std::move(next_issuer_.cert), &cert_issuer_sources_, trust_store_))); 580 std::move(next_issuer_.cert), &cert_issuer_sources_, trust_store_));
581 next_issuer_ = CertificateOrTrustAnchor(); 581 next_issuer_ = CertificateOrTrustAnchor();
582 DVLOG(1) << "CertPathIter cur_path_ = " << cur_path_.PathDebugString(); 582 DVLOG(1) << "CertPathIter cur_path_ = " << cur_path_.PathDebugString();
583 // Continue descending the tree. 583 // Continue descending the tree.
584 next_state_ = STATE_GET_NEXT_ISSUER; 584 next_state_ = STATE_GET_NEXT_ISSUER;
585 } else { 585 } else {
586 // TODO(mattm): should also include such paths in CertPathBuilder::Result, 586 // TODO(mattm): should also include such paths in CertPathBuilder::Result,
587 // maybe with a flag to enable it. Or use a visitor pattern so the caller 587 // maybe with a flag to enable it. Or use a visitor pattern so the caller
588 // can decide what to do with any failed paths. 588 // can decide what to do with any failed paths.
589 // No more issuers for current chain, go back up and see if there are any 589 // No more issuers for current chain, go back up and see if there are any
590 // more for the previous cert. 590 // more for the previous cert.
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 741
742 void CertPathBuilder::AddResultPath(std::unique_ptr<ResultPath> result_path) { 742 void CertPathBuilder::AddResultPath(std::unique_ptr<ResultPath> result_path) {
743 // TODO(mattm): set best_result_index based on number or severity of errors. 743 // TODO(mattm): set best_result_index based on number or severity of errors.
744 if (result_path->valid) 744 if (result_path->valid)
745 out_result_->best_result_index = out_result_->paths.size(); 745 out_result_->best_result_index = out_result_->paths.size();
746 // TODO(mattm): add flag to only return a single path or all attempted paths? 746 // TODO(mattm): add flag to only return a single path or all attempted paths?
747 out_result_->paths.push_back(std::move(result_path)); 747 out_result_->paths.push_back(std::move(result_path));
748 } 748 }
749 749
750 } // namespace net 750 } // namespace net
OLDNEW
« no previous file with comments | « net/base/elements_upload_data_stream_unittest.cc ('k') | net/cert/internal/signature_algorithm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698