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

Unified Diff: chrome/renderer/page_load_histograms.cc

Issue 1310743003: Consistently use LoFi for an entire page (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: test fixes Created 5 years, 4 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 f032204224350963e36be4e6bbe24806bbf9486f..fc1bbb6571fc23ea108da80c73effec32289c072 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;
@@ -219,7 +223,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 +415,14 @@ void DumpHistograms(const WebPerformance& performance,
websearch_chrome_joint_experiment_id,
is_preview);
if (data_reduction_proxy_was_used) {
+ bool in_lofi_enabled =
bengr 2015/08/25 00:00:01 Rename as in_lofi_enabled_group, or lofi_available
megjablon 2015/08/25 20:29:45 Done.
+ (base::FieldTrialList::FindFullName(
+ data_reduction_proxy::params::GetLoFiFieldTrialName()) ==
+ kEnabled);
+ bool in_lofi_control =
bengr 2015/08/25 00:00:01 Rename as in_lofi_control_group, or lofi_control_g
megjablon 2015/08/25 20:29:45 Done.
+ (base::FieldTrialList::FindFullName(
+ data_reduction_proxy::params::GetLoFiFieldTrialName()) ==
+ kControl);
if ((scheme_type & URLPattern::SCHEME_HTTPS) == 0) {
PLT_HISTOGRAM("PLT.PT_BeginToFinish_DataReductionProxy",
load_event_end - begin);
@@ -420,7 +432,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) {
PLT_HISTOGRAM("PLT.PT_BeginToFinish_DataReductionProxy_AutoLoFiOn",
load_event_end - begin);
PLT_HISTOGRAM("PLT.PT_CommitToFinish_DataReductionProxy_AutoLoFiOn",
@@ -433,8 +445,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) {
PLT_HISTOGRAM("PLT.PT_BeginToFinish_DataReductionProxy_AutoLoFiOff",
load_event_end - begin);
PLT_HISTOGRAM("PLT.PT_CommitToFinish_DataReductionProxy_AutoLoFiOff",
@@ -458,7 +469,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) {
PLT_HISTOGRAM(
"PLT.PT_BeginToFinish_HTTPS_DataReductionProxy_AutoLoFiOn",
load_event_end - begin);
@@ -476,8 +487,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) {
PLT_HISTOGRAM(
"PLT.PT_BeginToFinish_HTTPS_DataReductionProxy_AutoLoFiOff",
load_event_end - begin);
@@ -524,15 +534,22 @@ void DumpHistograms(const WebPerformance& performance,
websearch_chrome_joint_experiment_id,
is_preview);
if (data_reduction_proxy_was_used) {
+ bool in_lofi_enabled =
+ (base::FieldTrialList::FindFullName(
+ data_reduction_proxy::params::GetLoFiFieldTrialName()) ==
+ kEnabled);
+ bool in_lofi_control =
+ (base::FieldTrialList::FindFullName(
+ data_reduction_proxy::params::GetLoFiFieldTrialName()) ==
bengr 2015/08/25 00:00:01 It's probably worth the extra few lines of code to
megjablon 2015/08/25 20:29:45 Done.
+ kControl);
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) {
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) {
PLT_HISTOGRAM(
"PLT.PT_RequestToDomContentLoaded_DataReductionProxy_AutoLoFiOff",
dom_content_loaded_start - navigation_start);
@@ -541,13 +558,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) {
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) {
PLT_HISTOGRAM(
"PLT.PT_RequestToDomContentLoaded_HTTPS_DataReductionProxy_"
"AutoLoFiOff",
@@ -867,7 +883,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 +894,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));
+ document_state->proxy_server(), &data_reduction_proxy_was_used));
}
bool came_from_websearch =
@@ -902,9 +915,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 +965,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() {

Powered by Google App Engine
This is Rietveld 408576698