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

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

Issue 19885002: WebCrypto: Add interfaces for importKey(). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Use a wrapper for the result rather than raw pointer Created 7 years, 5 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
Index: Source/modules/crypto/CryptoOperation.cpp
diff --git a/Source/modules/crypto/CryptoOperation.cpp b/Source/modules/crypto/CryptoOperation.cpp
index a6c974887d19090f1e2790a4be83139fa2ff5528..bc6dbbbf1f92f3e792b08a8b17153a29c8b05464 100644
--- a/Source/modules/crypto/CryptoOperation.cpp
+++ b/Source/modules/crypto/CryptoOperation.cpp
@@ -48,18 +48,17 @@ CryptoOperation::~CryptoOperation()
ASSERT(!m_impl);
}
-PassRefPtr<CryptoOperation> CryptoOperation::create(const WebKit::WebCryptoAlgorithm& algorithm, ExceptionCode* ec)
+PassRefPtr<CryptoOperation> CryptoOperation::create(const WebKit::WebCryptoAlgorithm& algorithm)
{
- return adoptRef(new CryptoOperation(algorithm, ec));
+ return adoptRef(new CryptoOperation(algorithm));
}
-CryptoOperation::CryptoOperation(const WebKit::WebCryptoAlgorithm& algorithm, ExceptionCode* ec)
+CryptoOperation::CryptoOperation(const WebKit::WebCryptoAlgorithm& algorithm)
: m_algorithm(algorithm)
, m_impl(0)
- , m_exceptionCode(ec)
+ , m_exceptionCode(0)
, m_state(Initializing)
{
- ASSERT(ec);
ScriptWrappable::init(this);
}
@@ -116,19 +115,16 @@ void CryptoOperation::initializationFailed()
{
ASSERT(m_state == Initializing);
- *m_exceptionCode = NotSupportedError;
-
- m_exceptionCode = 0;
+ m_exceptionCode = NotSupportedError;
m_state = Done;
}
-void CryptoOperation::initializationSucceded(WebKit::WebCryptoOperation* operationImpl)
+void CryptoOperation::initializationSucceeded(WebKit::WebCryptoOperation* operationImpl)
{
ASSERT(m_state == Initializing);
ASSERT(operationImpl);
ASSERT(!m_impl);
- m_exceptionCode = 0;
m_impl = operationImpl;
m_state = Processing;
}
@@ -153,6 +149,17 @@ void CryptoOperation::completeWithArrayBuffer(const WebKit::WebArrayBuffer& buff
promiseResolver()->fulfill(PassRefPtr<ArrayBuffer>(buffer));
}
+CryptoOperation* CryptoOperation::returnValue(ExceptionCode& ec)
+{
+ ASSERT(m_state != Initializing);
+
+ if (m_exceptionCode) {
+ ec = m_exceptionCode;
+ return 0;
+ }
+ return this;
+}
+
void CryptoOperation::process(const unsigned char* bytes, size_t size)
{
switch (m_state) {

Powered by Google App Engine
This is Rietveld 408576698