Index: Source/modules/notifications/Notification.h |
diff --git a/Source/modules/notifications/Notification.h b/Source/modules/notifications/Notification.h |
index ef50d83910a20677612ccfdb64cb926ae896e205..31ad6f36d06ebbad7a99b9c42318a39fb42ca587 100644 |
--- a/Source/modules/notifications/Notification.h |
+++ b/Source/modules/notifications/Notification.h |
@@ -71,6 +71,11 @@ public: |
virtual ~Notification(); |
+ // Calling show() may start asynchronous operation. If this object has |
+ // a V8 wrapper, hasPendingActivity() prevents the wrapper from being |
+ // collected while m_state is Showing, and so this instance stays alive |
+ // until the operation completes. Otherwise, you need to hold a ref on this |
+ // instance until the operation completes. |
void show(); |
#if ENABLE(LEGACY_NOTIFICATIONS) |
void cancel() { close(); } |
@@ -116,6 +121,8 @@ public: |
virtual bool dispatchEvent(PassRefPtr<Event>) OVERRIDE; |
// ActiveDOMObject interface |
+ // Override to prevent this from being collected when in Showing state. |
+ virtual bool hasPendingActivity() const OVERRIDE; |
virtual void stop() OVERRIDE; |
static const String& permission(ExecutionContext*); |
@@ -128,8 +135,6 @@ private: |
#endif |
Notification(ExecutionContext*, const String& title); |
- void finalize(); |
- |
void setLang(const String& lang) { m_lang = lang; } |
void setBody(const String& body) { m_body = body; } |
void setIcon(const KURL& url) { m_icon = url; } |