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

Unified Diff: chrome/browser/tab_contents/thumbnail_generator.cc

Issue 10349013: Prevent browser thumbnailer from trying to read from frontbuffer (surface texture) when none exists. (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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/tab_contents/thumbnail_generator.cc
diff --git a/chrome/browser/tab_contents/thumbnail_generator.cc b/chrome/browser/tab_contents/thumbnail_generator.cc
index 162094b85936b01bd7cd204243670ba5e27907e1..426128cf3b98a4bac6442f08ad89fe161340e860 100644
--- a/chrome/browser/tab_contents/thumbnail_generator.cc
+++ b/chrome/browser/tab_contents/thumbnail_generator.cc
@@ -498,12 +498,8 @@ SkBitmap ThumbnailGenerator::GetClippedBitmap(const SkBitmap& bitmap,
void ThumbnailGenerator::UpdateThumbnailIfNecessary(
WebContents* web_contents) {
- const GURL& url = web_contents->GetURL();
- Profile* profile =
- Profile::FromBrowserContext(web_contents->GetBrowserContext());
- history::TopSites* top_sites = profile->GetTopSites();
// Skip if we don't need to update the thumbnail.
- if (!ShouldUpdateThumbnail(profile, top_sites, url))
+ if (!ShouldUpdateThumbnail(web_contents))
return;
AsyncUpdateThumbnail(web_contents);
@@ -581,9 +577,15 @@ void ThumbnailGenerator::AsyncUpdateThumbnailFinish(
UpdateThumbnail(web_contents.get(), thumbnail, clip_result);
}
-bool ThumbnailGenerator::ShouldUpdateThumbnail(Profile* profile,
- history::TopSites* top_sites,
- const GURL& url) {
+bool ThumbnailGenerator::ShouldUpdateThumbnail(
+ content::WebContents* web_contents) {
+ const GURL& url = web_contents->GetURL();
+ Profile* profile =
+ Profile::FromBrowserContext(web_contents->GetBrowserContext());
mazda 2012/05/03 19:57:31 NULL check for profile is needed.
+ history::TopSites* top_sites = profile->GetTopSites();
mazda 2012/05/03 19:57:31 Could you move this just before |top_sites| is use
+ content::RenderWidgetHostView* rwhv = web_contents->GetRenderWidgetHostView();
+ if (!rwhv->HasSurface())
mazda 2012/05/03 19:57:31 In order to use this function here, it needs to ha
+ return false;
if (!profile || !top_sites)
mazda 2012/05/03 19:57:31 Please delete this with the changes above.
return false;
// Skip if it's in the incognito mode.

Powered by Google App Engine
This is Rietveld 408576698