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

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

Issue 1900583002: Abandon prerenders upon render thread shutdown. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
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_dispatcher.h" 5 #include "chrome/renderer/prerender/prerender_dispatcher.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "chrome/common/prerender_messages.h" 10 #include "chrome/common/prerender_messages.h"
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 PrerenderExtraData::FromPrerender(prerender); 167 PrerenderExtraData::FromPrerender(prerender);
168 content::RenderThread::Get()->Send( 168 content::RenderThread::Get()->Send(
169 new PrerenderHostMsg_AbandonLinkRelPrerender(extra_data.prerender_id())); 169 new PrerenderHostMsg_AbandonLinkRelPrerender(extra_data.prerender_id()));
170 // The browser will not send an OnPrerenderStop (the prerender may have even 170 // The browser will not send an OnPrerenderStop (the prerender may have even
171 // been canceled before it was started), so release it to avoid a 171 // been canceled before it was started), so release it to avoid a
172 // leak. Moreover, if it did, the PrerenderClient in Blink will have been 172 // leak. Moreover, if it did, the PrerenderClient in Blink will have been
173 // detached already. 173 // detached already.
174 prerenders_.erase(extra_data.prerender_id()); 174 prerenders_.erase(extra_data.prerender_id());
175 } 175 }
176 176
177 void PrerenderDispatcher::detachRenderer() {
178 // Blink is shutting down, abandon all in-flight prerenders.
179 for (auto it : prerenders_) {
180 const PrerenderExtraData& extra_data =
181 PrerenderExtraData::FromPrerender(it.second);
182 content::RenderThread::Get()->Send(
183 new PrerenderHostMsg_AbandonLinkRelPrerender(
184 extra_data.prerender_id()));
185 }
186 prerenders_.clear();
187 }
188
177 } // namespace prerender 189 } // namespace prerender
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698