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

Side by Side Diff: chrome/renderer/prerender/prerender_helper.cc

Issue 9623018: Prerendered pages are swapped in at browser::Navigate time. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/renderer/prerender/prerender_helper.h" 5 #include "chrome/renderer/prerender/prerender_helper.h"
6 6
7 #include "base/metrics/field_trial.h" 7 #include "base/metrics/field_trial.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "chrome/common/render_messages.h" 9 #include "chrome/common/prerender_messages.h"
10 #include "content/public/renderer/document_state.h" 10 #include "content/public/renderer/document_state.h"
11 #include "content/public/renderer/render_view.h" 11 #include "content/public/renderer/render_view.h"
12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
14 14
15 using content::DocumentState; 15 using content::DocumentState;
16 16
17 // Helper macro for histograms. 17 // Helper macro for histograms.
18 #define RECORD_PLT(tag, perceived_page_load_time) { \ 18 #define RECORD_PLT(tag, perceived_page_load_time) { \
19 UMA_HISTOGRAM_CUSTOM_TIMES( \ 19 UMA_HISTOGRAM_CUSTOM_TIMES( \
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 prerender_start_time_ = document_state->request_time(); 124 prerender_start_time_ = document_state->request_time();
125 // The first navigation for prerendering RenderViews can only be triggered 125 // The first navigation for prerendering RenderViews can only be triggered
126 // from PrerenderContents, so there should be a request_time. 126 // from PrerenderContents, so there should be a request_time.
127 DCHECK(!prerender_start_time_.is_null()); 127 DCHECK(!prerender_start_time_.is_null());
128 } 128 }
129 } 129 }
130 130
131 bool PrerenderHelper::OnMessageReceived( 131 bool PrerenderHelper::OnMessageReceived(
132 const IPC::Message& message) { 132 const IPC::Message& message) {
133 IPC_BEGIN_MESSAGE_MAP(PrerenderHelper, message) 133 IPC_BEGIN_MESSAGE_MAP(PrerenderHelper, message)
134 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetIsPrerendering, OnSetIsPrerendering) 134 IPC_MESSAGE_HANDLER(PrerenderMsg_SetIsPrerendering, OnSetIsPrerendering)
135 IPC_END_MESSAGE_MAP() 135 IPC_END_MESSAGE_MAP()
136 // Return false on ViewMsg_SetIsPrerendering so other observers can see the 136 // Return false on ViewMsg_SetIsPrerendering so other observers can see the
137 // message. 137 // message.
138 return false; 138 return false;
139 } 139 }
140 140
141 void PrerenderHelper::OnSetIsPrerendering(bool is_prerendering) { 141 void PrerenderHelper::OnSetIsPrerendering(bool is_prerendering) {
142 // Immediately after construction, |this| may receive the message that 142 // Immediately after construction, |this| may receive the message that
143 // triggered its creation. If so, ignore it. 143 // triggered its creation. If so, ignore it.
144 if (is_prerendering) 144 if (is_prerendering)
(...skipping 11 matching lines...) Expand all
156 } 156 }
157 157
158 void PrerenderHelper::UpdateVisibilityState() { 158 void PrerenderHelper::UpdateVisibilityState() {
159 if (render_view()->GetWebView()) { 159 if (render_view()->GetWebView()) {
160 render_view()->GetWebView()->setVisibilityState( 160 render_view()->GetWebView()->setVisibilityState(
161 render_view()->GetVisibilityState(), false); 161 render_view()->GetVisibilityState(), false);
162 } 162 }
163 } 163 }
164 164
165 } // namespace prerender 165 } // namespace prerender
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698