Chromium Code Reviews| Index: third_party/WebKit/Source/modules/serviceworkers/WaitUntilObserver.h |
| diff --git a/third_party/WebKit/Source/modules/serviceworkers/WaitUntilObserver.h b/third_party/WebKit/Source/modules/serviceworkers/WaitUntilObserver.h |
| index 072d09304e728c8fb0174fc78dca29a99637f02c..4b161da914276d42ea34d33c3d844da2c2d125b8 100644 |
| --- a/third_party/WebKit/Source/modules/serviceworkers/WaitUntilObserver.h |
| +++ b/third_party/WebKit/Source/modules/serviceworkers/WaitUntilObserver.h |
| @@ -16,7 +16,6 @@ class ExceptionState; |
| class ExecutionContext; |
| class ScriptPromise; |
| class ScriptState; |
| -class ScriptValue; |
| // Created for each ExtendableEvent instance. |
| class MODULES_EXPORT WaitUntilObserver final |
| @@ -40,9 +39,13 @@ class MODULES_EXPORT WaitUntilObserver final |
| static WaitUntilObserver* Create(ExecutionContext*, EventType, int event_id); |
| - // Must be called before and after dispatching the event. |
| + // Must be called before dispatching the event. |
| void WillDispatchEvent(); |
| - void DidDispatchEvent(bool error_occurred); |
| + // Must be called after dispatching the event. If |event_dispatch_failed|, |
| + // this WaitUntilObserver will soon report to ServiceWorkerGlobalScopeClient |
|
falken
2017/05/10 05:25:12
my bad, I didn't realize the DidDispatchEvent will
leonhsl(Using Gerrit)
2017/05/10 07:07:52
Done.
|
| + // that the event finished, without waiting for all waitUntil promises to |
| + // settle. |
| + void DidDispatchEvent(bool event_dispatch_failed); |
| // Observes the promise and delays calling the continuation until |
| // the given promise is resolved or rejected. |
| @@ -64,16 +67,21 @@ class MODULES_EXPORT WaitUntilObserver final |
| WaitUntilObserver(ExecutionContext*, EventType, int event_id); |
| - void ReportError(const ScriptValue&); |
| + // Called when a promise passed to a waitUntil() call that is associated with |
| + // this observer has completed. |rejected| indicates whether the promise is |
| + // rejected. |
| + void OnPromiseCompleted(bool rejected); |
| void ConsumeWindowInteraction(TimerBase*); |
| + enum EventDispatchState { kInitial, kCompleted, kFailed }; |
|
shimazu
2017/05/10 05:20:14
"enum class" is better here:
https://www.chromium.
falken
2017/05/10 05:25:12
Can you document:
// Event dispatch has not yet f
leonhsl(Using Gerrit)
2017/05/10 07:07:52
Done.
leonhsl(Using Gerrit)
2017/05/10 07:07:52
Done.
|
| + EventDispatchState event_dispatch_state_ = kInitial; |
|
shimazu
2017/05/10 05:20:14
It would be better to initialize this at the const
falken
2017/05/10 05:26:52
I thought so too but pending_activity_ and has_rej
leonhsl(Using Gerrit)
2017/05/10 07:07:52
We set class member's default value in .h file, so
|
| + |
| Member<ExecutionContext> execution_context_; |
| EventType type_; |
| int event_id_; |
| int pending_activity_ = 0; |
| - bool has_error_ = false; |
| - bool event_dispatched_ = false; |
| + bool has_rejected_promise_ = false; |
| double event_dispatch_time_ = 0; |
| TaskRunnerTimer<WaitUntilObserver> consume_window_interaction_timer_; |
| }; |