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

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

Issue 10539094: NetLogEventParameter to Callback refactoring 1, (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Remove unneeded line Created 8 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 | Annotate | Revision Log
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/base/multi_threaded_cert_verifier.h" 5 #include "net/base/multi_threaded_cert_verifier.h"
6 6
7 #include <vector> 7 #include <vector>
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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 256
257 // A CertVerifierJob is a one-to-one counterpart of a CertVerifierWorker. It 257 // A CertVerifierJob is a one-to-one counterpart of a CertVerifierWorker. It
258 // lives only on the CertVerifier's origin message loop. 258 // lives only on the CertVerifier's origin message loop.
259 class CertVerifierJob { 259 class CertVerifierJob {
260 public: 260 public:
261 CertVerifierJob(CertVerifierWorker* worker, 261 CertVerifierJob(CertVerifierWorker* worker,
262 const BoundNetLog& net_log) 262 const BoundNetLog& net_log)
263 : start_time_(base::TimeTicks::Now()), 263 : start_time_(base::TimeTicks::Now()),
264 worker_(worker), 264 worker_(worker),
265 net_log_(net_log) { 265 net_log_(net_log) {
266 scoped_refptr<NetLog::EventParameters> params( 266 net_log_.BeginEvent(
267 new X509CertificateNetLogParam(worker_->certificate())); 267 NetLog::TYPE_CERT_VERIFIER_JOB,
268 net_log_.BeginEvent(NetLog::TYPE_CERT_VERIFIER_JOB, params); 268 base::Bind(&NetLogX509CertificateCallback,
269 base::Unretained(worker_->certificate())));
269 } 270 }
270 271
271 ~CertVerifierJob() { 272 ~CertVerifierJob() {
272 if (worker_) { 273 if (worker_) {
273 net_log_.AddEvent(NetLog::TYPE_CANCELLED, NULL); 274 net_log_.AddEvent(NetLog::TYPE_CANCELLED, NULL);
274 net_log_.EndEvent(NetLog::TYPE_CERT_VERIFIER_JOB, NULL); 275 net_log_.EndEvent(NetLog::TYPE_CERT_VERIFIER_JOB, NULL);
275 worker_->Cancel(); 276 worker_->Cancel();
276 DeleteAllCanceled(); 277 DeleteAllCanceled();
277 } 278 }
278 } 279 }
279 280
280 void AddRequest(CertVerifierRequest* request) { 281 void AddRequest(CertVerifierRequest* request) {
281 request->net_log().AddEvent( 282 request->net_log().AddEvent(
282 NetLog::TYPE_CERT_VERIFIER_REQUEST_BOUND_TO_JOB, 283 NetLog::TYPE_CERT_VERIFIER_REQUEST_BOUND_TO_JOB,
283 make_scoped_refptr(new NetLogSourceParameter( 284 net_log_.source().ToEventParametersCallback());
284 "source_dependency", net_log_.source())));
285 285
286 requests_.push_back(request); 286 requests_.push_back(request);
287 } 287 }
288 288
289 void HandleResult( 289 void HandleResult(
290 const MultiThreadedCertVerifier::CachedResult& verify_result) { 290 const MultiThreadedCertVerifier::CachedResult& verify_result) {
291 worker_ = NULL; 291 worker_ = NULL;
292 net_log_.EndEvent(NetLog::TYPE_CERT_VERIFIER_JOB, NULL); 292 net_log_.EndEvent(NetLog::TYPE_CERT_VERIFIER_JOB, NULL);
293 UMA_HISTOGRAM_CUSTOM_TIMES("Net.CertVerifier_Job_Latency", 293 UMA_HISTOGRAM_CUSTOM_TIMES("Net.CertVerifier_Job_Latency",
294 base::TimeTicks::Now() - start_time_, 294 base::TimeTicks::Now() - start_time_,
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 DCHECK(CalledOnValidThread()); 448 DCHECK(CalledOnValidThread());
449 449
450 ClearCache(); 450 ClearCache();
451 } 451 }
452 452
453 void MultiThreadedCertVerifier::SetCertVerifyProc(CertVerifyProc* verify_proc) { 453 void MultiThreadedCertVerifier::SetCertVerifyProc(CertVerifyProc* verify_proc) {
454 verify_proc_ = verify_proc; 454 verify_proc_ = verify_proc;
455 } 455 }
456 456
457 } // namespace net 457 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698