Chromium Code Reviews| Index: Source/modules/crypto/CryptoResultImpl.cpp |
| diff --git a/Source/modules/crypto/CryptoResultImpl.cpp b/Source/modules/crypto/CryptoResultImpl.cpp |
| index 2360727a13a91f34ae1e4352523c2068b1c2c2e2..c91519c6d1e0631daa5bd1d725ee9bf095cf0445 100644 |
| --- a/Source/modules/crypto/CryptoResultImpl.cpp |
| +++ b/Source/modules/crypto/CryptoResultImpl.cpp |
| @@ -63,12 +63,12 @@ static void rejectWithTypeError(const String& errorDetails, ScriptPromiseResolve |
| class CryptoResultImpl::Resolver final : public ScriptPromiseResolver { |
| public: |
| - static PassRefPtrWillBeRawPtr<ScriptPromiseResolver> create(ScriptState* scriptState, CryptoResultImpl* result) |
| + static Resolver* create(ScriptState* scriptState, CryptoResultImpl* result) |
| { |
| - RefPtrWillBeRawPtr<Resolver> resolver = adoptRefWillBeNoop(new Resolver(scriptState, result)); |
| + Resolver* resolver = new Resolver(scriptState, result); |
| resolver->suspendIfNeeded(); |
| resolver->keepAliveWhilePending(); |
| - return resolver.release(); |
| + return resolver; |
| } |
| void stop() override |
| @@ -79,11 +79,18 @@ public: |
| ScriptPromiseResolver::stop(); |
| } |
| + DEFINE_INLINE_VIRTUAL_TRACE() |
| + { |
| + visitor->trace(m_result); |
| + ScriptPromiseResolver::trace(visitor); |
| + } |
| + |
| private: |
| Resolver(ScriptState* scriptState, CryptoResultImpl* result) |
| : ScriptPromiseResolver(scriptState) |
| , m_result(result) { } |
| - RefPtr<CryptoResultImpl> m_result; |
| + |
| + Member<CryptoResultImpl> m_result; |
| }; |
| ExceptionCode webCryptoErrorToExceptionCode(WebCryptoErrorType errorType) |
| @@ -107,19 +114,38 @@ ExceptionCode webCryptoErrorToExceptionCode(WebCryptoErrorType errorType) |
| return 0; |
| } |
| +CryptoResultImpl::CryptoResultImpl(ScriptState* scriptState) |
| + : m_cancelled(0) |
| +{ |
| + ASSERT(scriptState->contextIsValid()); |
| + if (scriptState->executionContext()->activeDOMObjectsAreStopped()) { |
|
haraken
2015/07/17 01:40:36
Not related to this CL, why do we need this specia
sof
2015/07/17 09:43:26
It's due to https://codereview.chromium.org/780793
|
| + // If active dom objects have been stopped, avoid creating |
| + // CryptoResultResolver. |
| + m_resolver = nullptr; |
| + } else { |
| + m_resolver = Resolver::create(scriptState, this); |
| + } |
| +} |
| + |
| CryptoResultImpl::~CryptoResultImpl() |
| { |
| ASSERT(!m_resolver); |
| } |
| +DEFINE_TRACE(CryptoResultImpl) |
| +{ |
| + visitor->trace(m_resolver); |
| + CryptoResult::trace(visitor); |
| +} |
| + |
| void CryptoResultImpl::clearResolver() |
| { |
| m_resolver = nullptr; |
| } |
| -PassRefPtrWillBeRawPtr<CryptoResultImpl> CryptoResultImpl::create(ScriptState* scriptState) |
| +CryptoResultImpl* CryptoResultImpl::create(ScriptState* scriptState) |
| { |
| - return adoptRefWillBeNoop(new CryptoResultImpl(scriptState)); |
| + return new CryptoResultImpl(scriptState); |
| } |
| void CryptoResultImpl::completeWithError(WebCryptoErrorType errorType, const WebString& errorDetails) |
| @@ -203,19 +229,6 @@ void CryptoResultImpl::cancel() |
| releaseStore(&m_cancelled, 1); |
| } |
| -CryptoResultImpl::CryptoResultImpl(ScriptState* scriptState) |
| - : m_cancelled(0) |
| -{ |
| - ASSERT(scriptState->contextIsValid()); |
| - if (scriptState->executionContext()->activeDOMObjectsAreStopped()) { |
| - // If active dom objects have been stopped, avoid creating |
| - // CryptoResultResolver. |
| - m_resolver = nullptr; |
| - } else { |
| - m_resolver = Resolver::create(scriptState, this).get(); |
| - } |
| -} |
| - |
| ScriptPromise CryptoResultImpl::promise() |
| { |
| return m_resolver ? m_resolver->promise() : ScriptPromise(); |