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

Side by Side Diff: chrome/browser/prerender/prerender_manager.cc

Issue 12379019: Merge 185084 (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1364/src/
Patch Set: Created 7 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
« no previous file with comments | « chrome/browser/prerender/prerender_browsertest.cc ('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/browser/prerender/prerender_manager.h" 5 #include "chrome/browser/prerender/prerender_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 if (!source_web_contents) 264 if (!source_web_contents)
265 return NULL; 265 return NULL;
266 if (source_web_contents->GetURL().host() == url.host()) 266 if (source_web_contents->GetURL().host() == url.host())
267 origin = ORIGIN_LINK_REL_PRERENDER_SAMEDOMAIN; 267 origin = ORIGIN_LINK_REL_PRERENDER_SAMEDOMAIN;
268 // TODO(ajwong): This does not correctly handle storage for isolated apps. 268 // TODO(ajwong): This does not correctly handle storage for isolated apps.
269 session_storage_namespace = 269 session_storage_namespace =
270 source_web_contents->GetController() 270 source_web_contents->GetController()
271 .GetDefaultSessionStorageNamespace(); 271 .GetDefaultSessionStorageNamespace();
272 } 272 }
273 273
274 // If the prerender request comes from a recently cancelled prerender that
275 // |this| still owns, then abort the prerender.
276 for (ScopedVector<PrerenderData>::iterator it = to_delete_prerenders_.begin();
277 it != to_delete_prerenders_.end(); ++it) {
278 PrerenderContents* prerender_contents = (*it)->contents();
279 int contents_child_id;
280 int contents_route_id;
281 if (prerender_contents->GetChildId(&contents_child_id) &&
282 prerender_contents->GetRouteId(&contents_route_id) &&
283 contents_child_id == process_id && contents_route_id == route_id) {
284 return NULL;
285 }
286 }
287
274 if (PrerenderData* parent_prerender_data = 288 if (PrerenderData* parent_prerender_data =
275 FindPrerenderDataForChildAndRoute(process_id, route_id)) { 289 FindPrerenderDataForChildAndRoute(process_id, route_id)) {
276 // Instead of prerendering from inside of a running prerender, we will defer 290 // Instead of prerendering from inside of a running prerender, we will defer
277 // this request until its launcher is made visible. 291 // this request until its launcher is made visible.
278 if (PrerenderContents* contents = parent_prerender_data->contents()) { 292 if (PrerenderContents* contents = parent_prerender_data->contents()) {
279 PrerenderHandle* prerender_handle = 293 PrerenderHandle* prerender_handle =
280 new PrerenderHandle(static_cast<PrerenderData*>(NULL)); 294 new PrerenderHandle(static_cast<PrerenderData*>(NULL));
281 scoped_ptr<PrerenderContents::PendingPrerenderInfo> 295 scoped_ptr<PrerenderContents::PendingPrerenderInfo>
282 pending_prerender_info(new PrerenderContents::PendingPrerenderInfo( 296 pending_prerender_info(new PrerenderContents::PendingPrerenderInfo(
283 prerender_handle->weak_ptr_factory_.GetWeakPtr(), 297 prerender_handle->weak_ptr_factory_.GetWeakPtr(),
(...skipping 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after
1307 if (!render_process_host || !render_process_host->GetBrowserContext()) 1321 if (!render_process_host || !render_process_host->GetBrowserContext())
1308 return NULL; 1322 return NULL;
1309 Profile* profile = Profile::FromBrowserContext( 1323 Profile* profile = Profile::FromBrowserContext(
1310 render_process_host->GetBrowserContext()); 1324 render_process_host->GetBrowserContext());
1311 if (!profile) 1325 if (!profile)
1312 return NULL; 1326 return NULL;
1313 return PrerenderManagerFactory::GetInstance()->GetForProfile(profile); 1327 return PrerenderManagerFactory::GetInstance()->GetForProfile(profile);
1314 } 1328 }
1315 1329
1316 } // namespace prerender 1330 } // namespace prerender
OLDNEW
« no previous file with comments | « chrome/browser/prerender/prerender_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698