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

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

Issue 10107002: TabContents -> WebContentsImpl, part 18. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | Annotate | Revision Log
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 <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 DCHECK(new_render_view_host); 387 DCHECK(new_render_view_host);
388 if (old_render_view_host->GetSessionStorageNamespace() != 388 if (old_render_view_host->GetSessionStorageNamespace() !=
389 new_render_view_host->GetSessionStorageNamespace()) { 389 new_render_view_host->GetSessionStorageNamespace()) {
390 DestroyAndMarkMatchCompleteAsUsed( 390 DestroyAndMarkMatchCompleteAsUsed(
391 prerender_contents.release(), 391 prerender_contents.release(),
392 FINAL_STATUS_SESSION_STORAGE_NAMESPACE_MISMATCH); 392 FINAL_STATUS_SESSION_STORAGE_NAMESPACE_MISMATCH);
393 return false; 393 return false;
394 } 394 }
395 395
396 // If we don't want to use prerenders at all, we are done. 396 // If we don't want to use prerenders at all, we are done.
397 // For bookkeeping purposes, we need to mark this TabContents to 397 // For bookkeeping purposes, we need to mark this WebContents to
398 // reflect that it would have been prerendered. 398 // reflect that it would have been prerendered.
399 if (GetMode() == PRERENDER_MODE_EXPERIMENT_NO_USE_GROUP) { 399 if (GetMode() == PRERENDER_MODE_EXPERIMENT_NO_USE_GROUP) {
400 MarkWebContentsAsWouldBePrerendered(web_contents); 400 MarkWebContentsAsWouldBePrerendered(web_contents);
401 prerender_contents.release()->Destroy(FINAL_STATUS_WOULD_HAVE_BEEN_USED); 401 prerender_contents.release()->Destroy(FINAL_STATUS_WOULD_HAVE_BEEN_USED);
402 return false; 402 return false;
403 } 403 }
404 404
405 int child_id, route_id; 405 int child_id, route_id;
406 CHECK(prerender_contents->GetChildId(&child_id)); 406 CHECK(prerender_contents->GetChildId(&child_id));
407 CHECK(prerender_contents->GetRouteId(&route_id)); 407 CHECK(prerender_contents->GetRouteId(&route_id));
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 } 527 }
528 } 528 }
529 if (!swapped_in_dummy_replacement) 529 if (!swapped_in_dummy_replacement)
530 prerender_list_.erase(it); 530 prerender_list_.erase(it);
531 break; 531 break;
532 } 532 }
533 } 533 }
534 AddToHistory(entry); 534 AddToHistory(entry);
535 pending_delete_list_.push_back(entry); 535 pending_delete_list_.push_back(entry);
536 536
537 // Destroy the old TabContents relatively promptly to reduce resource usage, 537 // Destroy the old WebContents relatively promptly to reduce resource usage,
538 // and in the case of HTML5 media, reduce the change of playing any sound. 538 // and in the case of HTML5 media, reduce the change of playing any sound.
539 PostCleanupTask(); 539 PostCleanupTask();
540 } 540 }
541 541
542 // static 542 // static
543 void PrerenderManager::RecordPerceivedPageLoadTime( 543 void PrerenderManager::RecordPerceivedPageLoadTime(
544 base::TimeDelta perceived_page_load_time, 544 base::TimeDelta perceived_page_load_time,
545 double fraction_plt_elapsed_at_swap_in, 545 double fraction_plt_elapsed_at_swap_in,
546 WebContents* web_contents, 546 WebContents* web_contents,
547 const GURL& url) { 547 const GURL& url) {
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after
1238 if (!render_process_host || !render_process_host->GetBrowserContext()) 1238 if (!render_process_host || !render_process_host->GetBrowserContext())
1239 return NULL; 1239 return NULL;
1240 Profile* profile = Profile::FromBrowserContext( 1240 Profile* profile = Profile::FromBrowserContext(
1241 render_process_host->GetBrowserContext()); 1241 render_process_host->GetBrowserContext());
1242 if (!profile) 1242 if (!profile)
1243 return NULL; 1243 return NULL;
1244 return PrerenderManagerFactory::GetInstance()->GetForProfile(profile); 1244 return PrerenderManagerFactory::GetInstance()->GetForProfile(profile);
1245 } 1245 }
1246 1246
1247 } // namespace prerender 1247 } // namespace prerender
OLDNEW
« no previous file with comments | « chrome/browser/prerender/prerender_manager.h ('k') | chrome/browser/prerender/prerender_tab_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698