Index: content/renderer/render_view_impl.cc |
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc |
index a0840fbc706d373b09da8aad02abd5eff1fdbbc0..d47e5d41218c4993890e1a28ecbc75a735f67e82 100644 |
--- a/content/renderer/render_view_impl.cc |
+++ b/content/renderer/render_view_impl.cc |
@@ -2264,7 +2264,7 @@ void RenderViewImpl::didCreateDataSource(WebFrame* frame, WebDataSource* ds) { |
// non-null NavigationState. |
bool content_initiated = !pending_navigation_state_.get(); |
NavigationState* state = content_initiated ? |
- NavigationState::CreateContentInitiated() : |
+ NavigationState::CreateContentInitiated(ds) : |
pending_navigation_state_.release(); |
// NavigationState::referred_by_prefetcher_ is true if we are |
@@ -2320,16 +2320,17 @@ void RenderViewImpl::didCreateDataSource(WebFrame* frame, WebDataSource* ds) { |
void RenderViewImpl::didStartProvisionalLoad(WebFrame* frame) { |
WebDataSource* ds = frame->provisionalDataSource(); |
NavigationState* navigation_state = NavigationState::FromDataSource(ds); |
+ NavigationState::LoadTimes* load_times = navigation_state->load_times(); |
// Update the request time if WebKit has better knowledge of it. |
- if (navigation_state->request_time().is_null()) { |
+ if (load_times->request_time().is_null()) { |
double event_time = ds->triggeringEventTime(); |
if (event_time != 0.0) |
- navigation_state->set_request_time(Time::FromDoubleT(event_time)); |
+ load_times->set_request_time(Time::FromDoubleT(event_time)); |
} |
// Start time is only set after request time. |
- navigation_state->set_start_load_time(Time::Now()); |
+ load_times->set_start_load_time(Time::Now()); |
bool is_top_most = !frame->parent(); |
if (is_top_most) { |
@@ -2436,7 +2437,7 @@ void RenderViewImpl::didFailProvisionalLoad(WebFrame* frame, |
navigation_state->pending_page_id(), |
navigation_state->pending_history_list_offset(), |
navigation_state->transition_type(), |
- navigation_state->request_time())); |
+ navigation_state->load_times()->request_time())); |
} |
// Provide the user with a more helpful error page? |
@@ -2459,8 +2460,12 @@ void RenderViewImpl::didCommitProvisionalLoad(WebFrame* frame, |
bool is_new_navigation) { |
NavigationState* navigation_state = |
NavigationState::FromDataSource(frame->dataSource()); |
+ NavigationState::LoadTimes* load_times = navigation_state->load_times(); |
+ |
+ if (load_times->commit_load_time().is_null()) { |
jam
2011/10/27 20:39:53
nit: this file doesn't use brace brackets for one
|
+ load_times->set_commit_load_time(Time::Now()); |
+ } |
- navigation_state->set_commit_load_time(Time::Now()); |
if (is_new_navigation) { |
// When we perform a new navigation, we need to update the last committed |
// session history entry with state for the page we are leaving. |
@@ -2566,7 +2571,9 @@ void RenderViewImpl::didFinishDocumentLoad(WebFrame* frame) { |
WebDataSource* ds = frame->dataSource(); |
NavigationState* navigation_state = NavigationState::FromDataSource(ds); |
DCHECK(navigation_state); |
- navigation_state->set_finish_document_load_time(Time::Now()); |
+ NavigationState::LoadTimes* load_times = navigation_state->load_times(); |
+ DCHECK(load_times); |
jam
2011/10/27 20:39:53
nit: these dchecks, at least for load_times, aren'
|
+ load_times->set_finish_document_load_time(Time::Now()); |
Send(new ViewHostMsg_DocumentLoadedInFrame(routing_id_, frame->identifier())); |
@@ -2592,7 +2599,9 @@ void RenderViewImpl::didFinishLoad(WebFrame* frame) { |
WebDataSource* ds = frame->dataSource(); |
NavigationState* navigation_state = NavigationState::FromDataSource(ds); |
DCHECK(navigation_state); |
- navigation_state->set_finish_load_time(Time::Now()); |
+ NavigationState::LoadTimes* load_times = navigation_state->load_times(); |
+ DCHECK(load_times); |
+ load_times->set_finish_load_time(Time::Now()); |
FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidFinishLoad(frame)); |
@@ -2693,15 +2702,17 @@ void RenderViewImpl::didReceiveResponse( |
NavigationState* navigation_state = |
NavigationState::FromDataSource(frame->provisionalDataSource()); |
CHECK(navigation_state); |
+ NavigationState::LoadTimes* load_times = navigation_state->load_times(); |
+ DCHECK(load_times); |
int http_status_code = response.httpStatusCode(); |
// Record page load flags. |
- navigation_state->set_was_fetched_via_spdy(response.wasFetchedViaSPDY()); |
- navigation_state->set_was_npn_negotiated(response.wasNpnNegotiated()); |
- navigation_state->set_was_alternate_protocol_available( |
+ load_times->set_was_fetched_via_spdy(response.wasFetchedViaSPDY()); |
+ load_times->set_was_npn_negotiated(response.wasNpnNegotiated()); |
+ load_times->set_was_alternate_protocol_available( |
response.wasAlternateProtocolAvailable()); |
- navigation_state->set_was_fetched_via_proxy(response.wasFetchedViaProxy()); |
- navigation_state->set_http_status_code(http_status_code); |
+ load_times->set_was_fetched_via_proxy(response.wasFetchedViaProxy()); |
+ load_times->set_http_status_code(http_status_code); |
// Whether or not the http status code actually corresponds to an error is |
// only checked when the page is done loading, if |use_error_page| is |
// still true. |
@@ -2712,6 +2723,7 @@ void RenderViewImpl::didFinishResourceLoad( |
WebFrame* frame, unsigned identifier) { |
NavigationState* navigation_state = |
NavigationState::FromDataSource(frame->dataSource()); |
+ NavigationState::LoadTimes* load_times = navigation_state->load_times(); |
if (!navigation_state->use_error_page()) |
return; |
@@ -2720,7 +2732,7 @@ void RenderViewImpl::didFinishResourceLoad( |
return; |
// Display error page, if appropriate. |
- int http_status_code = navigation_state->http_status_code(); |
+ int http_status_code = load_times->http_status_code(); |
if (http_status_code == 404) { |
// On 404s, try a remote search page as a fallback. |
const GURL& document_url = frame->document().url(); |
@@ -4016,16 +4028,18 @@ void RenderViewImpl::DidFlushPaint() { |
WebDataSource* ds = main_frame->dataSource(); |
NavigationState* navigation_state = NavigationState::FromDataSource(ds); |
DCHECK(navigation_state); |
+ NavigationState::LoadTimes* load_times = navigation_state->load_times(); |
+ DCHECK(load_times); |
// TODO(jar): The following code should all be inside a method, probably in |
// NavigatorState. |
Time now = Time::Now(); |
- if (navigation_state->first_paint_time().is_null()) { |
- navigation_state->set_first_paint_time(now); |
+ if (load_times->first_paint_time().is_null()) { |
+ load_times->set_first_paint_time(now); |
} |
- if (navigation_state->first_paint_after_load_time().is_null() && |
- !navigation_state->finish_load_time().is_null()) { |
- navigation_state->set_first_paint_after_load_time(now); |
+ if (load_times->first_paint_after_load_time().is_null() && |
+ !load_times->finish_load_time().is_null()) { |
+ load_times->set_first_paint_after_load_time(now); |
} |
} |
} |