| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/chrome_net_benchmarking_message_filter.h" | 5 #include "chrome/browser/chrome_net_benchmarking_message_filter.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 // TODO(lzheng): This only enables spdy over ssl. Enable spdy for http | 105 // TODO(lzheng): This only enables spdy over ssl. Enable spdy for http |
| 106 // when needed. | 106 // when needed. |
| 107 void ChromeNetBenchmarkingMessageFilter::OnEnableSpdy(bool enable) { | 107 void ChromeNetBenchmarkingMessageFilter::OnEnableSpdy(bool enable) { |
| 108 // This function is disabled unless the user has enabled | 108 // This function is disabled unless the user has enabled |
| 109 // benchmarking extensions. | 109 // benchmarking extensions. |
| 110 if (!CheckBenchmarkingEnabled()) { | 110 if (!CheckBenchmarkingEnabled()) { |
| 111 NOTREACHED() << "Received unexpected benchmarking IPC"; | 111 NOTREACHED() << "Received unexpected benchmarking IPC"; |
| 112 return; | 112 return; |
| 113 } | 113 } |
| 114 if (enable) { | 114 if (enable) { |
| 115 net::HttpStreamFactory::EnableNpnSpdy(); | 115 net::HttpStreamFactory::EnableNpnSpdy3(); |
| 116 net::HttpNetworkLayer::ForceAlternateProtocol(); | 116 net::HttpNetworkLayer::ForceAlternateProtocol(); |
| 117 } else { | 117 } else { |
| 118 net::HttpStreamFactory::EnableNpnHttpOnly(); | 118 net::HttpStreamFactory::EnableNpnHttpOnly(); |
| 119 } | 119 } |
| 120 } | 120 } |
| 121 | 121 |
| 122 void ChromeNetBenchmarkingMessageFilter::OnCloseCurrentConnections() { | 122 void ChromeNetBenchmarkingMessageFilter::OnCloseCurrentConnections() { |
| 123 // This function is disabled unless the user has enabled | 123 // This function is disabled unless the user has enabled |
| 124 // benchmarking extensions. | 124 // benchmarking extensions. |
| 125 if (!CheckBenchmarkingEnabled()) { | 125 if (!CheckBenchmarkingEnabled()) { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 static bool checked = false; | 161 static bool checked = false; |
| 162 static bool result = false; | 162 static bool result = false; |
| 163 if (!checked) { | 163 if (!checked) { |
| 164 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 164 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 165 result = command_line.HasSwitch(switches::kEnableNetBenchmarking); | 165 result = command_line.HasSwitch(switches::kEnableNetBenchmarking); |
| 166 checked = true; | 166 checked = true; |
| 167 } | 167 } |
| 168 return result; | 168 return result; |
| 169 } | 169 } |
| 170 | 170 |
| OLD | NEW |