| 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/encryptedmedia/ContentDecryptionModuleResultPromise.h" | 5 #include "modules/encryptedmedia/ContentDecryptionModuleResultPromise.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ScriptPromise.h" | 7 #include "bindings/core/v8/ScriptPromise.h" |
| 8 #include "bindings/core/v8/ScriptState.h" | 8 #include "bindings/core/v8/ScriptState.h" |
| 9 #include "bindings/core/v8/V8ThrowException.h" | 9 #include "bindings/core/v8/V8ThrowException.h" |
| 10 #include "core/dom/DOMException.h" | 10 #include "core/dom/DOMException.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 m_resolver.clear(); | 100 m_resolver.clear(); |
| 101 } | 101 } |
| 102 | 102 |
| 103 ExecutionContext* ContentDecryptionModuleResultPromise::getExecutionContext() | 103 ExecutionContext* ContentDecryptionModuleResultPromise::getExecutionContext() |
| 104 const { | 104 const { |
| 105 return m_resolver->getExecutionContext(); | 105 return m_resolver->getExecutionContext(); |
| 106 } | 106 } |
| 107 | 107 |
| 108 bool ContentDecryptionModuleResultPromise::isValidToFulfillPromise() { | 108 bool ContentDecryptionModuleResultPromise::isValidToFulfillPromise() { |
| 109 // getExecutionContext() is no longer valid once the context is destroyed. | 109 // getExecutionContext() is no longer valid once the context is destroyed. |
| 110 // activeDOMObjectsAreStopped() is called to see if the context is in the | 110 // isContextDestroyed() is called to see if the context is in the |
| 111 // process of being destroyed. If it is, there is no need to fulfill this | 111 // process of being destroyed. If it is, there is no need to fulfill this |
| 112 // promise which is about to go away anyway. | 112 // promise which is about to go away anyway. |
| 113 return getExecutionContext() && | 113 return getExecutionContext() && !getExecutionContext()->isContextDestroyed(); |
| 114 !getExecutionContext()->activeDOMObjectsAreStopped(); | |
| 115 } | 114 } |
| 116 | 115 |
| 117 DEFINE_TRACE(ContentDecryptionModuleResultPromise) { | 116 DEFINE_TRACE(ContentDecryptionModuleResultPromise) { |
| 118 visitor->trace(m_resolver); | 117 visitor->trace(m_resolver); |
| 119 ContentDecryptionModuleResult::trace(visitor); | 118 ContentDecryptionModuleResult::trace(visitor); |
| 120 } | 119 } |
| 121 | 120 |
| 122 } // namespace blink | 121 } // namespace blink |
| OLD | NEW |