| OLD | NEW |
| 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 Loading... |
| 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 scoped_refptr<base::FieldTrial> trial = | 31 scoped_refptr<base::FieldTrial> trial( |
| 32 new base::FieldTrial("WebSocketExperiment", 1000); | 32 new base::FieldTrial("WebSocketExperiment", 1000)); |
| 33 trial->AppendGroup("active", 5); // 0.5% in active group. | 33 trial->AppendGroup("active", 5); // 0.5% in active group. |
| 34 | 34 |
| 35 bool run_experiment = | 35 bool run_experiment = |
| 36 (trial->group() != base::FieldTrial::kNotParticipating); | 36 (trial->group() != base::FieldTrial::kNotParticipating); |
| 37 #ifndef NDEBUG | 37 #ifndef NDEBUG |
| 38 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 38 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 39 std::string experiment_host = command_line.GetSwitchValueASCII( | 39 std::string experiment_host = command_line.GetSwitchValueASCII( |
| 40 switches::kWebSocketLiveExperimentHost); | 40 switches::kWebSocketLiveExperimentHost); |
| 41 if (!experiment_host.empty()) | 41 if (!experiment_host.empty()) |
| 42 run_experiment = true; | 42 run_experiment = true; |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 Release(); | 226 Release(); |
| 227 return; | 227 return; |
| 228 } | 228 } |
| 229 task_->SaveResult(); | 229 task_->SaveResult(); |
| 230 task_.reset(); | 230 task_.reset(); |
| 231 | 231 |
| 232 DoLoop(); | 232 DoLoop(); |
| 233 } | 233 } |
| 234 | 234 |
| 235 } // namespace chrome_browser_net_websocket_experiment | 235 } // namespace chrome_browser_net_websocket_experiment |
| OLD | NEW |