summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorpfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-14 12:17:16 +0000
committerpfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-14 12:17:16 +0000
commit2fd5a178fe8e1d5c87e8a598a579ed71388229df (patch)
tree8c674d34f355d564dc540ff663d16a4e140c5b5e /webkit
parent6e17bb92de55577af86410a1e9709df91ec9617b (diff)
downloadchromium_src-2fd5a178fe8e1d5c87e8a598a579ed71388229df.zip
chromium_src-2fd5a178fe8e1d5c87e8a598a579ed71388229df.tar.gz
chromium_src-2fd5a178fe8e1d5c87e8a598a579ed71388229df.tar.bz2
DevTools: provide network log details to the WebCore's InspectorController.
Review URL: http://codereview.chromium.org/2645006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@52310 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/glue/resource_loader_bridge.cc19
-rw-r--r--webkit/glue/resource_loader_bridge.h66
-rw-r--r--webkit/glue/weburlloader_impl.cc23
3 files changed, 108 insertions, 0 deletions
diff --git a/webkit/glue/resource_loader_bridge.cc b/webkit/glue/resource_loader_bridge.cc
index af77ade..cee2b6e 100644
--- a/webkit/glue/resource_loader_bridge.cc
+++ b/webkit/glue/resource_loader_bridge.cc
@@ -21,11 +21,30 @@ ResourceLoaderBridge::RequestInfo::RequestInfo()
ResourceLoaderBridge::RequestInfo::~RequestInfo() {
}
+ResourceLoaderBridge::LoadTimingInfo::LoadTimingInfo() {
+ proxy_start = -1;
+ proxy_end = -1;
+ dns_start = -1;
+ dns_end = -1;
+ connect_start = -1;
+ connect_end = -1;
+ ssl_start = -1;
+ ssl_end = -1;
+ send_start = 0;
+ send_end = 0;
+ receive_headers_start = 0;
+ receive_headers_end = 0;
+}
+
+ResourceLoaderBridge::LoadTimingInfo::~LoadTimingInfo() {
+}
+
ResourceLoaderBridge::ResponseInfo::ResponseInfo() {
content_length = -1;
appcache_id = appcache::kNoCacheId;
was_fetched_via_spdy = false;
was_npn_negotiated = false;
+ connection_id = 0;
was_alternate_protocol_available = false;
was_fetched_via_proxy = false;
}
diff --git a/webkit/glue/resource_loader_bridge.h b/webkit/glue/resource_loader_bridge.h
index ba88271..73bbe4d 100644
--- a/webkit/glue/resource_loader_bridge.h
+++ b/webkit/glue/resource_loader_bridge.h
@@ -86,6 +86,64 @@ class ResourceLoaderBridge {
int routing_id;
};
+ // Structure containing timing information for the request. It addresses
+ // http://groups.google.com/group/http-archive-specification/web/har-1-1-spec
+ // and http://dev.w3.org/2006/webapi/WebTiming/ needs.
+ //
+ // All the values for starts and ends are given in milliseconds and are
+ // offsets with respect to the given base time.
+ struct LoadTimingInfo {
+ LoadTimingInfo();
+ ~LoadTimingInfo();
+
+ // All the values in this struct are given as offsets in milliseconds wrt
+ // this base time.
+ base::Time base_time;
+
+ // The time that proxy processing started. For requests with no proxy phase,
+ // this time is -1.
+ int32 proxy_start;
+
+ // The time that proxy processing ended. For reused sockets this time
+ // is -1.
+ int32 proxy_end;
+
+ // The time that DNS lookup started. For reused sockets this time is -1.
+ int32 dns_start;
+
+ // The time that DNS lookup ended. For reused sockets this time is -1.
+ int32 dns_end;
+
+ // The time that establishing connection started. For reused sockets
+ // this time is -1. Connect time includes dns time.
+ int32 connect_start;
+
+ // The time that establishing connection ended. For reused sockets this
+ // time is -1. Connect time includes dns time.
+ int32 connect_end;
+
+ // The time at which SSL handshake started. For non-HTTPS requests this
+ // is 0.
+ int32 ssl_start;
+
+ // The time at which SSL handshake ended. For non-HTTPS requests this is 0.
+ int32 ssl_end;
+
+ // The time that HTTP request started. For non-HTTP requests this is 0.
+ int32 send_start;
+
+ // The time that HTTP request ended. For non-HTTP requests this is 0.
+ int32 send_end;
+
+ // The time at which receiving HTTP headers started. For non-HTTP requests
+ // this is 0.
+ int32 receive_headers_start;
+
+ // The time at which receiving HTTP headers ended. For non-HTTP requests
+ // this is 0.
+ int32 receive_headers_end;
+ };
+
struct ResponseInfo {
ResponseInfo();
~ResponseInfo();
@@ -122,6 +180,14 @@ class ResourceLoaderBridge {
// Note: this value is only populated for main resource requests.
GURL appcache_manifest_url;
+ // Connection identifier from the underlying network stack. In case there
+ // is no associated connection, contains 0.
+ uint32 connection_id;
+
+ // Detailed timing information used by the WebTiming, HAR and Developer
+ // Tools.
+ LoadTimingInfo load_timing;
+
// True if the response was delivered using SPDY.
bool was_fetched_via_spdy;
diff --git a/webkit/glue/weburlloader_impl.cc b/webkit/glue/weburlloader_impl.cc
index 3fb0206..bf776f6 100644
--- a/webkit/glue/weburlloader_impl.cc
+++ b/webkit/glue/weburlloader_impl.cc
@@ -20,6 +20,7 @@
#include "third_party/WebKit/WebKit/chromium/public/WebSecurityPolicy.h"
#include "third_party/WebKit/WebKit/chromium/public/WebURL.h"
#include "third_party/WebKit/WebKit/chromium/public/WebURLError.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebURLLoadTiming.h"
#include "third_party/WebKit/WebKit/chromium/public/WebURLLoaderClient.h"
#include "third_party/WebKit/WebKit/chromium/public/WebURLRequest.h"
#include "third_party/WebKit/WebKit/chromium/public/WebURLResponse.h"
@@ -38,6 +39,7 @@ using WebKit::WebSecurityPolicy;
using WebKit::WebString;
using WebKit::WebURL;
using WebKit::WebURLError;
+using WebKit::WebURLLoadTiming;
using WebKit::WebURLLoader;
using WebKit::WebURLLoaderClient;
using WebKit::WebURLRequest;
@@ -170,11 +172,30 @@ void PopulateURLResponse(
response->setSecurityInfo(info.security_info);
response->setAppCacheID(info.appcache_id);
response->setAppCacheManifestURL(info.appcache_manifest_url);
+ response->setWasCached(info.request_time > info.response_time);
response->setWasFetchedViaSPDY(info.was_fetched_via_spdy);
response->setWasNpnNegotiated(info.was_npn_negotiated);
response->setWasAlternateProtocolAvailable(
info.was_alternate_protocol_available);
response->setWasFetchedViaProxy(info.was_fetched_via_proxy);
+ response->setConnectionID(info.connection_id);
+
+ WebURLLoadTiming timing;
+ timing.initialize();
+ const ResourceLoaderBridge::LoadTimingInfo& timing_info = info.load_timing;
+ timing.setRequestTime(timing_info.base_time.ToDoubleT());
+ timing.setProxyStart(timing_info.proxy_start);
+ timing.setProxyEnd(timing_info.proxy_end);
+ timing.setDNSStart(timing_info.dns_start);
+ timing.setDNSEnd(timing_info.dns_end);
+ timing.setConnectStart(timing_info.connect_start);
+ timing.setConnectEnd(timing_info.connect_end);
+ timing.setSSLStart(timing_info.ssl_start);
+ timing.setSSLEnd(timing_info.ssl_end);
+ timing.setSendStart(timing_info.send_start);
+ timing.setSendEnd(timing_info.send_end);
+ timing.setReceiveHeadersEnd(timing_info.receive_headers_end);
+ response->setLoadTiming(timing);
const net::HttpResponseHeaders* headers = info.headers;
if (!headers)
@@ -331,6 +352,8 @@ void WebURLLoaderImpl::Context::Start(
if (request.reportUploadProgress())
load_flags |= net::LOAD_ENABLE_UPLOAD_PROGRESS;
+ if (request.reportLoadTiming())
+ load_flags |= net::LOAD_ENABLE_LOAD_TIMING;
if (!request.allowCookies() || !request.allowStoredCredentials()) {
load_flags |= net::LOAD_DO_NOT_SAVE_COOKIES;