| 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/RespondWithObserver.h" | 6 #include "modules/serviceworkers/RespondWithObserver.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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 } | 44 } |
| 45 | 45 |
| 46 private: | 46 private: |
| 47 ThenFunction(ScriptState* scriptState, RespondWithObserver* observer, Resolv
eType type) | 47 ThenFunction(ScriptState* scriptState, RespondWithObserver* observer, Resolv
eType type) |
| 48 : ScriptFunction(scriptState) | 48 : ScriptFunction(scriptState) |
| 49 , m_observer(observer) | 49 , m_observer(observer) |
| 50 , m_resolveType(type) | 50 , m_resolveType(type) |
| 51 { | 51 { |
| 52 } | 52 } |
| 53 | 53 |
| 54 virtual ScriptValue call(ScriptValue value) override | 54 ScriptValue call(ScriptValue value) override |
| 55 { | 55 { |
| 56 ASSERT(m_observer); | 56 ASSERT(m_observer); |
| 57 ASSERT(m_resolveType == Fulfilled || m_resolveType == Rejected); | 57 ASSERT(m_resolveType == Fulfilled || m_resolveType == Rejected); |
| 58 if (m_resolveType == Rejected) { | 58 if (m_resolveType == Rejected) { |
| 59 m_observer->responseWasRejected(WebServiceWorkerResponseErrorPromise
Rejected); | 59 m_observer->responseWasRejected(WebServiceWorkerResponseErrorPromise
Rejected); |
| 60 value = ScriptPromise::reject(value.scriptState(), value).scriptValu
e(); | 60 value = ScriptPromise::reject(value.scriptState(), value).scriptValu
e(); |
| 61 } else { | 61 } else { |
| 62 m_observer->responseWasFulfilled(value); | 62 m_observer->responseWasFulfilled(value); |
| 63 } | 63 } |
| 64 m_observer = nullptr; | 64 m_observer = nullptr; |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 , m_state(Initial) | 182 , m_state(Initial) |
| 183 { | 183 { |
| 184 } | 184 } |
| 185 | 185 |
| 186 DEFINE_TRACE(RespondWithObserver) | 186 DEFINE_TRACE(RespondWithObserver) |
| 187 { | 187 { |
| 188 ContextLifecycleObserver::trace(visitor); | 188 ContextLifecycleObserver::trace(visitor); |
| 189 } | 189 } |
| 190 | 190 |
| 191 } // namespace blink | 191 } // namespace blink |
| OLD | NEW |