| 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 cd2ef9c7b818f7cb971e2f9d2543de2bccf71d4c..dd7810d04c9072d930e3b8c6095439daf13c5178 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);
|
| +}
|
| +
|
| // |leaf_hash| is not a const-ref to allow callers to std::move that string into
|
| // the method, avoiding LogDnsClient::AuditProofQuery having to make a copy.
|
| net::Error LogDnsClient::QueryAuditProof(
|
| base::StringPiece domain_for_log,
|
| std::string leaf_hash,
|
| @@ -452,10 +457,16 @@ void LogDnsClient::QueryAuditProofComplete(
|
| });
|
| DCHECK(query_iterator != audit_proof_queries_.end());
|
| audit_proof_queries_.erase(query_iterator);
|
|
|
| callback.Run(net_error);
|
| +
|
| + // Notify interested parties that the next query will not be throttled.
|
| + std::list<base::Closure> callbacks = std::move(not_throttled_callbacks_);
|
| + for (const base::Closure& callback : callbacks) {
|
| + callback.Run();
|
| + }
|
| }
|
|
|
| bool LogDnsClient::HasMaxConcurrentQueriesInProgress() const {
|
| return max_concurrent_queries_ != 0 &&
|
| audit_proof_queries_.size() >= max_concurrent_queries_;
|
|
|