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

Unified Diff: components/data_reduction_proxy/core/common/data_reduction_proxy_event_creator.cc

Issue 1105443003: Add net_log events for the Data Reduction Proxy config service client. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: bengr CR comments Created 5 years, 8 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/data_reduction_proxy/core/common/data_reduction_proxy_event_creator.cc
diff --git a/components/data_reduction_proxy/core/common/data_reduction_proxy_event_creator.cc b/components/data_reduction_proxy/core/common/data_reduction_proxy_event_creator.cc
index 1ce6246e4d2f71f96b21d6d280c43ecfa20e07fd..98fdd68aab17fd8805e928f3e0fad8b68ddb621b 100644
--- a/components/data_reduction_proxy/core/common/data_reduction_proxy_event_creator.cc
+++ b/components/data_reduction_proxy/core/common/data_reduction_proxy_event_creator.cc
@@ -125,6 +125,23 @@ base::Value* EndCanaryRequestCallback(
return dict;
}
+// A callback that creates a base::Value containing information about
+// completing the Data Reduction Proxy configuration request. Ownership of the
+// base::Value is passed to the caller.
+base::Value* EndConfigRequestCallback(
+ int net_error,
+ int http_response_code,
+ int failure_count,
+ int64 expiration_ticks,
+ net::NetLogCaptureMode /* capture_mode */) {
+ base::DictionaryValue* dict = new base::DictionaryValue();
+ dict->SetInteger("net_error", net_error);
+ dict->SetInteger("http_response_code", http_response_code);
+ dict->SetInteger("failure_count", failure_count);
+ dict->SetString("expiration", base::Int64ToString(expiration_ticks));
+ return dict;
+}
+
} // namespace
namespace data_reduction_proxy {
@@ -224,6 +241,32 @@ void DataReductionProxyEventCreator::EndSecureProxyCheck(
parameters_callback);
}
+void DataReductionProxyEventCreator::BeginConfigRequest(
+ const net::BoundNetLog& net_log,
+ const GURL& url) {
+ // This callback must be invoked synchronously.
+ const net::NetLog::ParametersCallback& parameters_callback =
+ net::NetLog::StringCallback("url", &url.spec());
+ PostBoundNetLogConfigRequestEvent(
+ net_log, net::NetLog::TYPE_DATA_REDUCTION_PROXY_CONFIG_REQUEST,
+ net::NetLog::PHASE_BEGIN, parameters_callback);
+}
+
+void DataReductionProxyEventCreator::EndConfigRequest(
+ const net::BoundNetLog& net_log,
+ int net_error,
+ int http_response_code,
+ int failure_count,
+ const base::TimeDelta& retry_delay) {
+ int64 expiration_ticks = GetExpirationTicks(retry_delay.InSeconds());
+ const net::NetLog::ParametersCallback& parameters_callback =
+ base::Bind(&EndConfigRequestCallback, net_error, http_response_code,
+ failure_count, expiration_ticks);
+ PostBoundNetLogConfigRequestEvent(
+ net_log, net::NetLog::TYPE_DATA_REDUCTION_PROXY_CONFIG_REQUEST,
+ net::NetLog::PHASE_END, parameters_callback);
+}
+
void DataReductionProxyEventCreator::PostEnabledEvent(
net::NetLog* net_log,
net::NetLog::EventType type,
@@ -264,4 +307,17 @@ void DataReductionProxyEventCreator::PostBoundNetLogSecureProxyCheckEvent(
net_log.AddEntry(type, phase, callback);
}
+void DataReductionProxyEventCreator::PostBoundNetLogConfigRequestEvent(
+ const net::BoundNetLog& net_log,
+ net::NetLog::EventType type,
+ net::NetLog::EventPhase phase,
+ const net::NetLog::ParametersCallback& callback) {
+ scoped_ptr<base::Value> event(
+ BuildDataReductionProxyEvent(type, net_log.source(), phase, callback));
+ if (event) {
+ storage_delegate_->AddEvent(event.Pass());
+ net_log.AddEntry(type, phase, callback);
+ }
+}
+
} // namespace data_reduction_proxy

Powered by Google App Engine
This is Rietveld 408576698