OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 #include "modules/serviceworkers/WaitUntilObserver.h" | 6 #include "modules/serviceworkers/WaitUntilObserver.h" |
7 | 7 |
8 #include "bindings/core/v8/ScriptFunction.h" | 8 #include "bindings/core/v8/ScriptFunction.h" |
9 #include "bindings/core/v8/ScriptPromise.h" | 9 #include "bindings/core/v8/ScriptPromise.h" |
10 #include "bindings/core/v8/ScriptValue.h" | 10 #include "bindings/core/v8/ScriptValue.h" |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 | 116 |
117 if (!executionContext()) | 117 if (!executionContext()) |
118 return; | 118 return; |
119 | 119 |
120 // When handling a notificationclick event, we want to allow one window to | 120 // When handling a notificationclick event, we want to allow one window to |
121 // be focused or opened. See comments in ::willDispatchEvent(). When | 121 // be focused or opened. See comments in ::willDispatchEvent(). When |
122 // waitUntil() is being used, opening or closing a window must happen in a | 122 // waitUntil() is being used, opening or closing a window must happen in a |
123 // timeframe specified by windowInteractionTimeout(), otherwise the calls | 123 // timeframe specified by windowInteractionTimeout(), otherwise the calls |
124 // will fail. | 124 // will fail. |
125 if (m_type == NotificationClick) | 125 if (m_type == NotificationClick) |
126 m_consumeWindowInteractionTimer.startOneShot(windowInteractionTimeout(),
FROM_HERE); | 126 m_consumeWindowInteractionTimer.startOneShot(windowInteractionTimeout(),
BLINK_FROM_HERE); |
127 | 127 |
128 incrementPendingActivity(); | 128 incrementPendingActivity(); |
129 scriptPromise.then( | 129 scriptPromise.then( |
130 ThenFunction::createFunction(scriptState, this, ThenFunction::Fulfilled)
, | 130 ThenFunction::createFunction(scriptState, this, ThenFunction::Fulfilled)
, |
131 ThenFunction::createFunction(scriptState, this, ThenFunction::Rejected))
; | 131 ThenFunction::createFunction(scriptState, this, ThenFunction::Rejected))
; |
132 } | 132 } |
133 | 133 |
134 WaitUntilObserver::WaitUntilObserver(ExecutionContext* context, EventType type,
int eventID) | 134 WaitUntilObserver::WaitUntilObserver(ExecutionContext* context, EventType type,
int eventID) |
135 : ContextLifecycleObserver(context) | 135 : ContextLifecycleObserver(context) |
136 , m_type(type) | 136 , m_type(type) |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 return; | 191 return; |
192 executionContext()->consumeWindowInteraction(); | 192 executionContext()->consumeWindowInteraction(); |
193 } | 193 } |
194 | 194 |
195 DEFINE_TRACE(WaitUntilObserver) | 195 DEFINE_TRACE(WaitUntilObserver) |
196 { | 196 { |
197 ContextLifecycleObserver::trace(visitor); | 197 ContextLifecycleObserver::trace(visitor); |
198 } | 198 } |
199 | 199 |
200 } // namespace blink | 200 } // namespace blink |
OLD | NEW |