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

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

Issue 1814463002: [NOT FOR REVIEW] Instrument net/ with trace events. Base URL: https://chromium.googlesource.com/chromium/src.git@profiler
Patch Set: meh Created 4 years, 9 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 | « net/cert/crl_set_storage.cc ('k') | net/disk_cache/blockfile/in_flight_backend_io.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 // 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 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 11 matching lines...) Expand all
22 #include "base/values.h" 22 #include "base/values.h"
23 #include "net/base/hash_value.h" 23 #include "net/base/hash_value.h"
24 #include "net/base/net_errors.h" 24 #include "net/base/net_errors.h"
25 #include "net/cert/cert_trust_anchor_provider.h" 25 #include "net/cert/cert_trust_anchor_provider.h"
26 #include "net/cert/cert_verify_proc.h" 26 #include "net/cert/cert_verify_proc.h"
27 #include "net/cert/crl_set.h" 27 #include "net/cert/crl_set.h"
28 #include "net/cert/x509_certificate.h" 28 #include "net/cert/x509_certificate.h"
29 #include "net/cert/x509_certificate_net_log_param.h" 29 #include "net/cert/x509_certificate_net_log_param.h"
30 #include "net/log/net_log.h" 30 #include "net/log/net_log.h"
31 31
32 #include "base/trace_event/trace_event.h"
33
32 #if defined(USE_NSS_CERTS) || defined(OS_IOS) 34 #if defined(USE_NSS_CERTS) || defined(OS_IOS)
33 #include <private/pprthred.h> // PR_DetachThread 35 #include <private/pprthred.h> // PR_DetachThread
34 #endif 36 #endif
35 37
36 namespace net { 38 namespace net {
37 39
38 //////////////////////////////////////////////////////////////////////////// 40 ////////////////////////////////////////////////////////////////////////////
39 // 41 //
40 // MultiThreadedCertVerifier is a thread-unsafe object which lives, dies, and is 42 // MultiThreadedCertVerifier is a thread-unsafe object which lives, dies, and is
41 // operated on a single thread, henceforth referred to as the "origin" thread. 43 // operated on a single thread, henceforth referred to as the "origin" thread.
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 // thread. The output parameters (error and result) must remain alive. 229 // thread. The output parameters (error and result) must remain alive.
228 void DoVerifyOnWorkerThread(const scoped_refptr<CertVerifyProc>& verify_proc, 230 void DoVerifyOnWorkerThread(const scoped_refptr<CertVerifyProc>& verify_proc,
229 const scoped_refptr<X509Certificate>& cert, 231 const scoped_refptr<X509Certificate>& cert,
230 const std::string& hostname, 232 const std::string& hostname,
231 const std::string& ocsp_response, 233 const std::string& ocsp_response,
232 int flags, 234 int flags,
233 const scoped_refptr<CRLSet>& crl_set, 235 const scoped_refptr<CRLSet>& crl_set,
234 const CertificateList& additional_trust_anchors, 236 const CertificateList& additional_trust_anchors,
235 int* error, 237 int* error,
236 CertVerifyResult* result) { 238 CertVerifyResult* result) {
239 TRACE_EVENT0("net", "net::DoVerifyOnWorkerThread");
237 *error = verify_proc->Verify(cert.get(), hostname, ocsp_response, flags, 240 *error = verify_proc->Verify(cert.get(), hostname, ocsp_response, flags,
238 crl_set.get(), additional_trust_anchors, result); 241 crl_set.get(), additional_trust_anchors, result);
239 242
240 #if defined(USE_NSS_CERTS) || defined(OS_IOS) 243 #if defined(USE_NSS_CERTS) || defined(OS_IOS)
241 // Detach the thread from NSPR. 244 // Detach the thread from NSPR.
242 // Calling NSS functions attaches the thread to NSPR, which stores 245 // Calling NSS functions attaches the thread to NSPR, which stores
243 // the NSPR thread ID in thread-specific data. 246 // the NSPR thread ID in thread-specific data.
244 // The threads in our thread pool terminate after we have called 247 // The threads in our thread pool terminate after we have called
245 // PR_Cleanup. Unless we detach them from NSPR, net_unittests gets 248 // PR_Cleanup. Unless we detach them from NSPR, net_unittests gets
246 // segfaults on shutdown when the threads' thread-specific data 249 // segfaults on shutdown when the threads' thread-specific data
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 UMA_HISTOGRAM_CUSTOM_TIMES("Net.CertVerifier_First_Job_Latency", 355 UMA_HISTOGRAM_CUSTOM_TIMES("Net.CertVerifier_First_Job_Latency",
353 latency, 356 latency,
354 base::TimeDelta::FromMilliseconds(1), 357 base::TimeDelta::FromMilliseconds(1),
355 base::TimeDelta::FromMinutes(10), 358 base::TimeDelta::FromMinutes(10),
356 100); 359 100);
357 } 360 }
358 } 361 }
359 362
360 void OnJobCompleted( 363 void OnJobCompleted(
361 scoped_ptr<MultiThreadedCertVerifier::CachedResult> verify_result) { 364 scoped_ptr<MultiThreadedCertVerifier::CachedResult> verify_result) {
365 TRACE_EVENT0("net", "net::CertVerifierJob::OnJobCompleted");
362 scoped_ptr<CertVerifierJob> keep_alive = cert_verifier_->RemoveJob(this); 366 scoped_ptr<CertVerifierJob> keep_alive = cert_verifier_->RemoveJob(this);
363 367
364 LogMetrics(*verify_result); 368 LogMetrics(*verify_result);
365 cert_verifier_->SaveResultToCache(key_, *verify_result); 369 cert_verifier_->SaveResultToCache(key_, *verify_result);
366 cert_verifier_ = nullptr; 370 cert_verifier_ = nullptr;
367 371
368 // TODO(eroman): If the cert_verifier_ is deleted from within one of the 372 // TODO(eroman): If the cert_verifier_ is deleted from within one of the
369 // callbacks, any remaining requests for that job should be cancelled. Right 373 // callbacks, any remaining requests for that job should be cancelled. Right
370 // now they will be called. 374 // now they will be called.
371 while (!requests_.empty()) { 375 while (!requests_.empty()) {
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 // search. 589 // search.
586 auto it = std::lower_bound(inflight_.begin(), inflight_.end(), key, 590 auto it = std::lower_bound(inflight_.begin(), inflight_.end(), key,
587 JobToRequestParamsComparator()); 591 JobToRequestParamsComparator());
588 if (it != inflight_.end() && !(key < (*it)->key())) 592 if (it != inflight_.end() && !(key < (*it)->key()))
589 return *it; 593 return *it;
590 return nullptr; 594 return nullptr;
591 } 595 }
592 596
593 } // namespace net 597 } // namespace net
594 598
OLDNEW
« no previous file with comments | « net/cert/crl_set_storage.cc ('k') | net/disk_cache/blockfile/in_flight_backend_io.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698