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

Side by Side Diff: chrome/browser/net/websocket_experiment/websocket_experiment_runner.cc

Issue 6216004: Feature to disable field trials in old versions of Chromium. Field trials... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/net/websocket_experiment/websocket_experiment_runner.h" 5 #include "chrome/browser/net/websocket_experiment/websocket_experiment_runner.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/metrics/field_trial.h" 10 #include "base/metrics/field_trial.h"
(...skipping 10 matching lines...) Expand all
21 static const char *kExperimentHost = "websocket-experiment.chromium.org"; 21 static const char *kExperimentHost = "websocket-experiment.chromium.org";
22 static const int kAlternativePort = 61985; 22 static const int kAlternativePort = 61985;
23 23
24 // Hold reference while experiment is running. 24 // Hold reference while experiment is running.
25 static scoped_refptr<WebSocketExperimentRunner> runner; 25 static scoped_refptr<WebSocketExperimentRunner> runner;
26 26
27 /* static */ 27 /* static */
28 void WebSocketExperimentRunner::Start() { 28 void WebSocketExperimentRunner::Start() {
29 DCHECK(!runner.get()); 29 DCHECK(!runner.get());
30 30
31 // After June 30, 2011 builds, it will always be in defaut group.
31 scoped_refptr<base::FieldTrial> trial( 32 scoped_refptr<base::FieldTrial> trial(
32 new base::FieldTrial("WebSocketExperiment", 1000)); 33 new base::FieldTrial("WebSocketExperiment", 1000, "default", 2011, 6,
33 trial->AppendGroup("active", 5); // 0.5% in active group. 34 30));
35 int active = trial->AppendGroup("active", 5); // 0.5% in active group.
34 36
35 bool run_experiment = 37 bool run_experiment = (trial->group() == active);
36 (trial->group() != base::FieldTrial::kNotParticipating);
37 #ifndef NDEBUG 38 #ifndef NDEBUG
38 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 39 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
39 std::string experiment_host = command_line.GetSwitchValueASCII( 40 std::string experiment_host = command_line.GetSwitchValueASCII(
40 switches::kWebSocketLiveExperimentHost); 41 switches::kWebSocketLiveExperimentHost);
41 if (!experiment_host.empty()) 42 if (!experiment_host.empty())
42 run_experiment = true; 43 run_experiment = true;
43 #else 44 #else
44 run_experiment = false; 45 run_experiment = false;
45 #endif 46 #endif
46 if (!run_experiment) 47 if (!run_experiment)
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 Release(); 227 Release();
227 return; 228 return;
228 } 229 }
229 task_->SaveResult(); 230 task_->SaveResult();
230 task_.reset(); 231 task_.reset();
231 232
232 DoLoop(); 233 DoLoop();
233 } 234 }
234 235
235 } // namespace chrome_browser_net_websocket_experiment 236 } // namespace chrome_browser_net_websocket_experiment
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698