summaryrefslogtreecommitdiffstats
path: root/chrome/renderer
diff options
context:
space:
mode:
authorjar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-20 03:49:05 +0000
committerjar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-20 03:49:05 +0000
commit4646f29cf92e2b3cd70158067d11431ae9351bcf (patch)
treed21b85657ca5d59e5383d84ea9d602a943942908 /chrome/renderer
parenta199e400093448023d4f6c555f32d230b3fb2fcd (diff)
downloadchromium_src-4646f29cf92e2b3cd70158067d11431ae9351bcf.zip
chromium_src-4646f29cf92e2b3cd70158067d11431ae9351bcf.tar.gz
chromium_src-4646f29cf92e2b3cd70158067d11431ae9351bcf.tar.bz2
Facilitate a FieldTrial in the renderer
I added a command line for the renderer that accepts a FieldTrial name and value, and forces that value to be activated in the renderer. As a result, any FieldTrial setting that is specified by the browser process can be set (forced) in the renderer process. Such settings can then be used to establish names of histograms, which means all processes can work in sync on a single field trial (and generate data). This should allow A/B tests to be run that modulate the page load times. Dave: Please review/confirm that you are happy with the changes to render_view.cc. Note that all I did was change the names and limits for the histograms (they now go up to 3 minutes). The MakeName() allows me to get an A/B test of the impact of DNS pre-resolution. Mike: Please review the code for passing along switch settings. r=davemoore,mbelshe Review URL: http://codereview.chromium.org/115525 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16460 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r--chrome/renderer/render_view.cc39
-rw-r--r--chrome/renderer/renderer_main.cc13
2 files changed, 39 insertions, 13 deletions
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index 8a311af..33a25de 100644
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -15,6 +15,7 @@
#include "app/resource_bundle.h"
#include "base/command_line.h"
#include "base/compiler_specific.h"
+#include "base/field_trial.h"
#include "base/gfx/png_encoder.h"
#include "base/gfx/native_widget_types.h"
#include "base/string_piece.h"
@@ -249,7 +250,7 @@ RenderView* RenderView::Create(
void RenderView::SetNextPageID(int32 next_page_id) {
// This method should only be called during process startup, and the given
// page id had better not exceed our current next page id!
- DCHECK(next_page_id_ == 1);
+ DCHECK_EQ(next_page_id_, 1);
DCHECK(next_page_id >= next_page_id_);
next_page_id_ = next_page_id;
}
@@ -534,7 +535,7 @@ void RenderView::PrintPage(const ViewMsg_PrintPage_Params& params,
// Get the size of the compiled EMF.
unsigned buf_size = emf.GetDataSize();
- DCHECK(buf_size > 128);
+ DCHECK_GT(buf_size, 128u);
ViewHostMsg_DidPrintPage_Params page_params;
page_params.data_size = 0;
page_params.emf_data_handle = NULL;
@@ -1532,7 +1533,7 @@ void RenderView::DocumentElementAvailable(WebFrame* frame) {
frame->GrantUniversalAccess();
// Tell extensions to self-register their js contexts.
- // TODO:(rafaelw): This is kind of gross. We need a way to call through
+ // TODO(rafaelw): This is kind of gross. We need a way to call through
// the glue layer to retrieve the current v8::Context.
if (frame->GetURL().SchemeIs(chrome::kExtensionScheme))
ExtensionProcessBindings::RegisterExtensionContext(frame);
@@ -3009,19 +3010,33 @@ void RenderView::DumpLoadHistograms() const {
// Client side redirects will have no request time
if (request_time.ToInternalValue() != 0) {
- UMA_HISTOGRAM_TIMES("Renderer.All.RequestToStart", request_to_start);
- UMA_HISTOGRAM_TIMES("Renderer.All.RequestToFinish", request_to_finish);
+ UMA_HISTOGRAM_MEDIUM_TIMES(
+ FieldTrial::MakeName("Renderer2.RequestToStart", "DnsImpact").data(),
+ request_to_start);
+ UMA_HISTOGRAM_MEDIUM_TIMES(
+ FieldTrial::MakeName("Renderer2.RequestToFinish", "DnsImpact").data(),
+ request_to_finish);
if (request_to_first_layout.ToInternalValue() >= 0) {
- UMA_HISTOGRAM_TIMES(
- "Renderer.All.RequestToFirstLayout", request_to_first_layout);
+ UMA_HISTOGRAM_MEDIUM_TIMES(
+ FieldTrial::MakeName("Renderer2.RequestToFirstLayout",
+ "DnsImpact").data(),
+ request_to_first_layout);
}
}
- UMA_HISTOGRAM_TIMES("Renderer.All.StartToFinishDoc", start_to_finish_doc);
- UMA_HISTOGRAM_TIMES("Renderer.All.FinishDocToFinish", finish_doc_to_finish);
- UMA_HISTOGRAM_TIMES("Renderer.All.StartToFinish", start_to_finish);
+ UMA_HISTOGRAM_MEDIUM_TIMES(
+ FieldTrial::MakeName("Renderer2.StartToFinishDoc", "DnsImpact").data(),
+ start_to_finish_doc);
+ UMA_HISTOGRAM_MEDIUM_TIMES(
+ FieldTrial::MakeName("Renderer2.FinishDocToFinish", "DnsImpact").data(),
+ finish_doc_to_finish);
+ UMA_HISTOGRAM_MEDIUM_TIMES(
+ FieldTrial::MakeName("Renderer2.StartToFinish", "DnsImpact").data(),
+ start_to_finish);
if (start_to_first_layout.ToInternalValue() >= 0) {
- UMA_HISTOGRAM_TIMES(
- "Renderer.All.StartToFirstLayout", start_to_first_layout);
+ UMA_HISTOGRAM_MEDIUM_TIMES(
+ FieldTrial::MakeName("Renderer2.StartToFirstLayout",
+ "DnsImpact").data(),
+ start_to_first_layout);
}
}
diff --git a/chrome/renderer/renderer_main.cc b/chrome/renderer/renderer_main.cc
index 74b5334..fc4d291 100644
--- a/chrome/renderer/renderer_main.cc
+++ b/chrome/renderer/renderer_main.cc
@@ -5,6 +5,7 @@
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
#include "base/command_line.h"
+#include "base/field_trial.h"
#include "base/histogram.h"
#include "base/message_loop.h"
#include "base/path_service.h"
@@ -88,12 +89,22 @@ int RendererMain(const MainFunctionParams& parameters) {
platform.InitSandboxTests(no_sandbox);
// Initialize histogram statistics gathering system.
- // Don't create StatisticsRecorde in the single process mode.
+ // Don't create StatisticsRecorder in the single process mode.
scoped_ptr<StatisticsRecorder> statistics;
if (!StatisticsRecorder::WasStarted()) {
statistics.reset(new StatisticsRecorder());
}
+ // Initialize statistical testing infrastructure.
+ FieldTrialList field_trial;
+ // Ensure any field trials in browser are reflected into renderer.
+ if (parsed_command_line.HasSwitch(switches::kForceFieldTestNameAndValue)) {
+ std::string persistent(WideToASCII(parsed_command_line.GetSwitchValue(
+ switches::kForceFieldTestNameAndValue)));
+ FieldTrial *field_trial = FieldTrial::RestorePersistentString(persistent);
+ DCHECK(field_trial);
+ }
+
{
RenderProcess render_process;
bool run_loop = true;