summaryrefslogtreecommitdiffstats
path: root/chrome/renderer
diff options
context:
space:
mode:
authormbelshe@google.com <mbelshe@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-11 21:34:46 +0000
committermbelshe@google.com <mbelshe@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-11 21:34:46 +0000
commit9fc38b3ac8e8c9cfad867a1177d5b295a7646b57 (patch)
treedb1f4d7ba7b87cf2f006f608448ba92ba596fe64 /chrome/renderer
parente1c16492b1113c01e7467eaa526a01db85bf6470 (diff)
downloadchromium_src-9fc38b3ac8e8c9cfad867a1177d5b295a7646b57.zip
chromium_src-9fc38b3ac8e8c9cfad867a1177d5b295a7646b57.tar.gz
chromium_src-9fc38b3ac8e8c9cfad867a1177d5b295a7646b57.tar.bz2
Enable JS detection of whether SPDY was used to load a web page.
Augments the loadTimes() API with a new field, "wasFetchedViaSpdy". BUG=31615 TEST=flip_network_transaction_unittest Review URL: http://codereview.chromium.org/518039 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35943 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r--chrome/renderer/loadtimes_extension_bindings.cc4
-rw-r--r--chrome/renderer/navigation_state.h9
2 files changed, 11 insertions, 2 deletions
diff --git a/chrome/renderer/loadtimes_extension_bindings.cc b/chrome/renderer/loadtimes_extension_bindings.cc
index 8688a56..33d46d7 100644
--- a/chrome/renderer/loadtimes_extension_bindings.cc
+++ b/chrome/renderer/loadtimes_extension_bindings.cc
@@ -128,7 +128,9 @@ class LoadTimesExtensionWrapper : public v8::Extension {
load_times->Set(
v8::String::New("navigationType"),
v8::String::New(GetNavigationType(data_source->navigationType())));
-
+ load_times->Set(
+ v8::String::New("wasFetchedViaSpdy"),
+ v8::Boolean::New(navigation_state->was_fetched_via_spdy()));
return load_times;
}
}
diff --git a/chrome/renderer/navigation_state.h b/chrome/renderer/navigation_state.h
index 90c1270..61f63ac 100644
--- a/chrome/renderer/navigation_state.h
+++ b/chrome/renderer/navigation_state.h
@@ -190,6 +190,10 @@ class NavigationState : public WebKit::WebDataSource::ExtraData {
return cache_policy_override_set_;
}
+ // Indicator if SPDY was used as part of this page load.
+ void set_was_fetched_via_spdy(bool value) { was_fetched_via_spdy_ = value; }
+ bool was_fetched_via_spdy() const { return was_fetched_via_spdy_; }
+
private:
NavigationState(PageTransition::Type transition_type,
const base::Time& request_time,
@@ -204,7 +208,8 @@ class NavigationState : public WebKit::WebDataSource::ExtraData {
postpone_loading_data_(false),
cache_policy_override_set_(false),
cache_policy_override_(WebKit::WebURLRequest::UseProtocolCachePolicy),
- user_script_idle_scheduler_(NULL) {
+ user_script_idle_scheduler_(NULL),
+ was_fetched_via_spdy_(false) {
}
PageTransition::Type transition_type_;
@@ -232,6 +237,8 @@ class NavigationState : public WebKit::WebDataSource::ExtraData {
scoped_ptr<UserScriptIdleScheduler> user_script_idle_scheduler_;
+ bool was_fetched_via_spdy_;
+
DISALLOW_COPY_AND_ASSIGN(NavigationState);
};