| 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 "modules/serviceworkers/WaitUntilObserver.h" | 5 #include "modules/serviceworkers/WaitUntilObserver.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ScriptFunction.h" | 7 #include "bindings/core/v8/ScriptFunction.h" |
| 8 #include "bindings/core/v8/ScriptPromise.h" | 8 #include "bindings/core/v8/ScriptPromise.h" |
| 9 #include "bindings/core/v8/ScriptValue.h" | 9 #include "bindings/core/v8/ScriptValue.h" |
| 10 #include "bindings/core/v8/V8BindingForCore.h" | 10 #include "bindings/core/v8/V8BindingForCore.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 | 55 |
| 56 private: | 56 private: |
| 57 ThenFunction(ScriptState* script_state, | 57 ThenFunction(ScriptState* script_state, |
| 58 WaitUntilObserver* observer, | 58 WaitUntilObserver* observer, |
| 59 ResolveType type) | 59 ResolveType type) |
| 60 : ScriptFunction(script_state), | 60 : ScriptFunction(script_state), |
| 61 observer_(observer), | 61 observer_(observer), |
| 62 resolve_type_(type) {} | 62 resolve_type_(type) {} |
| 63 | 63 |
| 64 ScriptValue Call(ScriptValue value) override { | 64 ScriptValue Call(ScriptValue value) override { |
| 65 ASSERT(observer_); | 65 DCHECK(observer_); |
| 66 ASSERT(resolve_type_ == kFulfilled || resolve_type_ == kRejected); | 66 ASSERT(resolve_type_ == kFulfilled || resolve_type_ == kRejected); |
| 67 if (resolve_type_ == kRejected) { | 67 if (resolve_type_ == kRejected) { |
| 68 observer_->ReportError(value); | 68 observer_->ReportError(value); |
| 69 value = | 69 value = |
| 70 ScriptPromise::Reject(value.GetScriptState(), value).GetScriptValue(); | 70 ScriptPromise::Reject(value.GetScriptState(), value).GetScriptValue(); |
| 71 } | 71 } |
| 72 observer_->DecrementPendingActivity(); | 72 observer_->DecrementPendingActivity(); |
| 73 observer_ = nullptr; | 73 observer_ = nullptr; |
| 74 return value; | 74 return value; |
| 75 } | 75 } |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 if (!execution_context_) | 222 if (!execution_context_) |
| 223 return; | 223 return; |
| 224 execution_context_->ConsumeWindowInteraction(); | 224 execution_context_->ConsumeWindowInteraction(); |
| 225 } | 225 } |
| 226 | 226 |
| 227 DEFINE_TRACE(WaitUntilObserver) { | 227 DEFINE_TRACE(WaitUntilObserver) { |
| 228 visitor->Trace(execution_context_); | 228 visitor->Trace(execution_context_); |
| 229 } | 229 } |
| 230 | 230 |
| 231 } // namespace blink | 231 } // namespace blink |
| OLD | NEW |