Chromium Code Reviews| Index: components/certificate_transparency/log_dns_client.cc |
| diff --git a/components/certificate_transparency/log_dns_client.cc b/components/certificate_transparency/log_dns_client.cc |
| index 62db1755f754b1ad28c7fe3151f8df6a073bc862..07a1ef8005fa97e83957092f9b54198407e1fe7e 100644 |
| --- a/components/certificate_transparency/log_dns_client.cc |
| +++ b/components/certificate_transparency/log_dns_client.cc |
| @@ -406,10 +406,15 @@ void LogDnsClient::OnDNSChanged() { |
| void LogDnsClient::OnInitialDNSConfigRead() { |
| UpdateDnsConfig(); |
| } |
| +void LogDnsClient::NotifyWhenNotThrottled(const base::Closure& callback) { |
| + DCHECK(HasMaxConcurrentQueriesInProgress()); |
| + not_throttled_callbacks_.push_back(callback); |
| +} |
| + |
| net::Error LogDnsClient::QueryAuditProof(base::StringPiece domain_for_log, |
| base::StringPiece leaf_hash, |
| uint64_t tree_size, |
| const AuditProofCallback& callback) { |
| if (domain_for_log.empty() || leaf_hash.size() != crypto::kSHA256Length) { |
| @@ -451,10 +456,15 @@ void LogDnsClient::QueryAuditProofComplete(const AuditProofCallback& callback, |
| DCHECK(query_iterator != audit_proof_queries_.end()); |
| audit_proof_queries_.erase(query_iterator); |
| base::ThreadTaskRunnerHandle::Get()->PostTask( |
| FROM_HERE, base::Bind(callback, result, base::Passed(&proof))); |
| + |
| + for (const base::Closure& callback : not_throttled_callbacks_) { |
| + callback.Run(); |
| + } |
| + not_throttled_callbacks_.clear(); |
|
Ryan Sleevi
2016/10/07 15:22:55
Because the base::Callback could result in deletio
Rob Percival
2016/10/20 12:43:13
Done.
|
| } |
| bool LogDnsClient::HasMaxConcurrentQueriesInProgress() const { |
| return max_concurrent_queries_ != 0 && |
| audit_proof_queries_.size() >= max_concurrent_queries_; |