| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 } | 57 } |
| 58 | 58 |
| 59 private: | 59 private: |
| 60 ThenFunction(ScriptState* scriptState, WaitUntilObserver* observer, ResolveT
ype type) | 60 ThenFunction(ScriptState* scriptState, WaitUntilObserver* observer, ResolveT
ype type) |
| 61 : ScriptFunction(scriptState) | 61 : ScriptFunction(scriptState) |
| 62 , m_observer(observer) | 62 , m_observer(observer) |
| 63 , m_resolveType(type) | 63 , m_resolveType(type) |
| 64 { | 64 { |
| 65 } | 65 } |
| 66 | 66 |
| 67 virtual ScriptValue call(ScriptValue value) override | 67 ScriptValue call(ScriptValue value) override |
| 68 { | 68 { |
| 69 ASSERT(m_observer); | 69 ASSERT(m_observer); |
| 70 ASSERT(m_resolveType == Fulfilled || m_resolveType == Rejected); | 70 ASSERT(m_resolveType == Fulfilled || m_resolveType == Rejected); |
| 71 if (m_resolveType == Rejected) { | 71 if (m_resolveType == Rejected) { |
| 72 m_observer->reportError(value); | 72 m_observer->reportError(value); |
| 73 value = ScriptPromise::reject(value.scriptState(), value).scriptValu
e(); | 73 value = ScriptPromise::reject(value.scriptState(), value).scriptValu
e(); |
| 74 } | 74 } |
| 75 m_observer->decrementPendingActivity(); | 75 m_observer->decrementPendingActivity(); |
| 76 m_observer = nullptr; | 76 m_observer = nullptr; |
| 77 return value; | 77 return value; |
| (...skipping 113 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 |