| Index: content/public/renderer/navigation_state.h
|
| diff --git a/content/public/renderer/navigation_state.h b/content/public/renderer/navigation_state.h
|
| index 30ccd01198f4afa195010fb89d098357fe48c1ec..1c7a1bdd14cc53fceb98e3bb3000a079efee48f0 100644
|
| --- a/content/public/renderer/navigation_state.h
|
| +++ b/content/public/renderer/navigation_state.h
|
| @@ -41,6 +41,133 @@ class NavigationState : public WebKit::WebDataSource::ExtraData {
|
| kLoadTypeMax // Bounding value for this enum.
|
| };
|
|
|
| + // Contains pieces of NavigationState that are only relevant to the initial
|
| + // page load. These are unaffected by in-document navigation.
|
| + class LoadTimes {
|
| + public:
|
| + LoadTimes(const base::Time& request_time);
|
| +
|
| + // The time that this navigation was requested.
|
| + const base::Time& request_time() const {
|
| + return request_time_;
|
| + }
|
| + void set_request_time(const base::Time& value) {
|
| + DCHECK(start_load_time_.is_null());
|
| + request_time_ = value;
|
| + }
|
| +
|
| + // The time that the document load started.
|
| + const base::Time& start_load_time() const {
|
| + return start_load_time_;
|
| + }
|
| + void set_start_load_time(const base::Time& value) {
|
| + // TODO(jar): This should not be set twice.
|
| + // DCHECK(!start_load_time_.is_null());
|
| + DCHECK(finish_document_load_time_.is_null());
|
| + start_load_time_ = value;
|
| + }
|
| +
|
| + // The time that the document load was committed.
|
| + const base::Time& commit_load_time() const {
|
| + return commit_load_time_;
|
| + }
|
| + void set_commit_load_time(const base::Time& value) {
|
| + commit_load_time_ = value;
|
| + }
|
| +
|
| + // The time that the document finished loading.
|
| + const base::Time& finish_document_load_time() const {
|
| + return finish_document_load_time_;
|
| + }
|
| + void set_finish_document_load_time(const base::Time& value) {
|
| + // TODO(jar): Some unittests break the following DCHECK, and don't have
|
| + // DCHECK(!start_load_time_.is_null());
|
| + DCHECK(!value.is_null());
|
| + // TODO(jar): Double setting does happen, but probably shouldn't.
|
| + // DCHECK(finish_document_load_time_.is_null());
|
| + // TODO(jar): We should guarantee this order :-(.
|
| + // DCHECK(finish_load_time_.is_null());
|
| + finish_document_load_time_ = value;
|
| + }
|
| +
|
| + // The time that the document and all subresources finished loading.
|
| + const base::Time& finish_load_time() const { return finish_load_time_; }
|
| + void set_finish_load_time(const base::Time& value) {
|
| + DCHECK(!value.is_null());
|
| + DCHECK(finish_load_time_.is_null());
|
| + // The following is not already set in all cases :-(
|
| + // DCHECK(!finish_document_load_time_.is_null());
|
| + finish_load_time_ = value;
|
| + }
|
| +
|
| + // The time that painting first happened after a new navigation.
|
| + const base::Time& first_paint_time() const { return first_paint_time_; }
|
| + void set_first_paint_time(const base::Time& value) {
|
| + first_paint_time_ = value;
|
| + }
|
| +
|
| + // The time that painting first happened after the document loaded.
|
| + const base::Time& first_paint_after_load_time() const {
|
| + return first_paint_after_load_time_;
|
| + }
|
| + void set_first_paint_after_load_time(const base::Time& value) {
|
| + first_paint_after_load_time_ = value;
|
| + }
|
| +
|
| + // True iff the histograms for the associated frame have been dumped.
|
| + bool load_histograms_recorded() const { return load_histograms_recorded_; }
|
| + void set_load_histograms_recorded(bool value) {
|
| + load_histograms_recorded_ = value;
|
| + }
|
| +
|
| + bool web_timing_histograms_recorded() const {
|
| + return web_timing_histograms_recorded_;
|
| + }
|
| + void set_web_timing_histograms_recorded(bool value) {
|
| + web_timing_histograms_recorded_ = value;
|
| + }
|
| +
|
| + int http_status_code() const { return http_status_code_; }
|
| + void set_http_status_code(int http_status_code) {
|
| + http_status_code_ = http_status_code;
|
| + }
|
| +
|
| + // 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_; }
|
| +
|
| + void set_was_npn_negotiated(bool value) { was_npn_negotiated_ = value; }
|
| + bool was_npn_negotiated() const { return was_npn_negotiated_; }
|
| +
|
| + void set_was_alternate_protocol_available(bool value) {
|
| + was_alternate_protocol_available_ = value;
|
| + }
|
| + bool was_alternate_protocol_available() const {
|
| + return was_alternate_protocol_available_;
|
| + }
|
| +
|
| + void set_was_fetched_via_proxy(bool value) {
|
| + was_fetched_via_proxy_ = value;
|
| + }
|
| + bool was_fetched_via_proxy() const { return was_fetched_via_proxy_; }
|
| +
|
| + private:
|
| + base::Time request_time_;
|
| + base::Time start_load_time_;
|
| + base::Time commit_load_time_;
|
| + base::Time finish_document_load_time_;
|
| + base::Time finish_load_time_;
|
| + base::Time first_paint_time_;
|
| + base::Time first_paint_after_load_time_;
|
| + bool load_histograms_recorded_;
|
| + bool web_timing_histograms_recorded_;
|
| + int http_status_code_;
|
| + bool was_fetched_via_spdy_;
|
| + bool was_npn_negotiated_;
|
| + bool was_alternate_protocol_available_;
|
| + bool was_fetched_via_proxy_;
|
| + };
|
| +
|
| virtual ~NavigationState();
|
|
|
| static NavigationState* CreateBrowserInitiated(
|
| @@ -48,21 +175,30 @@ class NavigationState : public WebKit::WebDataSource::ExtraData {
|
| int pending_history_list_offset,
|
| content::PageTransition transition_type,
|
| base::Time request_time) {
|
| - return new NavigationState(transition_type, request_time, false,
|
| - pending_page_id,
|
| + return new NavigationState(LoadTimes(request_time), transition_type,
|
| + false, pending_page_id,
|
| pending_history_list_offset);
|
| }
|
|
|
| - static NavigationState* CreateContentInitiated() {
|
| + static NavigationState* CreateContentInitiated(WebKit::WebDataSource* ds) {
|
| + NavigationState* prior_state = FromDataSource(ds);
|
| // We assume navigations initiated by content are link clicks.
|
| - return new NavigationState(
|
| - content::PAGE_TRANSITION_LINK, base::Time(), true, -1, -1);
|
| + if (prior_state) {
|
| + return new NavigationState(*prior_state->load_times(),
|
| + content::PAGE_TRANSITION_LINK, true, -1, -1);
|
| + } else {
|
| + return new NavigationState(
|
| + LoadTimes(base::Time()), content::PAGE_TRANSITION_LINK, true, -1, -1);
|
| + }
|
| }
|
|
|
| static NavigationState* FromDataSource(WebKit::WebDataSource* ds) {
|
| return static_cast<NavigationState*>(ds->extraData());
|
| }
|
|
|
| + const LoadTimes* load_times() const { return &load_times_; }
|
| + LoadTimes* load_times() { return &load_times_; }
|
| +
|
| // Contains the page_id for this navigation or -1 if there is none yet.
|
| int32 pending_page_id() const { return pending_page_id_; }
|
|
|
| @@ -83,86 +219,6 @@ class NavigationState : public WebKit::WebDataSource::ExtraData {
|
| LoadType load_type() const { return load_type_; }
|
| void set_load_type(LoadType load_type) { load_type_ = load_type; }
|
|
|
| - // The time that this navigation was requested.
|
| - const base::Time& request_time() const {
|
| - return request_time_;
|
| - }
|
| - void set_request_time(const base::Time& value) {
|
| - DCHECK(start_load_time_.is_null());
|
| - request_time_ = value;
|
| - }
|
| -
|
| - // The time that the document load started.
|
| - const base::Time& start_load_time() const {
|
| - return start_load_time_;
|
| - }
|
| - void set_start_load_time(const base::Time& value) {
|
| - // TODO(jar): This should not be set twice.
|
| - // DCHECK(!start_load_time_.is_null());
|
| - DCHECK(finish_document_load_time_.is_null());
|
| - start_load_time_ = value;
|
| - }
|
| -
|
| - // The time that the document load was committed.
|
| - const base::Time& commit_load_time() const {
|
| - return commit_load_time_;
|
| - }
|
| - void set_commit_load_time(const base::Time& value) {
|
| - commit_load_time_ = value;
|
| - }
|
| -
|
| - // The time that the document finished loading.
|
| - const base::Time& finish_document_load_time() const {
|
| - return finish_document_load_time_;
|
| - }
|
| - void set_finish_document_load_time(const base::Time& value) {
|
| - // TODO(jar): Some unittests break the following DCHECK, and don't have
|
| - // DCHECK(!start_load_time_.is_null());
|
| - DCHECK(!value.is_null());
|
| - // TODO(jar): Double setting does happen, but probably shouldn't.
|
| - // DCHECK(finish_document_load_time_.is_null());
|
| - // TODO(jar): We should guarantee this order :-(.
|
| - // DCHECK(finish_load_time_.is_null());
|
| - finish_document_load_time_ = value;
|
| - }
|
| -
|
| - // The time that the document and all subresources finished loading.
|
| - const base::Time& finish_load_time() const { return finish_load_time_; }
|
| - void set_finish_load_time(const base::Time& value) {
|
| - DCHECK(!value.is_null());
|
| - DCHECK(finish_load_time_.is_null());
|
| - // The following is not already set in all cases :-(
|
| - // DCHECK(!finish_document_load_time_.is_null());
|
| - finish_load_time_ = value;
|
| - }
|
| -
|
| - // The time that painting first happened after a new navigation.
|
| - const base::Time& first_paint_time() const { return first_paint_time_; }
|
| - void set_first_paint_time(const base::Time& value) {
|
| - first_paint_time_ = value;
|
| - }
|
| -
|
| - // The time that painting first happened after the document finished loading.
|
| - const base::Time& first_paint_after_load_time() const {
|
| - return first_paint_after_load_time_;
|
| - }
|
| - void set_first_paint_after_load_time(const base::Time& value) {
|
| - first_paint_after_load_time_ = value;
|
| - }
|
| -
|
| - // True iff the histograms for the associated frame have been dumped.
|
| - bool load_histograms_recorded() const { return load_histograms_recorded_; }
|
| - void set_load_histograms_recorded(bool value) {
|
| - load_histograms_recorded_ = value;
|
| - }
|
| -
|
| - bool web_timing_histograms_recorded() const {
|
| - return web_timing_histograms_recorded_;
|
| - }
|
| - void set_web_timing_histograms_recorded(bool value) {
|
| - web_timing_histograms_recorded_ = value;
|
| - }
|
| -
|
| // True if we have already processed the "DidCommitLoad" event for this
|
| // request. Used by session history.
|
| bool request_committed() const { return request_committed_; }
|
| @@ -202,11 +258,6 @@ class NavigationState : public WebKit::WebDataSource::ExtraData {
|
| use_error_page_ = use_error_page;
|
| }
|
|
|
| - int http_status_code() const { return http_status_code_; }
|
| - void set_http_status_code(int http_status_code) {
|
| - http_status_code_ = http_status_code;
|
| - }
|
| -
|
| // Sets the cache policy. The cache policy is only used if explicitly set and
|
| // by default is not set. You can mark a NavigationState as not having a cache
|
| // state by way of clear_cache_policy_override.
|
| @@ -226,29 +277,6 @@ 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_; }
|
| -
|
| - void set_was_npn_negotiated(bool value) { was_npn_negotiated_ = value; }
|
| - bool was_npn_negotiated() const { return was_npn_negotiated_; }
|
| -
|
| - void set_was_alternate_protocol_available(bool value) {
|
| - was_alternate_protocol_available_ = value;
|
| - }
|
| - bool was_alternate_protocol_available() const {
|
| - return was_alternate_protocol_available_;
|
| - }
|
| -
|
| - void set_was_fetched_via_proxy(bool value) {
|
| - was_fetched_via_proxy_ = value;
|
| - }
|
| - bool was_fetched_via_proxy() const { return was_fetched_via_proxy_; }
|
| -
|
| - // Whether the frame text contents was translated to a different language.
|
| - void set_was_translated(bool value) { was_translated_ = value; }
|
| - bool was_translated() const { return was_translated_; }
|
| -
|
| // True iff the frame's navigation was within the same page.
|
| void set_was_within_same_page(bool value) { was_within_same_page_ = value; }
|
| bool was_within_same_page() const { return was_within_same_page_; }
|
| @@ -264,23 +292,15 @@ class NavigationState : public WebKit::WebDataSource::ExtraData {
|
| }
|
|
|
| private:
|
| - NavigationState(content::PageTransition transition_type,
|
| - const base::Time& request_time,
|
| + NavigationState(const LoadTimes& load_times,
|
| + content::PageTransition transition_type,
|
| bool is_content_initiated,
|
| int32 pending_page_id,
|
| int pending_history_list_offset);
|
|
|
| + LoadTimes load_times_;
|
| content::PageTransition transition_type_;
|
| LoadType load_type_;
|
| - base::Time request_time_;
|
| - base::Time start_load_time_;
|
| - base::Time commit_load_time_;
|
| - base::Time finish_document_load_time_;
|
| - base::Time finish_load_time_;
|
| - base::Time first_paint_time_;
|
| - base::Time first_paint_after_load_time_;
|
| - bool load_histograms_recorded_;
|
| - bool web_timing_histograms_recorded_;
|
| bool request_committed_;
|
| bool is_content_initiated_;
|
| int32 pending_page_id_;
|
| @@ -296,13 +316,6 @@ class NavigationState : public WebKit::WebDataSource::ExtraData {
|
| bool cache_policy_override_set_;
|
| WebKit::WebURLRequest::CachePolicy cache_policy_override_;
|
|
|
| - int http_status_code_;
|
| -
|
| - bool was_fetched_via_spdy_;
|
| - bool was_npn_negotiated_;
|
| - bool was_alternate_protocol_available_;
|
| - bool was_fetched_via_proxy_;
|
| - bool was_translated_;
|
| bool was_within_same_page_;
|
|
|
| // A prefetcher is a page that contains link rel=prefetch elements.
|
|
|