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

Unified Diff: content/browser/frame_host/navigation_entry_screenshot_manager.h

Issue 166533002: [wip] Introduce SiteInstanceKeepAlive. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 10 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: content/browser/frame_host/navigation_entry_screenshot_manager.h
diff --git a/content/browser/frame_host/navigation_entry_screenshot_manager.h b/content/browser/frame_host/navigation_entry_screenshot_manager.h
index 072d6fd4a7fe19a1111acdb6b2e5c6c470f92285..4ec87815919111515b9c48bad39e2a619ba32f5b 100644
--- a/content/browser/frame_host/navigation_entry_screenshot_manager.h
+++ b/content/browser/frame_host/navigation_entry_screenshot_manager.h
@@ -6,9 +6,12 @@
#define CONTENT_BROWSER_FRAME_HOST_NAVIGATION_ENTRY_SCREENSHOT_MANAGER_H_
#include "base/compiler_specific.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/memory/scoped_vector.h"
#include "base/memory/weak_ptr.h"
#include "base/time/time.h"
#include "content/common/content_export.h"
+#include "content/public/browser/web_contents_observer.h"
class SkBitmap;
@@ -18,12 +21,14 @@ class NavigationControllerImpl;
class NavigationEntryImpl;
class RenderViewHost;
class ScreenshotData;
+class SiteInstanceKeepAlive;
// NavigationEntryScreenshotManager takes care of taking image-captures for the
// current navigation entry of a NavigationControllerImpl, and managing these
// captured images. These image-captures are used for history navigation using
// overscroll gestures.
-class CONTENT_EXPORT NavigationEntryScreenshotManager {
+class CONTENT_EXPORT NavigationEntryScreenshotManager
+ : public WebContentsObserver {
public:
explicit NavigationEntryScreenshotManager(
NavigationControllerImpl* controller);
@@ -50,6 +55,7 @@ class CONTENT_EXPORT NavigationEntryScreenshotManager {
// The callback invoked when taking the screenshot of the page is complete.
// This sets the screenshot on the navigation entry.
void OnScreenshotTaken(int unique_id,
+ SiteInstanceKeepAlive* keep_alive,
bool success,
const SkBitmap& bitmap);
@@ -71,9 +77,16 @@ class CONTENT_EXPORT NavigationEntryScreenshotManager {
// consumption is within a certain limit.
void PurgeScreenshotsIfNecessary();
+ // WebContentsObserver:
+ virtual void WebContentsDestroyed(WebContents* contents) OVERRIDE;
+
// The navigation controller that owns this screenshot-manager.
NavigationControllerImpl* owner_;
+ // Keeps track of (and owns) all the SiteInstanceKeepAlive objects created for
+ // screenshot requests.
+ ScopedVector<SiteInstanceKeepAlive> keep_alives_;
+
// Taking a screenshot and encoding them can be async. So use a weakptr for
// the callback to make sure that the screenshot/encoding completion callback
// does not trigger on a destroyed NavigationEntryScreenshotManager.

Powered by Google App Engine
This is Rietveld 408576698