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

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

Issue 2595723002: Allow CertNetFetcher to be shutdown from the network thread (Closed)
Patch Set: tweak comments Created 4 years 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/cert_issuer_source_aia.h" 5 #include "net/cert/internal/cert_issuer_source_aia.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "net/cert/cert_net_fetcher.h" 8 #include "net/cert/cert_net_fetcher.h"
9 #include "net/cert/internal/cert_errors.h" 9 #include "net/cert/internal/cert_errors.h"
10 #include "url/gurl.h" 10 #include "url/gurl.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 auto req = std::move(cert_fetcher_requests_[current_request_++]); 51 auto req = std::move(cert_fetcher_requests_[current_request_++]);
52 req->WaitForResult(&error, &bytes); 52 req->WaitForResult(&error, &bytes);
53 53
54 if (AddCompletedFetchToResults(error, std::move(bytes), out_certs)) 54 if (AddCompletedFetchToResults(error, std::move(bytes), out_certs))
55 return; 55 return;
56 } 56 }
57 } 57 }
58 58
59 void AiaRequest::AddCertFetcherRequest( 59 void AiaRequest::AddCertFetcherRequest(
60 std::unique_ptr<CertNetFetcher::Request> cert_fetcher_request) { 60 std::unique_ptr<CertNetFetcher::Request> cert_fetcher_request) {
61 DCHECK(cert_fetcher_request); 61 if (!cert_fetcher_request)
62 return;
eroman 2017/01/03 20:42:37 See comment regarding interface
estark 2017/01/05 19:08:39 Done.
62 cert_fetcher_requests_.push_back(std::move(cert_fetcher_request)); 63 cert_fetcher_requests_.push_back(std::move(cert_fetcher_request));
63 } 64 }
64 65
65 bool AiaRequest::AddCompletedFetchToResults(Error error, 66 bool AiaRequest::AddCompletedFetchToResults(Error error,
66 std::vector<uint8_t> fetched_bytes, 67 std::vector<uint8_t> fetched_bytes,
67 ParsedCertificateList* results) { 68 ParsedCertificateList* results) {
68 if (error != OK) { 69 if (error != OK) {
69 // TODO(mattm): propagate error info. 70 // TODO(mattm): propagate error info.
70 LOG(ERROR) << "AiaRequest::OnFetchCompleted got error " << error; 71 LOG(ERROR) << "AiaRequest::OnFetchCompleted got error " << error;
71 return false; 72 return false;
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 // that this doesn't need to wait for async callback just to tell that an 145 // that this doesn't need to wait for async callback just to tell that an
145 // URL has an unsupported scheme? 146 // URL has an unsupported scheme?
146 aia_request->AddCertFetcherRequest(cert_fetcher_->FetchCaIssuers( 147 aia_request->AddCertFetcherRequest(cert_fetcher_->FetchCaIssuers(
147 url, kTimeoutMilliseconds, kMaxResponseBytes)); 148 url, kTimeoutMilliseconds, kMaxResponseBytes));
148 } 149 }
149 150
150 *out_req = std::move(aia_request); 151 *out_req = std::move(aia_request);
151 } 152 }
152 153
153 } // namespace net 154 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698