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

Unified Diff: chrome/renderer/page_load_histograms.cc

Issue 1363673004: [DRP] Consistently use LoFi for an entire page (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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: chrome/renderer/page_load_histograms.cc
diff --git a/chrome/renderer/page_load_histograms.cc b/chrome/renderer/page_load_histograms.cc
index b7fd03ec3cc5e3d03c096bf516a86d3c7a3e48d4..3d8bfe29d5646eb139035b924eef2f288202f87a 100644
--- a/chrome/renderer/page_load_histograms.cc
+++ b/chrome/renderer/page_load_histograms.cc
@@ -21,8 +21,10 @@
#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_frame.h"
#include "content/public/renderer/render_thread.h"
#include "content/public/renderer/render_view.h"
#include "extensions/common/url_pattern.h"
@@ -48,6 +50,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 +67,16 @@ TimeDelta kPLTMax() {
return TimeDelta::FromMinutes(10);
}
+bool IsInLoFiEnabledGroup() {
tbansal1 2015/09/28 17:49:02 It would be preferable if IsInLoFiEnabledGroup() i
megjablon 2015/09/28 22:43:37 Done.
+ 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 +234,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,
tbansal1 2015/09/28 17:49:02 Can you please explain what |lofi_on| in comments?
megjablon 2015/09/28 22:43:37 Done.
bool came_from_websearch,
int websearch_chrome_joint_experiment_id,
bool is_preview,
@@ -411,6 +426,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 +437,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 +450,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 +474,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 +492,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 +539,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 +557,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",
@@ -878,13 +893,10 @@ 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()) {
bool handled =
- 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));
// If the IPC call is not handled, then |data_reduction_proxy_was_used|
// should remain |false|.
DCHECK(handled || !data_reduction_proxy_was_used);
@@ -905,10 +917,10 @@ 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);
+ DumpHistograms(
+ frame->performance(), document_state, data_reduction_proxy_was_used,
+ false /* TODO: render_frame->IsLoFiOn() */, 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.

Powered by Google App Engine
This is Rietveld 408576698