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

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

Issue 2179903005: [Prerender] Change IPC from bool to enum for more prerender modes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@prefetchProto
Patch Set: Rebase Created 4 years, 4 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
« no previous file with comments | « chrome/renderer/prerender/prerender_helper.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/prerender_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"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 bool PrerenderHelper::OnMessageReceived( 51 bool PrerenderHelper::OnMessageReceived(
52 const IPC::Message& message) { 52 const IPC::Message& message) {
53 IPC_BEGIN_MESSAGE_MAP(PrerenderHelper, message) 53 IPC_BEGIN_MESSAGE_MAP(PrerenderHelper, message)
54 IPC_MESSAGE_HANDLER(PrerenderMsg_SetIsPrerendering, OnSetIsPrerendering) 54 IPC_MESSAGE_HANDLER(PrerenderMsg_SetIsPrerendering, OnSetIsPrerendering)
55 IPC_END_MESSAGE_MAP() 55 IPC_END_MESSAGE_MAP()
56 // Return false on PrerenderMsg_SetIsPrerendering so other observers can see 56 // Return false on PrerenderMsg_SetIsPrerendering so other observers can see
57 // the message. 57 // the message.
58 return false; 58 return false;
59 } 59 }
60 60
61 void PrerenderHelper::OnSetIsPrerendering(bool is_prerendering) { 61 void PrerenderHelper::OnSetIsPrerendering(PrerenderMode mode) {
62 // Immediately after construction, |this| may receive the message that 62 // Immediately after construction, |this| may receive the message that
63 // triggered its creation. If so, ignore it. 63 // triggered its creation. If so, ignore it.
64 if (is_prerendering) 64 if (mode != prerender::NO_PRERENDER)
65 return; 65 return;
66 66
67 content::RenderFrame* frame = render_frame(); 67 content::RenderFrame* frame = render_frame();
68 // |this| must be deleted so PrerenderHelper::IsPrerendering returns false 68 // |this| must be deleted so PrerenderHelper::IsPrerendering returns false
69 // when the visibility state is updated, so the visibility state string will 69 // when the visibility state is updated, so the visibility state string will
70 // not be "prerendered". 70 // not be "prerendered".
71 delete this; 71 delete this;
72 72
73 UpdateVisibilityState(frame); 73 UpdateVisibilityState(frame);
74 } 74 }
75 75
76 void PrerenderHelper::OnDestruct() { 76 void PrerenderHelper::OnDestruct() {
77 delete this; 77 delete this;
78 } 78 }
79 79
80 } // namespace prerender 80 } // namespace prerender
OLDNEW
« no previous file with comments | « chrome/renderer/prerender/prerender_helper.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698