| 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 #ifndef WaitUntilObserver_h | 5 #ifndef WaitUntilObserver_h |
| 6 #define WaitUntilObserver_h | 6 #define WaitUntilObserver_h |
| 7 | 7 |
| 8 #include "core/dom/ContextLifecycleObserver.h" | 8 #include "core/dom/ContextLifecycleObserver.h" |
| 9 #include "modules/ModulesExport.h" | 9 #include "modules/ModulesExport.h" |
| 10 #include "modules/serviceworkers/ServiceWorkerGlobalScopeClient.h" | 10 #include "modules/serviceworkers/ServiceWorkerGlobalScopeClient.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 void willDispatchEvent(); | 43 void willDispatchEvent(); |
| 44 void didDispatchEvent(bool errorOccurred); | 44 void didDispatchEvent(bool errorOccurred); |
| 45 | 45 |
| 46 // Observes the promise and delays calling the continuation until | 46 // Observes the promise and delays calling the continuation until |
| 47 // the given promise is resolved or rejected. | 47 // the given promise is resolved or rejected. |
| 48 void waitUntil(ScriptState*, ScriptPromise, ExceptionState&); | 48 void waitUntil(ScriptState*, ScriptPromise, ExceptionState&); |
| 49 | 49 |
| 50 // These methods can be called when the lifecycle of ExtendableEvent | 50 // These methods can be called when the lifecycle of ExtendableEvent |
| 51 // observed by this WaitUntilObserver should be extended by other reason | 51 // observed by this WaitUntilObserver should be extended by other reason |
| 52 // than ExtendableEvent.waitUntil. | 52 // than ExtendableEvent.waitUntil. |
| 53 // Note: There is no need to call decrementPendingActivity() after the context |
| 54 // is being destroyed. |
| 53 void incrementPendingActivity(); | 55 void incrementPendingActivity(); |
| 54 void decrementPendingActivity(); | 56 void decrementPendingActivity(); |
| 55 | 57 |
| 56 DECLARE_VIRTUAL_TRACE(); | 58 DECLARE_VIRTUAL_TRACE(); |
| 57 | 59 |
| 58 private: | 60 private: |
| 59 friend class InternalsServiceWorker; | 61 friend class InternalsServiceWorker; |
| 60 class ThenFunction; | 62 class ThenFunction; |
| 61 | 63 |
| 62 WaitUntilObserver(ExecutionContext*, EventType, int eventID); | 64 WaitUntilObserver(ExecutionContext*, EventType, int eventID); |
| 63 | 65 |
| 64 void reportError(const ScriptValue&); | 66 void reportError(const ScriptValue&); |
| 65 | 67 |
| 66 void consumeWindowInteraction(TimerBase*); | 68 void consumeWindowInteraction(TimerBase*); |
| 67 | 69 |
| 68 EventType m_type; | 70 EventType m_type; |
| 69 int m_eventID; | 71 int m_eventID; |
| 70 int m_pendingActivity = 0; | 72 int m_pendingActivity = 0; |
| 71 bool m_hasError = false; | 73 bool m_hasError = false; |
| 72 bool m_eventDispatched = false; | 74 bool m_eventDispatched = false; |
| 73 double m_eventDispatchTime = 0; | 75 double m_eventDispatchTime = 0; |
| 74 Timer<WaitUntilObserver> m_consumeWindowInteractionTimer; | 76 Timer<WaitUntilObserver> m_consumeWindowInteractionTimer; |
| 75 }; | 77 }; |
| 76 | 78 |
| 77 } // namespace blink | 79 } // namespace blink |
| 78 | 80 |
| 79 #endif // WaitUntilObserver_h | 81 #endif // WaitUntilObserver_h |
| OLD | NEW |