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

Unified Diff: Source/modules/notifications/Notification.cpp

Issue 73993003: Make Notification override hasPendingActivity() to prolong its lifetime while async op is running (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 1 month 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
« no previous file with comments | « Source/modules/notifications/Notification.h ('k') | Source/platform/AsyncMethodRunner.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/notifications/Notification.cpp
diff --git a/Source/modules/notifications/Notification.cpp b/Source/modules/notifications/Notification.cpp
index 101e14ce5b6b80ff2c729fd0ac6df259acc43b28..9a22ac862576c4696d8120a3003ba4d378c4e508 100644
--- a/Source/modules/notifications/Notification.cpp
+++ b/Source/modules/notifications/Notification.cpp
@@ -147,7 +147,6 @@ void Notification::show()
}
if (m_notificationClient->show(this)) {
m_state = Showing;
- setPendingActivity(this);
}
}
}
@@ -165,34 +164,18 @@ void Notification::close()
}
}
+bool Notification::hasPendingActivity() const
+{
+ return m_state == Showing || (m_asyncRunner && m_asyncRunner->isActive());
+}
+
void Notification::stop()
{
if (m_notificationClient)
m_notificationClient->notificationObjectDestroyed(this);
m_notificationClient = 0;
- finalize();
-
- // Ensure m_notificationClient == 0 only when in Closed state.
- ASSERT(m_state == Closed);
-}
-
-void Notification::finalize()
-{
- if (m_state == Closed)
- return;
-
- // To call unsetPendingActivity() at the end.
- NotificationState lastState = m_state;
m_state = Closed;
abarth-chromium 2013/11/15 16:02:55 Do we need to tell the m_asyncRunner to stop, or d
tyoshino (SeeGerritForStatus) 2013/11/18 10:53:13 Good catch. Since - if m_state is set to non Idle,
-
- // setPendingActivity() is called only when show() was successful, and only
- // in that case, m_state is set to Showing. So, if it's not Showing, do
- // nothing here.
- if (lastState != Showing)
- return;
-
- unsetPendingActivity(this);
}
void Notification::dispatchShowEvent()
@@ -213,7 +196,7 @@ void Notification::dispatchClickEvent()
void Notification::dispatchCloseEvent()
{
dispatchEvent(Event::create(EventTypeNames::close));
- finalize();
+ m_state = Closed;
}
void Notification::dispatchErrorEvent()
« no previous file with comments | « Source/modules/notifications/Notification.h ('k') | Source/platform/AsyncMethodRunner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698