Chromium Code Reviews| 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. |