| 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 RespondWithObserver_h |   5 #ifndef RespondWithObserver_h | 
|   6 #define RespondWithObserver_h |   6 #define RespondWithObserver_h | 
|   7  |   7  | 
|   8 #include "core/dom/ContextLifecycleObserver.h" |   8 #include "core/dom/ContextLifecycleObserver.h" | 
|   9 #include "core/events/EventTarget.h" |   9 #include "core/events/EventTarget.h" | 
|  10 #include "modules/ModulesExport.h" |  10 #include "modules/ModulesExport.h" | 
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  54   DECLARE_VIRTUAL_TRACE(); |  54   DECLARE_VIRTUAL_TRACE(); | 
|  55  |  55  | 
|  56  protected: |  56  protected: | 
|  57   RespondWithObserver(ExecutionContext*, int event_id, WaitUntilObserver*); |  57   RespondWithObserver(ExecutionContext*, int event_id, WaitUntilObserver*); | 
|  58   const int event_id_; |  58   const int event_id_; | 
|  59   double event_dispatch_time_ = 0; |  59   double event_dispatch_time_ = 0; | 
|  60  |  60  | 
|  61  private: |  61  private: | 
|  62   class ThenFunction; |  62   class ThenFunction; | 
|  63  |  63  | 
|  64   void ResponseWasRejected(WebServiceWorkerResponseError); |  64   void ResponseWasRejected(WebServiceWorkerResponseError, const ScriptValue&); | 
|  65   void ResponseWasFulfilled(const ScriptValue&); |  65   void ResponseWasFulfilled(const ScriptValue&); | 
|  66  |  66  | 
|  67   enum State { kInitial, kPending, kDone }; |  67   enum State { kInitial, kPending, kDone }; | 
|  68   State state_; |  68   State state_; | 
|  69  |  69  | 
|  70   // RespondWith should ensure the ExtendableEvent is alive until the promise |  70   // RespondWith should ensure the ExtendableEvent is alive until the promise | 
|  71   // passed to RespondWith is resolved. The lifecycle of the ExtendableEvent |  71   // passed to RespondWith is resolved. The lifecycle of the ExtendableEvent | 
|  72   // is controlled by WaitUntilObserver, so not only |  72   // is controlled by WaitUntilObserver, so not only | 
|  73   // WaitUntilObserver::ThenFunction but RespondWith needs to have a strong |  73   // WaitUntilObserver::ThenFunction but RespondWith needs to have a strong | 
|  74   // reference to the WaitUntilObserver. |  74   // reference to the WaitUntilObserver. | 
|  75   Member<WaitUntilObserver> observer_; |  75   Member<WaitUntilObserver> observer_; | 
|  76 }; |  76 }; | 
|  77  |  77  | 
|  78 }  // namespace blink |  78 }  // namespace blink | 
|  79  |  79  | 
|  80 #endif  // RespondWithObserver_h |  80 #endif  // RespondWithObserver_h | 
| OLD | NEW |