| Index: chrome/renderer/page_load_histograms.cc
|
| diff --git a/chrome/renderer/page_load_histograms.cc b/chrome/renderer/page_load_histograms.cc
|
| index f032204224350963e36be4e6bbe24806bbf9486f..c48b4847b839bf45884019d421df52457c55692a 100644
|
| --- a/chrome/renderer/page_load_histograms.cc
|
| +++ b/chrome/renderer/page_load_histograms.cc
|
| @@ -21,6 +21,7 @@
|
| #include "chrome/renderer/chrome_content_renderer_client.h"
|
| #include "chrome/renderer/searchbox/search_bouncer.h"
|
| #include "components/data_reduction_proxy/content/common/data_reduction_proxy_messages.h"
|
| +#include "components/data_reduction_proxy/core/common/data_reduction_proxy_params.h"
|
| #include "content/public/common/content_constants.h"
|
| #include "content/public/renderer/document_state.h"
|
| #include "content/public/renderer/render_thread.h"
|
| @@ -48,6 +49,9 @@ const size_t kPLTCount = 100;
|
|
|
| namespace {
|
|
|
| +const char kEnabled[] = "Enabled";
|
| +const char kControl[] = "Control";
|
| +
|
| // ID indicating that no GWS-Chrome joint experiment is active.
|
| const int kNoExperiment = 0;
|
|
|
| @@ -62,6 +66,16 @@ TimeDelta kPLTMax() {
|
| return TimeDelta::FromMinutes(10);
|
| }
|
|
|
| +bool IsInLoFiEnabledGroup() {
|
| + return base::FieldTrialList::FindFullName(
|
| + data_reduction_proxy::params::GetLoFiFieldTrialName()) == kEnabled;
|
| +}
|
| +
|
| +bool IsInLoFiControlGroup() {
|
| + return base::FieldTrialList::FindFullName(
|
| + data_reduction_proxy::params::GetLoFiFieldTrialName()) == kControl;
|
| +}
|
| +
|
| // This function corresponds to PLT_HISTOGRAM macro invocation without caching.
|
| // Use this for PLT histograms with dynamically generated names, which
|
| // otherwise can't use the caching PLT_HISTOGRAM macro without code duplication.
|
| @@ -219,7 +233,7 @@ int GetQueryStringBasedExperiment(const GURL& referrer) {
|
| void DumpHistograms(const WebPerformance& performance,
|
| DocumentState* document_state,
|
| bool data_reduction_proxy_was_used,
|
| - data_reduction_proxy::LoFiStatus lofi_status,
|
| + bool lofi_on,
|
| bool came_from_websearch,
|
| int websearch_chrome_joint_experiment_id,
|
| bool is_preview,
|
| @@ -411,6 +425,8 @@ void DumpHistograms(const WebPerformance& performance,
|
| websearch_chrome_joint_experiment_id,
|
| is_preview);
|
| if (data_reduction_proxy_was_used) {
|
| + bool in_lofi_enabled_group = IsInLoFiEnabledGroup();
|
| + bool in_lofi_control_group = IsInLoFiControlGroup();
|
| if ((scheme_type & URLPattern::SCHEME_HTTPS) == 0) {
|
| PLT_HISTOGRAM("PLT.PT_BeginToFinish_DataReductionProxy",
|
| load_event_end - begin);
|
| @@ -420,7 +436,7 @@ void DumpHistograms(const WebPerformance& performance,
|
| load_event_end - navigation_start);
|
| PLT_HISTOGRAM("PLT.PT_StartToFinish_DataReductionProxy",
|
| load_event_end - request_start);
|
| - if (lofi_status == data_reduction_proxy::LOFI_STATUS_ACTIVE) {
|
| + if (lofi_on && in_lofi_enabled_group) {
|
| PLT_HISTOGRAM("PLT.PT_BeginToFinish_DataReductionProxy_AutoLoFiOn",
|
| load_event_end - begin);
|
| PLT_HISTOGRAM("PLT.PT_CommitToFinish_DataReductionProxy_AutoLoFiOn",
|
| @@ -433,8 +449,7 @@ void DumpHistograms(const WebPerformance& performance,
|
| PLT_HISTOGRAM("PLT.BeginToFirstPaint_DataReductionProxy_AutoLoFiOn",
|
| first_paint - begin);
|
| }
|
| - } else if (lofi_status ==
|
| - data_reduction_proxy::LOFI_STATUS_ACTIVE_CONTROL) {
|
| + } else if (lofi_on && in_lofi_control_group) {
|
| PLT_HISTOGRAM("PLT.PT_BeginToFinish_DataReductionProxy_AutoLoFiOff",
|
| load_event_end - begin);
|
| PLT_HISTOGRAM("PLT.PT_CommitToFinish_DataReductionProxy_AutoLoFiOff",
|
| @@ -458,7 +473,7 @@ void DumpHistograms(const WebPerformance& performance,
|
| load_event_end - navigation_start);
|
| PLT_HISTOGRAM("PLT.PT_StartToFinish_HTTPS_DataReductionProxy",
|
| load_event_end - request_start);
|
| - if (lofi_status == data_reduction_proxy::LOFI_STATUS_ACTIVE) {
|
| + if (lofi_on && in_lofi_enabled_group) {
|
| PLT_HISTOGRAM(
|
| "PLT.PT_BeginToFinish_HTTPS_DataReductionProxy_AutoLoFiOn",
|
| load_event_end - begin);
|
| @@ -476,8 +491,7 @@ void DumpHistograms(const WebPerformance& performance,
|
| "PLT.BeginToFirstPaint_HTTPS_DataReductionProxy_AutoLoFiOn",
|
| first_paint - begin);
|
| }
|
| - } else if (lofi_status ==
|
| - data_reduction_proxy::LOFI_STATUS_ACTIVE_CONTROL) {
|
| + } else if (lofi_on && in_lofi_control_group) {
|
| PLT_HISTOGRAM(
|
| "PLT.PT_BeginToFinish_HTTPS_DataReductionProxy_AutoLoFiOff",
|
| load_event_end - begin);
|
| @@ -524,15 +538,16 @@ void DumpHistograms(const WebPerformance& performance,
|
| websearch_chrome_joint_experiment_id,
|
| is_preview);
|
| if (data_reduction_proxy_was_used) {
|
| + bool in_lofi_enabled_group = IsInLoFiEnabledGroup();
|
| + bool in_lofi_control_group = IsInLoFiControlGroup();
|
| if ((scheme_type & URLPattern::SCHEME_HTTPS) == 0) {
|
| PLT_HISTOGRAM("PLT.PT_RequestToDomContentLoaded_DataReductionProxy",
|
| dom_content_loaded_start - navigation_start);
|
| - if (lofi_status == data_reduction_proxy::LOFI_STATUS_ACTIVE) {
|
| + if (lofi_on && in_lofi_enabled_group) {
|
| PLT_HISTOGRAM(
|
| "PLT.PT_RequestToDomContentLoaded_DataReductionProxy_AutoLoFiOn",
|
| dom_content_loaded_start - navigation_start);
|
| - } else if (lofi_status ==
|
| - data_reduction_proxy::LOFI_STATUS_ACTIVE_CONTROL) {
|
| + } else if (lofi_on && in_lofi_control_group) {
|
| PLT_HISTOGRAM(
|
| "PLT.PT_RequestToDomContentLoaded_DataReductionProxy_AutoLoFiOff",
|
| dom_content_loaded_start - navigation_start);
|
| @@ -541,13 +556,12 @@ void DumpHistograms(const WebPerformance& performance,
|
| PLT_HISTOGRAM(
|
| "PLT.PT_RequestToDomContentLoaded_HTTPS_DataReductionProxy",
|
| dom_content_loaded_start - navigation_start);
|
| - if (lofi_status == data_reduction_proxy::LOFI_STATUS_ACTIVE) {
|
| + if (lofi_on && in_lofi_enabled_group) {
|
| PLT_HISTOGRAM(
|
| "PLT.PT_RequestToDomContentLoaded_HTTPS_DataReductionProxy_"
|
| "AutoLoFiOn",
|
| dom_content_loaded_start - navigation_start);
|
| - } else if (lofi_status ==
|
| - data_reduction_proxy::LOFI_STATUS_ACTIVE_CONTROL) {
|
| + } else if (lofi_on && in_lofi_control_group) {
|
| PLT_HISTOGRAM(
|
| "PLT.PT_RequestToDomContentLoaded_HTTPS_DataReductionProxy_"
|
| "AutoLoFiOff",
|
| @@ -867,7 +881,7 @@ bool PageLoadHistograms::ShouldDump(WebFrame* frame) {
|
| return true;
|
| }
|
|
|
| -void PageLoadHistograms::Dump(WebFrame* frame) {
|
| +void PageLoadHistograms::Dump(WebFrame* frame, bool lofi_used) {
|
| if (!ShouldDump(frame))
|
| return;
|
|
|
| @@ -878,12 +892,9 @@ void PageLoadHistograms::Dump(WebFrame* frame) {
|
| DocumentState::FromDataSource(frame->dataSource());
|
|
|
| bool data_reduction_proxy_was_used = false;
|
| - data_reduction_proxy::LoFiStatus lofi_status =
|
| - data_reduction_proxy::LOFI_STATUS_TEMPORARILY_OFF;
|
| if (!document_state->proxy_server().IsEmpty()) {
|
| - Send(new DataReductionProxyViewHostMsg_DataReductionProxyStatus(
|
| - document_state->proxy_server(), &data_reduction_proxy_was_used,
|
| - &lofi_status));
|
| + Send(new DataReductionProxyViewHostMsg_IsDataReductionProxy(
|
| + document_state->proxy_server(), &data_reduction_proxy_was_used));
|
| }
|
|
|
| bool came_from_websearch =
|
| @@ -902,9 +913,8 @@ void PageLoadHistograms::Dump(WebFrame* frame) {
|
| // Metrics based on the timing information recorded for the Navigation Timing
|
| // API - http://www.w3.org/TR/navigation-timing/.
|
| DumpHistograms(frame->performance(), document_state,
|
| - data_reduction_proxy_was_used, lofi_status,
|
| - came_from_websearch, websearch_chrome_joint_experiment_id,
|
| - is_preview, scheme_type);
|
| + data_reduction_proxy_was_used, lofi_used, came_from_websearch,
|
| + websearch_chrome_joint_experiment_id, is_preview, scheme_type);
|
|
|
| // Old metrics based on the timing information stored in DocumentState. These
|
| // are deprecated and should go away.
|
| @@ -953,15 +963,15 @@ void PageLoadHistograms::MaybeDumpFirstLayoutHistograms() {
|
| dumped_first_layout_histograms_ = true;
|
| }
|
|
|
| -void PageLoadHistograms::FrameWillClose(WebFrame* frame) {
|
| - Dump(frame);
|
| +void PageLoadHistograms::FrameWillClose(WebFrame* frame, bool lofi_used) {
|
| + Dump(frame, lofi_used);
|
| }
|
|
|
| -void PageLoadHistograms::ClosePage() {
|
| +void PageLoadHistograms::ClosePage(bool lofi_used) {
|
| // TODO(davemoore) This code should be removed once willClose() gets
|
| // called when a page is destroyed. page_load_histograms_.Dump() is safe
|
| // to call multiple times for the same frame, but it will simplify things.
|
| - Dump(render_view()->GetWebView()->mainFrame());
|
| + Dump(render_view()->GetWebView()->mainFrame(), lofi_used);
|
| }
|
|
|
| void PageLoadHistograms::DidUpdateLayout() {
|
|
|