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

Unified Diff: Source/modules/serviceworkers/WaitUntilObserver.cpp

Issue 901663005: Revert r189385 "Remove LifecycleContext" and r189391, r189530, r189456 that block it (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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
« no previous file with comments | « Source/modules/serviceworkers/WaitUntilObserver.h ('k') | Source/platform/LifecycleContext.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/serviceworkers/WaitUntilObserver.cpp
diff --git a/Source/modules/serviceworkers/WaitUntilObserver.cpp b/Source/modules/serviceworkers/WaitUntilObserver.cpp
index 5cbd6c40cdd334c206f18a13cfab9940dc88be46..55a289762c41b04b169f44c82d53ba69c9955492 100644
--- a/Source/modules/serviceworkers/WaitUntilObserver.cpp
+++ b/Source/modules/serviceworkers/WaitUntilObserver.cpp
@@ -92,13 +92,11 @@ void WaitUntilObserver::waitUntil(ScriptState* scriptState, const ScriptValue& v
return;
// When handling a notificationclick event, we want to allow one window to
- // be focused or opened. Regardless of whether such action happened,
- // |consumeWindowInteraction| will be called when all the pending activities
- // will be resolved or after a
- if (m_type == NotificationClick) {
- executionContext()->allowWindowInteraction();
- m_consumeWindowInteractionTimer.startOneShot(ServiceWorkerGlobalScope::kWindowInteractionTimeout, FROM_HERE);
- }
+ // be focused. Regardless of whether one window was focused,
+ // |consumeWindowFocus| will be called when all the pending activities will
+ // be resolved.
+ if (m_type == NotificationClick)
+ executionContext()->allowWindowFocus();
incrementPendingActivity();
ScriptPromise::cast(scriptState, value).then(
@@ -113,7 +111,6 @@ WaitUntilObserver::WaitUntilObserver(ExecutionContext* context, EventType type,
, m_pendingActivity(0)
, m_hasError(false)
, m_eventDispatched(false)
- , m_consumeWindowInteractionTimer(this, &WaitUntilObserver::consumeWindowInteraction)
{
}
@@ -147,21 +144,13 @@ void WaitUntilObserver::decrementPendingActivity()
break;
case NotificationClick:
client->didHandleNotificationClickEvent(m_eventID, result);
- m_consumeWindowInteractionTimer.stop();
- consumeWindowInteraction(nullptr);
+ executionContext()->consumeWindowFocus();
break;
case Push:
client->didHandlePushEvent(m_eventID, result);
break;
}
- setContext(nullptr);
-}
-
-void WaitUntilObserver::consumeWindowInteraction(Timer<WaitUntilObserver>*)
-{
- if (!executionContext())
- return;
- executionContext()->consumeWindowInteraction();
+ observeContext(0);
}
void WaitUntilObserver::trace(Visitor* visitor)
« no previous file with comments | « Source/modules/serviceworkers/WaitUntilObserver.h ('k') | Source/platform/LifecycleContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698