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

Unified Diff: chrome/browser/renderer_host/chrome_extension_message_filter.h

Issue 377833009: Monitor Profile destruction from ChromeExtensionMessageFilter. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: delete on correct thread Created 6 years, 5 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/renderer_host/chrome_extension_message_filter.h
diff --git a/chrome/browser/renderer_host/chrome_extension_message_filter.h b/chrome/browser/renderer_host/chrome_extension_message_filter.h
index 57cd9270d4c147eb52b74c88235a883f8c130037..4a3f341bceda0210b5b83a1bc9f75b2041768282 100644
--- a/chrome/browser/renderer_host/chrome_extension_message_filter.h
+++ b/chrome/browser/renderer_host/chrome_extension_message_filter.h
@@ -9,6 +9,8 @@
#include "base/sequenced_task_runner_helpers.h"
#include "content/public/browser/browser_message_filter.h"
+#include "content/public/browser/notification_observer.h"
+#include "content/public/browser/notification_registrar.h"
class GURL;
class Profile;
@@ -26,7 +28,8 @@ class InfoMap;
// This class filters out incoming Chrome-specific IPC messages from the
// extension process on the IPC thread.
-class ChromeExtensionMessageFilter : public content::BrowserMessageFilter {
+class ChromeExtensionMessageFilter : public content::BrowserMessageFilter,
+ public content::NotificationObserver {
public:
ChromeExtensionMessageFilter(int render_process_id, Profile* profile);
@@ -35,6 +38,7 @@ class ChromeExtensionMessageFilter : public content::BrowserMessageFilter {
virtual void OverrideThreadForMessage(
const IPC::Message& message,
content::BrowserThread::ID* thread) OVERRIDE;
+ virtual void OnDestruct() const OVERRIDE;
private:
friend class content::BrowserThread;
@@ -97,14 +101,23 @@ class ChromeExtensionMessageFilter : public content::BrowserMessageFilter {
const std::string& extension_id,
const ExtensionHostMsg_APIActionOrEvent_Params& params);
+ // content::NotificationObserver implementation.
+ virtual void Observe(int type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) OVERRIDE;
+
const int render_process_id_;
// The Profile associated with our renderer process. This should only be
- // accessed on the UI thread!
+ // accessed on the UI thread! Furthermore since this class is refcounted it
+ // may outlive |profile_|, so make sure to NULL check if in doubt; async
+ // calls and the like.
Profile* profile_;
scoped_refptr<extensions::InfoMap> extension_info_map_;
+ content::NotificationRegistrar notification_registrar_;
+
DISALLOW_COPY_AND_ASSIGN(ChromeExtensionMessageFilter);
};

Powered by Google App Engine
This is Rietveld 408576698