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

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

Issue 11418260: Make TaskManagerTabContentsResource explicitly handle prerendering and instant pages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: instaaaaant Created 8 years 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 <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 TabContents* prerender_tab_contents = 678 TabContents* prerender_tab_contents =
679 (*it)->contents()->prerender_contents(); 679 (*it)->contents()->prerender_contents();
680 if (prerender_tab_contents && 680 if (prerender_tab_contents &&
681 prerender_tab_contents->web_contents() == web_contents) { 681 prerender_tab_contents->web_contents() == web_contents) {
682 return (*it)->contents(); 682 return (*it)->contents();
683 } 683 }
684 } 684 }
685 return NULL; 685 return NULL;
686 } 686 }
687 687
688 const std::vector<WebContents*>
689 PrerenderManager::GetAllPrerenderingContents() const {
690 DCHECK(CalledOnValidThread());
691 std::vector<WebContents*> result;
692
693 for (ScopedVector<PrerenderData>::const_iterator it =
694 active_prerenders_.begin();
695 it != active_prerenders_.end(); ++it) {
696 if (TabContents* contents = (*it)->contents()->prerender_contents())
697 result.push_back(contents->web_contents());
698 }
699
700 return result;
701 }
702
688 void PrerenderManager::MarkWebContentsAsPrerendered(WebContents* web_contents, 703 void PrerenderManager::MarkWebContentsAsPrerendered(WebContents* web_contents,
689 Origin origin) { 704 Origin origin) {
690 DCHECK(CalledOnValidThread()); 705 DCHECK(CalledOnValidThread());
691 prerendered_web_contents_data_.insert( 706 prerendered_web_contents_data_.insert(
692 base::hash_map<content::WebContents*, 707 base::hash_map<content::WebContents*,
693 PrerenderedWebContentsData>::value_type( 708 PrerenderedWebContentsData>::value_type(
694 web_contents, PrerenderedWebContentsData(origin))); 709 web_contents, PrerenderedWebContentsData(origin)));
695 } 710 }
696 711
697 void PrerenderManager::MarkWebContentsAsWouldBePrerendered( 712 void PrerenderManager::MarkWebContentsAsWouldBePrerendered(
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after
1342 if (!render_process_host || !render_process_host->GetBrowserContext()) 1357 if (!render_process_host || !render_process_host->GetBrowserContext())
1343 return NULL; 1358 return NULL;
1344 Profile* profile = Profile::FromBrowserContext( 1359 Profile* profile = Profile::FromBrowserContext(
1345 render_process_host->GetBrowserContext()); 1360 render_process_host->GetBrowserContext());
1346 if (!profile) 1361 if (!profile)
1347 return NULL; 1362 return NULL;
1348 return PrerenderManagerFactory::GetInstance()->GetForProfile(profile); 1363 return PrerenderManagerFactory::GetInstance()->GetForProfile(profile);
1349 } 1364 }
1350 1365
1351 } // namespace prerender 1366 } // namespace prerender
OLDNEW
« no previous file with comments | « chrome/browser/prerender/prerender_manager.h ('k') | chrome/browser/task_manager/task_manager_resource_providers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698