| 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 "bindings/core/v8/ScriptPromiseResolver.h" | 5 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 6 | 6 |
| 7 #include "core/inspector/InspectorInstrumentation.h" | 7 #include "core/inspector/InspectorInstrumentation.h" |
| 8 | 8 |
| 9 namespace blink { | 9 namespace blink { |
| 10 | 10 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 // is created in a suspended execution context and the resolver | 54 // is created in a suspended execution context and the resolver |
| 55 // is then resolved/rejected while in that suspended state. | 55 // is then resolved/rejected while in that suspended state. |
| 56 if (m_state == Detached || m_keepAlive) | 56 if (m_state == Detached || m_keepAlive) |
| 57 return; | 57 return; |
| 58 | 58 |
| 59 // Keep |this| around while the promise is Pending; | 59 // Keep |this| around while the promise is Pending; |
| 60 // see detach() for the dual operation. | 60 // see detach() for the dual operation. |
| 61 m_keepAlive = this; | 61 m_keepAlive = this; |
| 62 } | 62 } |
| 63 | 63 |
| 64 void ScriptPromiseResolver::onTimerFired(Timer<ScriptPromiseResolver>*) | 64 void ScriptPromiseResolver::onTimerFired(TimerBase*) |
| 65 { | 65 { |
| 66 ASSERT(m_state == Resolving || m_state == Rejecting); | 66 ASSERT(m_state == Resolving || m_state == Rejecting); |
| 67 if (!getScriptState()->contextIsValid()) { | 67 if (!getScriptState()->contextIsValid()) { |
| 68 detach(); | 68 detach(); |
| 69 return; | 69 return; |
| 70 } | 70 } |
| 71 | 71 |
| 72 ScriptState::Scope scope(m_scriptState.get()); | 72 ScriptState::Scope scope(m_scriptState.get()); |
| 73 resolveOrRejectImmediately(); | 73 resolveOrRejectImmediately(); |
| 74 } | 74 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 88 } | 88 } |
| 89 detach(); | 89 detach(); |
| 90 } | 90 } |
| 91 | 91 |
| 92 DEFINE_TRACE(ScriptPromiseResolver) | 92 DEFINE_TRACE(ScriptPromiseResolver) |
| 93 { | 93 { |
| 94 ActiveDOMObject::trace(visitor); | 94 ActiveDOMObject::trace(visitor); |
| 95 } | 95 } |
| 96 | 96 |
| 97 } // namespace blink | 97 } // namespace blink |
| OLD | NEW |