From 7adaccba309723e23cf444e4d64b5d5a761591e3 Mon Sep 17 00:00:00 2001 From: "mbelshe@google.com" Date: Tue, 13 Oct 2009 04:43:21 +0000 Subject: Add a command line switch to enable flip sockets. With this change, flip code is now compiled and the limited unit tests actually run. BUG=none TEST=none Review URL: http://codereview.chromium.org/259064 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28793 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/browser_init.cc | 5 +++++ chrome/common/chrome_switches.cc | 4 ++++ chrome/common/chrome_switches.h | 2 ++ net/http/http_network_layer.cc | 12 +++++++++++- net/http/http_network_layer.h | 4 ++++ net/net.gyp | 16 ++++++++++++++++ 6 files changed, 42 insertions(+), 1 deletion(-) diff --git a/chrome/browser/browser_init.cc b/chrome/browser/browser_init.cc index 7f17dd47..eba5517 100644 --- a/chrome/browser/browser_init.cc +++ b/chrome/browser/browser_init.cc @@ -55,6 +55,7 @@ #include "grit/generated_resources.h" #include "grit/locale_settings.h" #include "grit/theme_resources.h" +#include "net/http/http_network_layer.h" #include "net/base/net_util.h" #include "net/url_request/url_request.h" #include "webkit/glue/webkit_glue.h" @@ -808,6 +809,10 @@ bool BrowserInit::ProcessCmdLineImpl(const CommandLine& command_line, profile, expected_tabs); } + if (command_line.HasSwitch(switches::kUseFlip)) { + net::HttpNetworkLayer::EnableFlip(true); + } + if (command_line.HasSwitch(switches::kExplicitlyAllowedPorts)) { std::wstring allowed_ports = command_line.GetSwitchValue(switches::kExplicitlyAllowedPorts); diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc index 6d3fb14..bb11493 100644 --- a/chrome/common/chrome_switches.cc +++ b/chrome/common/chrome_switches.cc @@ -550,6 +550,10 @@ const char kEnableMonitorProfile[] = "enable-monitor-profile"; // Disable WebKit's XSSAuditor. The XSSAuditor mitigates reflective XSS. const char kDisableXSSAuditor[] = "disable-xss-auditor"; +// Use Flip for the transport protocol instead of HTTP. +// This is a temporary testing flag. +const wchar_t kUseFlip[] = L"use-flip"; + #if defined(OS_POSIX) // A flag, generated internally by Chrome for renderer and other helper process // command lines on Linux and Mac. It tells the helper process to enable crash diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h index 8c9ed0b..48c9142 100644 --- a/chrome/common/chrome_switches.h +++ b/chrome/common/chrome_switches.h @@ -207,6 +207,8 @@ extern const char kEnableMonitorProfile[]; extern const char kDisableXSSAuditor[]; +extern const wchar_t kUseFlip[]; + #if defined(OS_POSIX) extern const char kEnableCrashReporter[]; #endif diff --git a/net/http/http_network_layer.cc b/net/http/http_network_layer.cc index 7097cd9..b8ac600 100644 --- a/net/http/http_network_layer.cc +++ b/net/http/http_network_layer.cc @@ -5,6 +5,7 @@ #include "net/http/http_network_layer.h" #include "base/logging.h" +#include "net/flip/flip_network_transaction.h" #include "net/http/http_network_session.h" #include "net/http/http_network_transaction.h" #include "net/socket/client_socket_factory.h" @@ -33,6 +34,7 @@ HttpTransactionFactory* HttpNetworkLayer::CreateFactory( } //----------------------------------------------------------------------------- +bool HttpNetworkLayer::enable_flip_ = false; HttpNetworkLayer::HttpNetworkLayer(ClientSocketFactory* socket_factory, HostResolver* host_resolver, @@ -63,7 +65,10 @@ int HttpNetworkLayer::CreateTransaction(scoped_ptr* trans) { if (suspended_) return ERR_NETWORK_IO_SUSPENDED; - trans->reset(new HttpNetworkTransaction(GetSession())); + if (enable_flip_) + trans->reset(new FlipNetworkTransaction(GetSession())); + else + trans->reset(new HttpNetworkTransaction(GetSession())); return OK; } @@ -91,4 +96,9 @@ HttpNetworkSession* HttpNetworkLayer::GetSession() { return session_; } +// static +void HttpNetworkLayer::EnableFlip(bool enable) { + enable_flip_ = enable; +} + } // namespace net diff --git a/net/http/http_network_layer.h b/net/http/http_network_layer.h index 7defb4e..7344c7b 100644 --- a/net/http/http_network_layer.h +++ b/net/http/http_network_layer.h @@ -50,6 +50,9 @@ class HttpNetworkLayer : public HttpTransactionFactory { virtual HttpNetworkSession* GetSession(); virtual void Suspend(bool suspend); + // Enable the flip protocol. Default is false. + static void EnableFlip(bool enable); + private: // The factory we will use to create network sockets. ClientSocketFactory* socket_factory_; @@ -64,6 +67,7 @@ class HttpNetworkLayer : public HttpTransactionFactory { scoped_refptr session_; bool suspended_; + static bool enable_flip_; }; } // namespace net diff --git a/net/net.gyp b/net/net.gyp index 9c7ecdc..ed1b851 100644 --- a/net/net.gyp +++ b/net/net.gyp @@ -192,6 +192,19 @@ 'disk_cache/storage_block.h', 'disk_cache/trace.cc', 'disk_cache/trace.h', + 'flip/flip_bitmasks.h', + 'flip/flip_frame_builder.cc', + 'flip/flip_frame_builder.h', + 'flip/flip_framer.cc', + 'flip/flip_framer.h', + 'flip/flip_network_transaction.cc', + 'flip/flip_network_transaction.h', + 'flip/flip_protocol.h', + 'flip/flip_session.cc', + 'flip/flip_session.h', + 'flip/flip_session_pool.cc', + 'flip/flip_session_pool.h', + 'flip/flip_transaction_factory.h', 'ftp/ftp_auth_cache.cc', 'ftp/ftp_auth_cache.h', 'ftp/ftp_ctrl_response_buffer.cc', @@ -497,6 +510,9 @@ 'ftp/ftp_network_transaction_unittest.cc', 'ftp/ftp_util_unittest.cc', 'http/des_unittest.cc', + 'flip/flip_framer_test.cc', + 'flip/flip_network_transaction_unittest.cc', + 'flip/flip_session_unittest.cc', 'http/http_auth_cache_unittest.cc', 'http/http_auth_handler_basic_unittest.cc', 'http/http_auth_handler_digest_unittest.cc', -- cgit v1.1