Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2935)

Unified Diff: content/renderer/render_view_impl.cc

Issue 8404018: chrome.loadTimes() shouldn't be affected by in-document navigation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/public/renderer/navigation_state.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
}
}
« no previous file with comments | « content/public/renderer/navigation_state.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698