| OLD | NEW |
| 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/ssl/server_bound_cert_service.h" | 5 #include "net/ssl/server_bound_cert_service.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 } | 509 } |
| 510 | 510 |
| 511 if (err == OK) { | 511 if (err == OK) { |
| 512 // Async DB lookup found a valid cert. | 512 // Async DB lookup found a valid cert. |
| 513 DVLOG(1) << "Cert store had valid cert for " << server_identifier; | 513 DVLOG(1) << "Cert store had valid cert for " << server_identifier; |
| 514 cert_store_hits_++; | 514 cert_store_hits_++; |
| 515 // ServerBoundCertServiceRequest::Post will do the histograms and stuff. | 515 // ServerBoundCertServiceRequest::Post will do the histograms and stuff. |
| 516 HandleResult(OK, server_identifier, key, cert); | 516 HandleResult(OK, server_identifier, key, cert); |
| 517 return; | 517 return; |
| 518 } | 518 } |
| 519 // Async lookup did not find a valid cert. If no request asked to create one, | 519 // Async lookup failed or the certificate was missing. Return the error |
| 520 // return the error directly. | 520 // directly, unless the certificate was missing and a request asked to create |
| 521 if (!j->second->CreateIfMissing()) { | 521 // one. |
| 522 if (err != ERR_FILE_NOT_FOUND || !j->second->CreateIfMissing()) { |
| 522 HandleResult(err, server_identifier, key, cert); | 523 HandleResult(err, server_identifier, key, cert); |
| 523 return; | 524 return; |
| 524 } | 525 } |
| 525 // At least one request asked to create a cert => start generating a new one. | 526 // At least one request asked to create a cert => start generating a new one. |
| 526 workers_created_++; | 527 workers_created_++; |
| 527 ServerBoundCertServiceWorker* worker = new ServerBoundCertServiceWorker( | 528 ServerBoundCertServiceWorker* worker = new ServerBoundCertServiceWorker( |
| 528 server_identifier, | 529 server_identifier, |
| 529 base::Bind(&ServerBoundCertService::GeneratedServerBoundCert, | 530 base::Bind(&ServerBoundCertService::GeneratedServerBoundCert, |
| 530 weak_ptr_factory_.GetWeakPtr())); | 531 weak_ptr_factory_.GetWeakPtr())); |
| 531 if (!worker->Start(task_runner_)) { | 532 if (!worker->Start(task_runner_)) { |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 667 } | 668 } |
| 668 | 669 |
| 669 return err; | 670 return err; |
| 670 } | 671 } |
| 671 | 672 |
| 672 int ServerBoundCertService::cert_count() { | 673 int ServerBoundCertService::cert_count() { |
| 673 return server_bound_cert_store_->GetCertCount(); | 674 return server_bound_cert_store_->GetCertCount(); |
| 674 } | 675 } |
| 675 | 676 |
| 676 } // namespace net | 677 } // namespace net |
| OLD | NEW |