| 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 "bindings/v8/ScriptPromiseResolverWithContext.h" | 6 #include "bindings/v8/ScriptPromiseResolverWithContext.h" |
| 7 | 7 |
| 8 #include "bindings/v8/V8PerIsolateData.h" | 8 #include "bindings/v8/V8PerIsolateData.h" |
| 9 #include "core/dom/ExecutionContextTask.h" | 9 #include "core/dom/ExecutionContextTask.h" |
| 10 #include "wtf/PassOwnPtr.h" | 10 #include "wtf/PassOwnPtr.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 RefPtr<ScriptState> m_scriptState; | 35 RefPtr<ScriptState> m_scriptState; |
| 36 }; | 36 }; |
| 37 | 37 |
| 38 } // namespace | 38 } // namespace |
| 39 | 39 |
| 40 ScriptPromiseResolverWithContext::ScriptPromiseResolverWithContext(ScriptState*
scriptState) | 40 ScriptPromiseResolverWithContext::ScriptPromiseResolverWithContext(ScriptState*
scriptState) |
| 41 : ActiveDOMObject(scriptState->executionContext()) | 41 : ActiveDOMObject(scriptState->executionContext()) |
| 42 , m_state(Pending) | 42 , m_state(Pending) |
| 43 , m_scriptState(scriptState) | 43 , m_scriptState(scriptState) |
| 44 , m_timer(this, &ScriptPromiseResolverWithContext::onTimerFired) | 44 , m_timer(this, &ScriptPromiseResolverWithContext::onTimerFired) |
| 45 , m_resolver(ScriptPromiseResolver::create(m_scriptState->executionContext()
)) { } | 45 , m_resolver(ScriptPromiseResolver::create(m_scriptState.get())) |
| 46 { |
| 47 } |
| 46 | 48 |
| 47 void ScriptPromiseResolverWithContext::suspend() | 49 void ScriptPromiseResolverWithContext::suspend() |
| 48 { | 50 { |
| 49 m_timer.stop(); | 51 m_timer.stop(); |
| 50 } | 52 } |
| 51 | 53 |
| 52 void ScriptPromiseResolverWithContext::resume() | 54 void ScriptPromiseResolverWithContext::resume() |
| 53 { | 55 { |
| 54 if (m_state == Resolving || m_state == Rejecting) | 56 if (m_state == Resolving || m_state == Rejecting) |
| 55 m_timer.startOneShot(0, FROM_HERE); | 57 m_timer.startOneShot(0, FROM_HERE); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 m_resolver.clear(); | 100 m_resolver.clear(); |
| 99 m_value.clear(); | 101 m_value.clear(); |
| 100 if (state == Resolving || state == Rejecting) { | 102 if (state == Resolving || state == Rejecting) { |
| 101 // |ref| was called in |resolveOrReject|. | 103 // |ref| was called in |resolveOrReject|. |
| 102 deref(); | 104 deref(); |
| 103 } | 105 } |
| 104 // |this| may be deleted here. | 106 // |this| may be deleted here. |
| 105 } | 107 } |
| 106 | 108 |
| 107 } // namespace WebCore | 109 } // namespace WebCore |
| OLD | NEW |