diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-15 19:22:24 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-15 19:22:24 +0000 |
commit | 8e1845e1bc61b92e39f21da353fbec0b708e7194 (patch) | |
tree | 03812a0c2da378f45f805c9a436e4adb1d0ad793 /net | |
parent | 7a147fb74d7657f42378947a31d24d197d2345db (diff) | |
download | chromium_src-8e1845e1bc61b92e39f21da353fbec0b708e7194.zip chromium_src-8e1845e1bc61b92e39f21da353fbec0b708e7194.tar.gz chromium_src-8e1845e1bc61b92e39f21da353fbec0b708e7194.tar.bz2 |
FBTF: Move code from .h to .cc in net/
Shaves a cumulative 400k off libnet/browser.a
BUG=none
TEST=compiles
Review URL: http://codereview.chromium.org/3432004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59533 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r-- | net/base/address_list.cc | 34 | ||||
-rw-r--r-- | net/base/address_list.h | 23 | ||||
-rw-r--r-- | net/proxy/mock_proxy_resolver.h | 1 | ||||
-rw-r--r-- | net/proxy/proxy_config.cc | 26 | ||||
-rw-r--r-- | net/proxy/proxy_config.h | 6 | ||||
-rw-r--r-- | net/proxy/proxy_config_service_linux.cc | 7 | ||||
-rw-r--r-- | net/proxy/proxy_config_service_linux.h | 6 | ||||
-rw-r--r-- | net/proxy/proxy_info.cc | 18 | ||||
-rw-r--r-- | net/proxy/proxy_info.h | 13 |
9 files changed, 105 insertions, 29 deletions
diff --git a/net/base/address_list.cc b/net/base/address_list.cc index 75c30b8..ea1ee1e 100644 --- a/net/base/address_list.cc +++ b/net/base/address_list.cc @@ -85,6 +85,34 @@ void SetPortRecursive(struct addrinfo* info, int port) { } // namespace +struct AddressList::Data : public base::RefCountedThreadSafe<Data> { + Data(struct addrinfo* ai, bool is_system_created); + struct addrinfo* head; + + // Indicates which free function to use for |head|. + bool is_system_created; + + private: + friend class base::RefCountedThreadSafe<Data>; + + ~Data(); +}; + +AddressList::AddressList() { +} + +AddressList::AddressList(const AddressList& addresslist) + : data_(addresslist.data_) { +} + +AddressList::~AddressList() { +} + +AddressList& AddressList::operator=(const AddressList& addresslist) { + data_ = addresslist.data_; + return *this; +} + AddressList::AddressList(const IPAddressNumber& address, int port, bool canonicalize_name) { struct addrinfo* ai = new addrinfo; @@ -190,6 +218,12 @@ void AddressList::Reset() { data_ = NULL; } +const struct addrinfo* AddressList::head() const { + return data_->head; +} + +AddressList::AddressList(Data* data) : data_(data) {} + AddressList::Data::Data(struct addrinfo* ai, bool is_system_created) : head(ai), is_system_created(is_system_created) { DCHECK(head); diff --git a/net/base/address_list.h b/net/base/address_list.h index c333f86..9406a8c 100644 --- a/net/base/address_list.h +++ b/net/base/address_list.h @@ -20,13 +20,17 @@ namespace net { class AddressList { public: // Constructs an empty address list. - AddressList() {} + AddressList(); // Constructs an address list for a single IP literal. If // |canonicalize_name| is true, fill the ai_canonname field with the // canonicalized IP address. AddressList(const IPAddressNumber& address, int port, bool canonicalize_name); + AddressList(const AddressList& addresslist); + ~AddressList(); + AddressList& operator=(const AddressList& addresslist); + // Adopt the given addrinfo list (assumed to have been created by // the system, e.g. returned by getaddrinfo()) in place of the // existing one if any. This hands over responsibility for freeing @@ -68,23 +72,12 @@ class AddressList { void Reset(); // Get access to the head of the addrinfo list. - const struct addrinfo* head() const { return data_->head; } + const struct addrinfo* head() const; private: - struct Data : public base::RefCountedThreadSafe<Data> { - Data(struct addrinfo* ai, bool is_system_created); - struct addrinfo* head; - - // Indicates which free function to use for |head|. - bool is_system_created; - - private: - friend class base::RefCountedThreadSafe<Data>; - - ~Data(); - }; + struct Data; - explicit AddressList(Data* data) : data_(data) {} + explicit AddressList(Data* data); scoped_refptr<Data> data_; }; diff --git a/net/proxy/mock_proxy_resolver.h b/net/proxy/mock_proxy_resolver.h index 8932558..880612b 100644 --- a/net/proxy/mock_proxy_resolver.h +++ b/net/proxy/mock_proxy_resolver.h @@ -9,6 +9,7 @@ #include <vector> #include "base/logging.h" +#include "base/scoped_ptr.h" #include "base/message_loop.h" #include "googleurl/src/gurl.h" #include "net/base/net_errors.h" diff --git a/net/proxy/proxy_config.cc b/net/proxy/proxy_config.cc index 1337ec9e..ce14358 100644 --- a/net/proxy/proxy_config.cc +++ b/net/proxy/proxy_config.cc @@ -24,6 +24,14 @@ void AddProxyToValue(const char* name, } // namespace +ProxyConfig::ProxyRules::ProxyRules() + : reverse_bypass(false), + type(TYPE_NO_RULES) { +} + +ProxyConfig::ProxyRules::~ProxyRules() { +} + bool ProxyConfig::ProxyRules::Equals(const ProxyRules& other) const { return type == other.type && single_proxy == other.single_proxy && @@ -153,6 +161,24 @@ ProxyServer* ProxyConfig::ProxyRules::MapUrlSchemeToProxyNoFallback( ProxyConfig::ProxyConfig() : auto_detect_(false), id_(INVALID_ID) { } +ProxyConfig::ProxyConfig(const ProxyConfig& config) + : auto_detect_(config.auto_detect_), + pac_url_(config.pac_url_), + proxy_rules_(config.proxy_rules_), + id_(config.id_) { +} + +ProxyConfig::~ProxyConfig() { +} + +ProxyConfig& ProxyConfig::operator=(const ProxyConfig& config) { + auto_detect_ = config.auto_detect_; + pac_url_ = config.pac_url_; + proxy_rules_ = config.proxy_rules_; + id_ = config.id_; + return *this; +} + bool ProxyConfig::Equals(const ProxyConfig& other) const { // The two configs can have different IDs. We are just interested in if they // have the same settings. diff --git a/net/proxy/proxy_config.h b/net/proxy/proxy_config.h index 56a58ba..9012a31 100644 --- a/net/proxy/proxy_config.h +++ b/net/proxy/proxy_config.h @@ -42,7 +42,8 @@ class ProxyConfig { // Note that the default of TYPE_NO_RULES results in direct connections // being made when using this ProxyConfig. - ProxyRules() : reverse_bypass(false), type(TYPE_NO_RULES) {} + ProxyRules(); + ~ProxyRules(); bool empty() const { return type == TYPE_NO_RULES; @@ -109,6 +110,9 @@ class ProxyConfig { enum { INVALID_ID = 0 }; ProxyConfig(); + ProxyConfig(const ProxyConfig& config); + ~ProxyConfig(); + ProxyConfig& operator=(const ProxyConfig& config); // Used to numerically identify this configuration. ID id() const { return id_; } diff --git a/net/proxy/proxy_config_service_linux.cc b/net/proxy/proxy_config_service_linux.cc index 669ea79..1cf9e3d 100644 --- a/net/proxy/proxy_config_service_linux.cc +++ b/net/proxy/proxy_config_service_linux.cc @@ -79,6 +79,9 @@ std::string FixupProxyHostScheme(ProxyServer::Scheme scheme, } // namespace +ProxyConfigServiceLinux::Delegate::~Delegate() { +} + bool ProxyConfigServiceLinux::Delegate::GetProxyFromEnvVarForScheme( const char* variable, ProxyServer::Scheme scheme, ProxyServer* result_server) { @@ -1227,6 +1230,10 @@ ProxyConfigServiceLinux::ProxyConfigServiceLinux() : delegate_(new Delegate(base::Environment::Create())) { } +ProxyConfigServiceLinux::~ProxyConfigServiceLinux() { + delegate_->PostDestroyTask(); +} + ProxyConfigServiceLinux::ProxyConfigServiceLinux( base::Environment* env_var_getter) : delegate_(new Delegate(env_var_getter)) { diff --git a/net/proxy/proxy_config_service_linux.h b/net/proxy/proxy_config_service_linux.h index f3082fb..90acbf4 100644 --- a/net/proxy/proxy_config_service_linux.h +++ b/net/proxy/proxy_config_service_linux.h @@ -155,7 +155,7 @@ class ProxyConfigServiceLinux : public ProxyConfigService { private: friend class base::RefCountedThreadSafe<Delegate>; - ~Delegate() {} + ~Delegate(); // Obtains an environment variable's value. Parses a proxy server // specification from it and puts it in result. Returns true if the @@ -223,9 +223,7 @@ class ProxyConfigServiceLinux : public ProxyConfigService { ProxyConfigServiceLinux(base::Environment* env_var_getter, GConfSettingGetter* gconf_getter); - virtual ~ProxyConfigServiceLinux() { - delegate_->PostDestroyTask(); - } + virtual ~ProxyConfigServiceLinux(); void SetupAndFetchInitialConfig(MessageLoop* glib_default_loop, MessageLoop* io_loop, diff --git a/net/proxy/proxy_info.cc b/net/proxy/proxy_info.cc index 796d3417..ebefa84 100644 --- a/net/proxy/proxy_info.cc +++ b/net/proxy/proxy_info.cc @@ -4,11 +4,16 @@ #include "net/proxy/proxy_info.h" +#include "net/proxy/proxy_retry_info.h" + namespace net { ProxyInfo::ProxyInfo() : config_id_(ProxyConfig::INVALID_ID) { } +ProxyInfo::~ProxyInfo() { +} + void ProxyInfo::Use(const ProxyInfo& other) { proxy_list_ = other.proxy_list_; } @@ -29,4 +34,17 @@ std::string ProxyInfo::ToPacString() const { return proxy_list_.ToPacString(); } +bool ProxyInfo::Fallback(ProxyRetryInfoMap* proxy_retry_info) { + return proxy_list_.Fallback(proxy_retry_info); +} + +void ProxyInfo::DeprioritizeBadProxies( + const ProxyRetryInfoMap& proxy_retry_info) { + proxy_list_.DeprioritizeBadProxies(proxy_retry_info); +} + +void ProxyInfo::RemoveProxiesWithoutScheme(int scheme_bit_field) { + proxy_list_.RemoveProxiesWithoutScheme(scheme_bit_field); +} + } // namespace net diff --git a/net/proxy/proxy_info.h b/net/proxy/proxy_info.h index d6a891f..1194752 100644 --- a/net/proxy/proxy_info.h +++ b/net/proxy/proxy_info.h @@ -19,6 +19,7 @@ namespace net { class ProxyInfo { public: ProxyInfo(); + ~ProxyInfo(); // Default copy-constructor and assignment operator are OK! // Uses the same proxy server as the given |proxy_info|. @@ -84,20 +85,14 @@ class ProxyInfo { // Marks the current proxy as bad. Returns true if there is another proxy // available to try in proxy list_. - bool Fallback(ProxyRetryInfoMap* proxy_retry_info) { - return proxy_list_.Fallback(proxy_retry_info); - } + bool Fallback(ProxyRetryInfoMap* proxy_retry_info); // De-prioritizes the proxies that we have cached as not working, by moving // them to the end of the proxy list. - void DeprioritizeBadProxies(const ProxyRetryInfoMap& proxy_retry_info) { - proxy_list_.DeprioritizeBadProxies(proxy_retry_info); - } + void DeprioritizeBadProxies(const ProxyRetryInfoMap& proxy_retry_info); // Deletes any entry which doesn't have one of the specified proxy schemes. - void RemoveProxiesWithoutScheme(int scheme_bit_field) { - proxy_list_.RemoveProxiesWithoutScheme(scheme_bit_field); - } + void RemoveProxiesWithoutScheme(int scheme_bit_field); private: friend class ProxyService; |