summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorEbrahem Qassem <ekassem@codeaurora.org>2011-11-20 14:57:09 +0200
committerSteve Kondik <shade@chemlab.org>2012-09-11 13:20:30 -0700
commit5fbe95affc8eeed93c678b1d271f64dcc4dd919b (patch)
tree053d8358e76befa6fd95e7cef8319045e534167f /chrome
parenta75b259c30d54752a0d42804631bcf309b381f90 (diff)
downloadexternal_chromium-5fbe95affc8eeed93c678b1d271f64dcc4dd919b.zip
external_chromium-5fbe95affc8eeed93c678b1d271f64dcc4dd919b.tar.gz
external_chromium-5fbe95affc8eeed93c678b1d271f64dcc4dd919b.tar.bz2
net: networking optimizations
features: - early connection - memory cache - caching of redirection - request queue priority - closing unused sockets - SHUTR - fin aggregation - object prefetch - dns host name prioritization Change-Id: Ief90b8206ba48115eaeb12d554424d65f36427ac
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/net/preconnect.cc36
-rw-r--r--chrome/browser/net/preconnect.h12
2 files changed, 7 insertions, 41 deletions
diff --git a/chrome/browser/net/preconnect.cc b/chrome/browser/net/preconnect.cc
index b5fd87b..e6c1fd4 100644
--- a/chrome/browser/net/preconnect.cc
+++ b/chrome/browser/net/preconnect.cc
@@ -1,4 +1,5 @@
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011, 2012 Code Aurora Forum. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -32,12 +33,11 @@ void PreconnectOnUIThread(
return;
}
-
void PreconnectOnIOThread(
const GURL& url,
UrlInfo::ResolutionMotivation motivation,
int count) {
- net::URLRequestContextGetter* getter = Profile::GetDefaultRequestContext();
+ URLRequestContextGetter* getter = Profile::GetDefaultRequestContext();
if (!getter)
return;
if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) {
@@ -53,26 +53,9 @@ void PreconnectOnIOThread(
net::HttpTransactionFactory* factory = context->http_transaction_factory();
net::HttpNetworkSession* session = factory->GetSession();
- net::HttpRequestInfo request_info;
- request_info.url = url;
- request_info.method = "GET";
- request_info.extra_headers.SetHeader(net::HttpRequestHeaders::kUserAgent,
- context->GetUserAgent(url));
- // It almost doesn't matter whether we use net::LOWEST or net::HIGHEST
- // priority here, as we won't make a request, and will surrender the created
- // socket to the pool as soon as we can. However, we would like to mark the
- // speculative socket as such, and IF we use a net::LOWEST priority, and if
- // a navigation asked for a socket (after us) then it would get our socket,
- // and we'd get its later-arriving socket, which might make us record that
- // the speculation didn't help :-/. By using net::HIGHEST, we ensure that
- // a socket is given to us if "we asked first" and this allows us to mark it
- // as speculative, and better detect stats (if it gets used).
- // TODO(jar): histogram to see how often we accidentally use a previously-
- // unused socket, when a previously used socket was available.
- request_info.priority = net::HIGHEST;
-
// Translate the motivation from UrlRequest motivations to HttpRequest
// motivations.
+ net::HttpRequestInfo::RequestMotivation motivation_;
switch (motivation) {
case UrlInfo::OMNIBOX_MOTIVATED:
request_info.motivation = net::HttpRequestInfo::OMNIBOX_MOTIVATED;
@@ -90,18 +73,7 @@ void PreconnectOnIOThread(
break;
}
- // Setup the SSL Configuration.
- net::SSLConfig ssl_config;
- session->ssl_config_service()->GetSSLConfig(&ssl_config);
- if (session->http_stream_factory()->next_protos())
- ssl_config.next_protos = *session->http_stream_factory()->next_protos();
-
- // All preconnects should perform EV certificate verification.
- ssl_config.verify_ev_cert = true;
-
- net::HttpStreamFactory* http_stream_factory = session->http_stream_factory();
- http_stream_factory->PreconnectStreams(
- count, request_info, ssl_config, net::BoundNetLog());
+ net::Preconnect::DoPreconnect(session, url, count, motivation_);
}
} // namespace chrome_browser_net
diff --git a/chrome/browser/net/preconnect.h b/chrome/browser/net/preconnect.h
index 056d5d6..0d7ed21 100644
--- a/chrome/browser/net/preconnect.h
+++ b/chrome/browser/net/preconnect.h
@@ -1,23 +1,18 @@
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011, Code Aurora Forum. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// A Preconnect instance maintains state while a TCP/IP connection is made, and
-// and then released into the pool of available connections for future use.
-
#ifndef CHROME_BROWSER_NET_PRECONNECT_H_
#define CHROME_BROWSER_NET_PRECONNECT_H_
#pragma once
-#include "chrome/browser/net/url_info.h"
+#include "net/http/preconnect.h"
-class GURL;
+#include "chrome/browser/net/url_info.h"
namespace chrome_browser_net {
-// Try to preconnect. Typically motivated by OMNIBOX to reach search service.
-// |count| may be used to request more than one connection be established in
-// parallel.
void PreconnectOnUIThread(const GURL& url,
UrlInfo::ResolutionMotivation motivation,
int count);
@@ -28,7 +23,6 @@ void PreconnectOnUIThread(const GURL& url,
void PreconnectOnIOThread(const GURL& url,
UrlInfo::ResolutionMotivation motivation,
int count);
-
} // namespace chrome_browser_net
#endif // CHROME_BROWSER_NET_PRECONNECT_H_