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

Side by Side Diff: net/cert/multi_threaded_cert_verifier.cc

Issue 1149763005: Change NetLog::ParametersCallback to return a scoped_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: format Created 5 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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/multi_threaded_cert_verifier.h" 5 #include "net/cert/multi_threaded_cert_verifier.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 // callback, the remaining requests in the completing job will NOT be cancelled. 74 // callback, the remaining requests in the completing job will NOT be cancelled.
75 75
76 namespace { 76 namespace {
77 77
78 // The maximum number of cache entries to use for the ExpiringCache. 78 // The maximum number of cache entries to use for the ExpiringCache.
79 const unsigned kMaxCacheEntries = 256; 79 const unsigned kMaxCacheEntries = 256;
80 80
81 // The number of seconds to cache entries. 81 // The number of seconds to cache entries.
82 const unsigned kTTLSecs = 1800; // 30 minutes. 82 const unsigned kTTLSecs = 1800; // 30 minutes.
83 83
84 base::Value* CertVerifyResultCallback(const CertVerifyResult& verify_result, 84 scoped_ptr<base::Value> CertVerifyResultCallback(
85 NetLogCaptureMode capture_mode) { 85 const CertVerifyResult& verify_result,
86 base::DictionaryValue* results = new base::DictionaryValue(); 86 NetLogCaptureMode capture_mode) {
87 scoped_ptr<base::DictionaryValue> results(new base::DictionaryValue());
87 results->SetBoolean("has_md5", verify_result.has_md5); 88 results->SetBoolean("has_md5", verify_result.has_md5);
88 results->SetBoolean("has_md2", verify_result.has_md2); 89 results->SetBoolean("has_md2", verify_result.has_md2);
89 results->SetBoolean("has_md4", verify_result.has_md4); 90 results->SetBoolean("has_md4", verify_result.has_md4);
90 results->SetBoolean("is_issued_by_known_root", 91 results->SetBoolean("is_issued_by_known_root",
91 verify_result.is_issued_by_known_root); 92 verify_result.is_issued_by_known_root);
92 results->SetBoolean("is_issued_by_additional_trust_anchor", 93 results->SetBoolean("is_issued_by_additional_trust_anchor",
93 verify_result.is_issued_by_additional_trust_anchor); 94 verify_result.is_issued_by_additional_trust_anchor);
94 results->SetBoolean("common_name_fallback_used", 95 results->SetBoolean("common_name_fallback_used",
95 verify_result.common_name_fallback_used); 96 verify_result.common_name_fallback_used);
96 results->SetInteger("cert_status", verify_result.cert_status); 97 results->SetInteger("cert_status", verify_result.cert_status);
97 results->Set("verified_cert", 98 results->Set("verified_cert",
98 NetLogX509CertificateCallback(verify_result.verified_cert.get(), 99 NetLogX509CertificateCallback(verify_result.verified_cert.get(),
99 capture_mode)); 100 capture_mode));
100 101
101 base::ListValue* hashes = new base::ListValue(); 102 scoped_ptr<base::ListValue> hashes(new base::ListValue());
102 for (std::vector<HashValue>::const_iterator it = 103 for (std::vector<HashValue>::const_iterator it =
103 verify_result.public_key_hashes.begin(); 104 verify_result.public_key_hashes.begin();
104 it != verify_result.public_key_hashes.end(); 105 it != verify_result.public_key_hashes.end();
105 ++it) { 106 ++it) {
106 hashes->AppendString(it->ToString()); 107 hashes->AppendString(it->ToString());
107 } 108 }
108 results->Set("public_key_hashes", hashes); 109 results->Set("public_key_hashes", hashes.Pass());
eroman 2015/05/21 03:37:42 oh is this new?
Evan Stade 2015/05/21 15:30:42 it didn't always exist but I don't think it's part
109 110
110 return results; 111 return results.Pass();
111 } 112 }
112 113
113 } // namespace 114 } // namespace
114 115
115 MultiThreadedCertVerifier::CachedResult::CachedResult() : error(ERR_FAILED) {} 116 MultiThreadedCertVerifier::CachedResult::CachedResult() : error(ERR_FAILED) {}
116 117
117 MultiThreadedCertVerifier::CachedResult::~CachedResult() {} 118 MultiThreadedCertVerifier::CachedResult::~CachedResult() {}
118 119
119 MultiThreadedCertVerifier::CacheValidityPeriod::CacheValidityPeriod( 120 MultiThreadedCertVerifier::CacheValidityPeriod::CacheValidityPeriod(
120 const base::Time& now) 121 const base::Time& now)
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 // search. 557 // search.
557 auto it = std::lower_bound(inflight_.begin(), inflight_.end(), key, 558 auto it = std::lower_bound(inflight_.begin(), inflight_.end(), key,
558 JobToRequestParamsComparator()); 559 JobToRequestParamsComparator());
559 if (it != inflight_.end() && !(key < (*it)->key())) 560 if (it != inflight_.end() && !(key < (*it)->key()))
560 return *it; 561 return *it;
561 return nullptr; 562 return nullptr;
562 } 563 }
563 564
564 } // namespace net 565 } // namespace net
565 566
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698