Index: chrome/browser/ui/webui/net_internals_ui.cc |
diff --git a/chrome/browser/ui/webui/net_internals_ui.cc b/chrome/browser/ui/webui/net_internals_ui.cc |
index cd8d09d9fb9e1398292236575f8ad2058ca8a189..34eb05546a776fa75f34fec660f3ce33621d9ae5 100644 |
--- a/chrome/browser/ui/webui/net_internals_ui.cc |
+++ b/chrome/browser/ui/webui/net_internals_ui.cc |
@@ -15,6 +15,7 @@ |
#include "base/file_util.h" |
#include "base/memory/singleton.h" |
#include "base/message_loop.h" |
+#include "base/metrics/field_trial.h" // TODO(joi): Remove after experiment. |
#include "base/path_service.h" |
#include "base/string_number_conversions.h" |
#include "base/string_piece.h" |
@@ -177,6 +178,7 @@ class NetInternalsMessageHandler |
// Javascript message handlers. |
void OnRendererReady(const ListValue* list); |
void OnEnableHttpThrottling(const ListValue* list); |
+ void OnDisableThrottlingExperiments(const ListValue* list); |
#ifdef OS_CHROMEOS |
void OnRefreshSystemLogs(const ListValue* list); |
void OnGetSystemLog(const ListValue* list); |
@@ -272,6 +274,11 @@ class NetInternalsMessageHandler |
// be accessed on the UI thread. |
BooleanPrefMember http_throttling_enabled_; |
+ // The pref member that determines whether experimentation on HTTP throttling |
+ // is allowed (this becomes false once the user explicitly sets the |
+ // feature to on or off). |
+ BooleanPrefMember http_throttling_may_experiment_; |
+ |
// OnRendererReady invokes this callback to do the part of message handling |
// that needs to happen on the IO thread. |
scoped_ptr<WebUI::MessageCallback> renderer_ready_io_callback_; |
@@ -545,8 +552,10 @@ WebUIMessageHandler* NetInternalsMessageHandler::Attach(WebUI* web_ui) { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
PrefService* pref_service = web_ui->GetProfile()->GetPrefs(); |
- http_throttling_enabled_.Init(prefs::kHttpThrottlingEnabled, pref_service, |
- this); |
+ http_throttling_enabled_.Init( |
+ prefs::kHttpThrottlingEnabled, pref_service, this); |
+ http_throttling_may_experiment_.Init( |
+ prefs::kHttpThrottlingMayExperiment, pref_service, NULL); |
proxy_ = new IOThreadImpl(this->AsWeakPtr(), g_browser_process->io_thread(), |
web_ui->GetProfile()->GetRequestContext()); |
@@ -669,6 +678,11 @@ void NetInternalsMessageHandler::RegisterMessages() { |
web_ui_->RegisterMessageCallback( |
"enableHttpThrottling", |
NewCallback(this, &NetInternalsMessageHandler::OnEnableHttpThrottling)); |
+ web_ui_->RegisterMessageCallback( |
+ "disableThrottlingExperiments", |
+ NewCallback( |
+ this, |
+ &NetInternalsMessageHandler::OnDisableThrottlingExperiments)); |
} |
void NetInternalsMessageHandler::CallJavascriptFunction( |
@@ -720,6 +734,21 @@ void NetInternalsMessageHandler::OnEnableHttpThrottling(const ListValue* list) { |
http_throttling_enabled_.SetValue(enable); |
} |
+void NetInternalsMessageHandler::OnDisableThrottlingExperiments( |
yzshen1
2011/06/08 00:56:51
The logic within this method can be put in the met
Jói
2011/06/08 16:44:47
You're right. I thought this method was also used
|
+ const ListValue* list) { |
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
+ |
+ if (http_throttling_may_experiment_.GetValue()) { |
+ http_throttling_may_experiment_.SetValue(false); |
+ |
+ // Disable the ongoing trial so that histograms after this point |
+ // show as being in the "Default" group of the trial. |
+ base::FieldTrial* trial = base::FieldTrialList::Find("ThrottlingEnabled"); |
+ if (trial) |
+ trial->Disable(); |
yzshen1
2011/06/08 00:56:51
It may be better to move the part of disabling the
Jói
2011/06/08 16:44:47
I can't do that because that method gets called no
yzshen1
2011/06/08 16:55:54
Makes sense. Thanks for explaining.
On 2011/06/08
|
+ } |
+} |
+ |
//////////////////////////////////////////////////////////////////////////////// |
// |
// NetInternalsMessageHandler::ReadLogFileTask |