Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1769)

Unified Diff: Source/modules/crypto/CryptoResultImpl.cpp

Issue 1233173002: Have ScriptPromiseResolver on the Oilpan heap always. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fix webusb ScriptPromiseResolver usage Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/modules/crypto/CryptoResultImpl.h ('k') | Source/modules/crypto/SubtleCrypto.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/crypto/CryptoResultImpl.cpp
diff --git a/Source/modules/crypto/CryptoResultImpl.cpp b/Source/modules/crypto/CryptoResultImpl.cpp
index cdf1f2243020600dc19cac340e29a3f4e627789f..7efd0097e99174319967326f84ecda015b77219b 100644
--- a/Source/modules/crypto/CryptoResultImpl.cpp
+++ b/Source/modules/crypto/CryptoResultImpl.cpp
@@ -64,12 +64,13 @@ static void rejectWithTypeError(const String& errorDetails, ScriptPromiseResolve
class CryptoResultImpl::Resolver final : public ScriptPromiseResolver {
public:
- static PassRefPtrWillBeRawPtr<Resolver> create(ScriptState* scriptState, CryptoResultImpl* result)
+ static Resolver* create(ScriptState* scriptState, CryptoResultImpl* result)
{
- RefPtrWillBeRawPtr<Resolver> resolver = adoptRefWillBeNoop(new Resolver(scriptState, result));
+ ASSERT(scriptState->contextIsValid());
+ Resolver* resolver = new Resolver(scriptState, result);
resolver->suspendIfNeeded();
resolver->keepAliveWhilePending();
- return resolver.release();
+ return resolver;
}
void stop() override
@@ -90,7 +91,7 @@ private:
: ScriptPromiseResolver(scriptState)
, m_result(result) { }
- RefPtrWillBeMember<CryptoResultImpl> m_result;
+ Member<CryptoResultImpl> m_result;
};
CryptoResultImpl::ResultCancel::ResultCancel()
@@ -130,17 +131,12 @@ ExceptionCode webCryptoErrorToExceptionCode(WebCryptoErrorType errorType)
}
CryptoResultImpl::CryptoResultImpl(ScriptState* scriptState)
- : m_cancel(ResultCancel::create())
+ : m_resolver(Resolver::create(scriptState, this))
+ , m_cancel(ResultCancel::create())
{
- ASSERT(scriptState->contextIsValid());
- if (scriptState->executionContext()->activeDOMObjectsAreStopped()) {
- // If active dom objects have been stopped, avoid creating
- // CryptoResultImpl::Resolver.
- m_resolver = nullptr;
+ // Sync cancellation state.
+ if (scriptState->executionContext()->activeDOMObjectsAreStopped())
m_cancel->cancel();
- return;
- }
- m_resolver = Resolver::create(scriptState, this).get();
}
CryptoResultImpl::~CryptoResultImpl()
@@ -159,9 +155,9 @@ 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)
« no previous file with comments | « Source/modules/crypto/CryptoResultImpl.h ('k') | Source/modules/crypto/SubtleCrypto.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698