Chromium Code Reviews| Index: components/domain_reliability/context_manager.cc |
| diff --git a/components/domain_reliability/context_manager.cc b/components/domain_reliability/context_manager.cc |
| index bcdb530de64d7b639438cf5a11e4fec6af57598c..256195fcecd5145b509b57d0fbeb57ee12883ab7 100644 |
| --- a/components/domain_reliability/context_manager.cc |
| +++ b/components/domain_reliability/context_manager.cc |
| @@ -6,6 +6,8 @@ |
| #include <utility> |
| +#include "base/metrics/histogram_macros.h" |
| + |
| namespace domain_reliability { |
| DomainReliabilityContextManager::DomainReliabilityContextManager( |
| @@ -24,7 +26,16 @@ void DomainReliabilityContextManager::RouteBeacon( |
| if (!context) |
| return; |
| - context->OnBeacon(std::move(beacon)); |
| + bool queued = context->OnBeacon(std::move(beacon)); |
| + if (!queued) |
| + return; |
| + |
| + base::TimeTicks now = base::TimeTicks::Now(); |
| + if (!last_routed_beacon_time_.is_null()) { |
| + UMA_HISTOGRAM_LONG_TIMES("DomainReliability.BeaconIntervalGlobal", |
| + now - last_routed_beacon_time_); |
| + } |
| + last_routed_beacon_time_ = now; |
| } |
| void DomainReliabilityContextManager::SetConfig( |
| @@ -48,13 +59,16 @@ void DomainReliabilityContextManager::SetConfig( |
| if (contexts_[key]->config().Equals(*config)) { |
| DVLOG(1) << "Ignoring unchanged NEL header for existing origin " |
| << origin.spec() << "."; |
| + UMA_HISTOGRAM_BOOLEAN("DomainReliability.SetConfigRecreatedContext", |
| + false); |
| return; |
| + } else { |
| + UMA_HISTOGRAM_BOOLEAN("DomainReliability.SetConfigRecreatedContext", |
| + true); |
|
Alexei Svitkine (slow)
2016/11/01 14:49:46
Please refactor the code to avoid having two macro
Julia Tuttle
2016/11/01 15:52:47
Done.
|
| } |
| // TODO(juliatuttle): Make Context accept Config changes. |
| } |
| - DVLOG(1) << "Adding/replacing context for existing origin " << origin.spec() |
|
Julia Tuttle
2016/10/31 23:32:05
Note to self: Put this back.
Julia Tuttle
2016/11/01 15:52:47
Done.
|
| - << "."; |
| removed_contexts_.erase(key); |
| config->origin = origin; |
| AddContextForConfig(std::move(config)); |