Chromium Code Reviews| Index: content/browser/frame_host/navigation_entry_screenshot_manager.cc |
| diff --git a/content/browser/frame_host/navigation_entry_screenshot_manager.cc b/content/browser/frame_host/navigation_entry_screenshot_manager.cc |
| index b2bf429dc0a6c66a34266a5267ed62267a8aacb6..466241a3ee1c6ea94c2f85a0eb94245b937884fe 100644 |
| --- a/content/browser/frame_host/navigation_entry_screenshot_manager.cc |
| +++ b/content/browser/frame_host/navigation_entry_screenshot_manager.cc |
| @@ -11,6 +11,7 @@ |
| #include "content/browser/renderer_host/render_view_host_impl.h" |
| #include "content/public/browser/render_widget_host.h" |
| #include "content/public/browser/render_widget_host_view.h" |
| +#include "content/public/browser/site_instance.h" |
| #include "content/public/common/content_switches.h" |
| #include "third_party/skia/include/core/SkCanvas.h" |
| #include "third_party/skia/include/core/SkPaint.h" |
| @@ -134,11 +135,16 @@ void NavigationEntryScreenshotManager::TakeScreenshotImpl( |
| NavigationEntryImpl* entry) { |
| DCHECK(host && host->GetView()); |
| DCHECK(entry); |
| + scoped_refptr<SiteInstanceImpl> site_instance( |
| + static_cast<SiteInstanceImpl*>(host->GetSiteInstance())); |
| + scoped_ptr<SiteInstanceKeepAlive> keep_alive( |
|
mfomitchev
2014/02/14 16:21:36
Why not just keep_alive = site_instance->AcquireKe
|
| + site_instance->AcquireKeepAlive()); |
| host->CopyFromBackingStore(gfx::Rect(), |
| host->GetView()->GetViewBounds().size(), |
| base::Bind(&NavigationEntryScreenshotManager::OnScreenshotTaken, |
| screenshot_factory_.GetWeakPtr(), |
| - entry->GetUniqueID())); |
| + entry->GetUniqueID(), |
| + base::Passed(&keep_alive))); |
| } |
| void NavigationEntryScreenshotManager::SetMinScreenshotIntervalMS( |
| @@ -147,9 +153,12 @@ void NavigationEntryScreenshotManager::SetMinScreenshotIntervalMS( |
| min_screenshot_interval_ms_ = interval_ms; |
| } |
| -void NavigationEntryScreenshotManager::OnScreenshotTaken(int unique_id, |
| - bool success, |
| - const SkBitmap& bitmap) { |
| +void NavigationEntryScreenshotManager::OnScreenshotTaken( |
| + int unique_id, |
| + scoped_ptr<SiteInstanceKeepAlive> site_instance, |
|
mfomitchev
2014/02/14 16:21:36
rename this to keep_alive?
|
| + bool success, |
| + const SkBitmap& bitmap) { |
| + site_instance.reset(); |
|
mfomitchev
2014/02/14 16:21:36
The biggest question for me is whether this will g
|
| NavigationEntryImpl* entry = NULL; |
| int entry_count = owner_->GetEntryCount(); |
| for (int i = 0; i < entry_count; ++i) { |