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

Unified Diff: content/browser/web_contents/web_contents_impl.h

Issue 14651029: content: Remove usage of NOTIFICATION_WEB_CONTENTS_DESTROYED from content (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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/web_contents/web_contents_impl.h
diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h
index a7a408b6e6817a810fa4fe124f0c3824af86f896..ad3b7103a51efea8e41b586e3ef9fdb7fda47538 100644
--- a/content/browser/web_contents/web_contents_impl.h
+++ b/content/browser/web_contents/web_contents_impl.h
@@ -504,6 +504,8 @@ class CONTENT_EXPORT WebContentsImpl
// TODO(brettw) TestWebContents shouldn't exist!
friend class TestWebContents;
+ class DestructionObserver;
+
// See WebContents::Create for a description of these parameters.
WebContentsImpl(BrowserContext* browser_context,
WebContentsImpl* opener);
@@ -516,7 +518,15 @@ class CONTENT_EXPORT WebContentsImpl
void RemoveObserver(WebContentsObserver* observer);
// Clears this tab's opener if it has been closed.
- void OnWebContentsDestroyed(WebContents* web_contents);
+ void OnWebContentsDestroyed(WebContentsImpl* web_contents);
+
+ // Creats and adds to the map a destruction observer watching |web_contents|.
+ // No-op if such an observer already exists.
+ void AddDestructionObserver(WebContentsImpl* web_contents);
+
+ // Deletes and removes from the map a destruction observer
+ // watching |web_contents|. No-op if there is no such observer.
+ void RemoveDestructionObserver(WebContentsImpl* web_contents);
// Callback function when showing JS dialogs.
void OnDialogClosed(RenderViewHost* rvh,
@@ -737,6 +747,9 @@ class CONTENT_EXPORT WebContentsImpl
typedef std::map<int, RenderWidgetHostView*> PendingWidgetViews;
PendingWidgetViews pending_widget_views_;
+ typedef std::map<WebContentsImpl*, DestructionObserver*> DestructionObservers;
+ DestructionObservers destruction_observers_;
+
// A list of observers notified when page state changes. Weak references.
// This MUST be listed above render_manager_ since at destruction time the
// latter might cause RenderViewHost's destructor to call us and we might use

Powered by Google App Engine
This is Rietveld 408576698