diff options
author | ahendrickson@chromium.org <ahendrickson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-20 19:41:58 +0000 |
---|---|---|
committer | ahendrickson@chromium.org <ahendrickson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-20 19:41:58 +0000 |
commit | dc8b223f8c602c2acfdf41c228706fd7bf768de7 (patch) | |
tree | 60d7cb92c8a74135539d543b94548d2ef17a3b26 | |
parent | 9d64903037b85944ba90241a77875d1df68ee7fb (diff) | |
download | chromium_src-dc8b223f8c602c2acfdf41c228706fd7bf768de7.zip chromium_src-dc8b223f8c602c2acfdf41c228706fd7bf768de7.tar.gz chromium_src-dc8b223f8c602c2acfdf41c228706fd7bf768de7.tar.bz2 |
Lazy initialization of URLSecurityManager to reduce start-up time.
This addresses XP perf bot regressions:
http://build.chromium.org/buildbot/perf/xp-release-dual-core/startup/report.html?history=50&rev=44850&graph=warm
http://build.chromium.org/buildbot/perf/xp-release-single-core/startup/report.html?history=80&rev=44930&graph=warm
Had to remove const-ness from URLSecurityManager pointers.
BUG=None.
TEST=None.
Review URL: http://codereview.chromium.org/2110016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@47831 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | net/http/http_auth_handler_factory.cc | 2 | ||||
-rw-r--r-- | net/http/http_auth_handler_factory.h | 9 | ||||
-rw-r--r-- | net/http/http_auth_handler_negotiate.h | 7 | ||||
-rw-r--r-- | net/http/http_auth_handler_negotiate_posix.cc | 2 | ||||
-rw-r--r-- | net/http/http_auth_handler_negotiate_win.cc | 2 | ||||
-rw-r--r-- | net/http/http_auth_handler_ntlm.h | 4 | ||||
-rw-r--r-- | net/http/http_auth_handler_ntlm_win.cc | 2 | ||||
-rw-r--r-- | net/http/url_security_manager.cc | 2 | ||||
-rw-r--r-- | net/http/url_security_manager.h | 4 | ||||
-rw-r--r-- | net/http/url_security_manager_win.cc | 17 |
10 files changed, 25 insertions, 26 deletions
diff --git a/net/http/http_auth_handler_factory.cc b/net/http/http_auth_handler_factory.cc index 6c09def..7bb241f 100644 --- a/net/http/http_auth_handler_factory.cc +++ b/net/http/http_auth_handler_factory.cc @@ -61,7 +61,7 @@ HttpAuthHandlerRegistryFactory::~HttpAuthHandlerRegistryFactory() { void HttpAuthHandlerRegistryFactory::SetURLSecurityManager( const std::string& scheme, - const URLSecurityManager* security_manager) { + URLSecurityManager* security_manager) { HttpAuthHandlerFactory* factory = GetSchemeFactory(scheme); if (factory) factory->set_url_security_manager(security_manager); diff --git a/net/http/http_auth_handler_factory.h b/net/http/http_auth_handler_factory.h index 96213db..b3a1b8e 100644 --- a/net/http/http_auth_handler_factory.h +++ b/net/http/http_auth_handler_factory.h @@ -27,13 +27,12 @@ class HttpAuthHandlerFactory { // Sets an URL security manager. HttpAuthHandlerFactory doesn't own the URL
// security manager, and the URL security manager should outlive this object. - void set_url_security_manager( - const URLSecurityManager* url_security_manager) { + void set_url_security_manager(URLSecurityManager* url_security_manager) { url_security_manager_ = url_security_manager; } // Retrieves the associated URL security manager. - const URLSecurityManager* url_security_manager() const { + URLSecurityManager* url_security_manager() { return url_security_manager_; } @@ -104,7 +103,7 @@ class HttpAuthHandlerFactory { private: // The URL security manager - const URLSecurityManager* url_security_manager_; + URLSecurityManager* url_security_manager_; DISALLOW_COPY_AND_ASSIGN(HttpAuthHandlerFactory); }; @@ -118,7 +117,7 @@ class HttpAuthHandlerRegistryFactory : public HttpAuthHandlerFactory { // Sets an URL security manager into the factory associated with |scheme|. void SetURLSecurityManager(const std::string& scheme, - const URLSecurityManager* url_security_manager); + URLSecurityManager* url_security_manager); // Registers a |factory| that will be used for a particular HTTP // authentication scheme such as Basic, Digest, or Negotiate. diff --git a/net/http/http_auth_handler_negotiate.h b/net/http/http_auth_handler_negotiate.h index 4e993f4..a9af8d4 100644 --- a/net/http/http_auth_handler_negotiate.h +++ b/net/http/http_auth_handler_negotiate.h @@ -81,11 +81,10 @@ class HttpAuthHandlerNegotiate : public HttpAuthHandler { #if defined(OS_WIN) HttpAuthHandlerNegotiate(SSPILibrary* sspi_library, ULONG max_token_length, - const URLSecurityManager* url_security_manager, + URLSecurityManager* url_security_manager, bool disable_cname_lookup, bool use_port); #else - explicit HttpAuthHandlerNegotiate( - const URLSecurityManager* url_security_manager); + explicit HttpAuthHandlerNegotiate(URLSecurityManager* url_security_manager); #endif virtual bool NeedsIdentity(); @@ -134,7 +133,7 @@ class HttpAuthHandlerNegotiate : public HttpAuthHandler { std::wstring spn_; #endif - const URLSecurityManager* url_security_manager_; + URLSecurityManager* url_security_manager_; }; } // namespace net diff --git a/net/http/http_auth_handler_negotiate_posix.cc b/net/http/http_auth_handler_negotiate_posix.cc index c4d2a0f..270ee5b 100644 --- a/net/http/http_auth_handler_negotiate_posix.cc +++ b/net/http/http_auth_handler_negotiate_posix.cc @@ -16,7 +16,7 @@ namespace net { // Negotiate without requiring conditional compilation. HttpAuthHandlerNegotiate::HttpAuthHandlerNegotiate( - const URLSecurityManager* url_security_manager) + URLSecurityManager* url_security_manager) : url_security_manager_(url_security_manager) { } diff --git a/net/http/http_auth_handler_negotiate_win.cc b/net/http/http_auth_handler_negotiate_win.cc index b2a3569..46266e2 100644 --- a/net/http/http_auth_handler_negotiate_win.cc +++ b/net/http/http_auth_handler_negotiate_win.cc @@ -16,7 +16,7 @@ namespace net { HttpAuthHandlerNegotiate::HttpAuthHandlerNegotiate( SSPILibrary* library, ULONG max_token_length, - const URLSecurityManager* url_security_manager, + URLSecurityManager* url_security_manager, bool disable_cname_lookup, bool use_port) : auth_sspi_(library, "Negotiate", NEGOSSP_NAME, max_token_length), diff --git a/net/http/http_auth_handler_ntlm.h b/net/http/http_auth_handler_ntlm.h index e778592..5892191 100644 --- a/net/http/http_auth_handler_ntlm.h +++ b/net/http/http_auth_handler_ntlm.h @@ -101,7 +101,7 @@ class HttpAuthHandlerNTLM : public HttpAuthHandler { #endif #if defined(NTLM_SSPI) HttpAuthHandlerNTLM(SSPILibrary* sspi_library, ULONG max_token_length, - const URLSecurityManager* url_security_manager); + URLSecurityManager* url_security_manager); #endif virtual bool NeedsIdentity(); @@ -171,7 +171,7 @@ class HttpAuthHandlerNTLM : public HttpAuthHandler { std::string auth_data_; #if defined(NTLM_SSPI) - const URLSecurityManager* url_security_manager_; + URLSecurityManager* url_security_manager_; #endif }; diff --git a/net/http/http_auth_handler_ntlm_win.cc b/net/http/http_auth_handler_ntlm_win.cc index c54520e..45d88de 100644 --- a/net/http/http_auth_handler_ntlm_win.cc +++ b/net/http/http_auth_handler_ntlm_win.cc @@ -22,7 +22,7 @@ namespace net { HttpAuthHandlerNTLM::HttpAuthHandlerNTLM( SSPILibrary* sspi_library, ULONG max_token_length, - const URLSecurityManager* url_security_manager) + URLSecurityManager* url_security_manager) : auth_sspi_(sspi_library, "NTLM", NTLMSP_NAME, max_token_length), url_security_manager_(url_security_manager) { } diff --git a/net/http/url_security_manager.cc b/net/http/url_security_manager.cc index 78ccdf4..d3bc42e 100644 --- a/net/http/url_security_manager.cc +++ b/net/http/url_security_manager.cc @@ -13,7 +13,7 @@ URLSecurityManagerWhitelist::URLSecurityManagerWhitelist( } bool URLSecurityManagerWhitelist::CanUseDefaultCredentials( - const GURL& auth_origin) const { + const GURL& auth_origin) { if (whitelist_.get()) return whitelist_->IsValid(auth_origin, HttpAuth::AUTH_SERVER); return false; diff --git a/net/http/url_security_manager.h b/net/http/url_security_manager.h index 70cfcfa..5f68e3a 100644 --- a/net/http/url_security_manager.h +++ b/net/http/url_security_manager.h @@ -27,7 +27,7 @@ class URLSecurityManager { // Returns true if we can send the default credentials to the server at // |auth_origin| for HTTP NTLM or Negotiate authentication. - virtual bool CanUseDefaultCredentials(const GURL& auth_origin) const = 0; + virtual bool CanUseDefaultCredentials(const GURL& auth_origin) = 0; private: DISALLOW_COPY_AND_ASSIGN(URLSecurityManager); @@ -39,7 +39,7 @@ class URLSecurityManagerWhitelist : public URLSecurityManager { explicit URLSecurityManagerWhitelist(HttpAuthFilter* whitelist); // URLSecurityManager methods. - virtual bool CanUseDefaultCredentials(const GURL& auth_origin) const; + virtual bool CanUseDefaultCredentials(const GURL& auth_origin); private: scoped_ptr<HttpAuthFilter> whitelist_; diff --git a/net/http/url_security_manager_win.cc b/net/http/url_security_manager_win.cc index b563b35..4eaef78 100644 --- a/net/http/url_security_manager_win.cc +++ b/net/http/url_security_manager_win.cc @@ -29,7 +29,7 @@ class URLSecurityManagerWin : public URLSecurityManager { URLSecurityManagerWin(); // URLSecurityManager methods: - virtual bool CanUseDefaultCredentials(const GURL& auth_origin) const; + virtual bool CanUseDefaultCredentials(const GURL& auth_origin); private: ScopedComPtr<IInternetSecurityManager> security_manager_; @@ -38,18 +38,19 @@ class URLSecurityManagerWin : public URLSecurityManager { }; URLSecurityManagerWin::URLSecurityManagerWin() { - HRESULT hr = CoInternetCreateSecurityManager(NULL, - security_manager_.Receive(), - NULL); - DCHECK(SUCCEEDED(hr)); } bool URLSecurityManagerWin::CanUseDefaultCredentials( - const GURL& auth_origin) const { + const GURL& auth_origin) { if (!security_manager_) { - NOTREACHED(); // The code in the constructor failed. - return false; + HRESULT hr = CoInternetCreateSecurityManager(NULL, + security_manager_.Receive(), + NULL); + if (FAILED(hr) || !security_manager_) { + LOG(ERROR) << "Unable to create the Windows Security Manager instance"; + return false; + } } std::wstring url_w = ASCIIToWide(auth_origin.spec()); |