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

Unified Diff: components/certificate_transparency/log_dns_client.cc

Issue 2380293002: Adds LogDnsClient::NotifyWhenNotThrottled (Closed)
Patch Set: Rebase Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
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_;
« no previous file with comments | « components/certificate_transparency/log_dns_client.h ('k') | components/certificate_transparency/log_dns_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698