Index: Source/modules/crypto/CryptoOperation.h |
diff --git a/Source/modules/crypto/CryptoOperation.h b/Source/modules/crypto/CryptoOperation.h |
index 001747eb26e92fdea2ca96ba41e45434ac76e314..b6b9c29dde17ba4f9a30f56235efe9038bc155ff 100644 |
--- a/Source/modules/crypto/CryptoOperation.h |
+++ b/Source/modules/crypto/CryptoOperation.h |
@@ -31,8 +31,10 @@ |
#ifndef CryptoOperation_h |
#define CryptoOperation_h |
+#include "bindings/v8/ScriptObject.h" |
#include "bindings/v8/ScriptWrappable.h" |
#include "modules/crypto/Algorithm.h" |
+#include "public/platform/WebCrypto.h" |
#include "public/platform/WebCryptoAlgorithm.h" |
#include "wtf/Forward.h" |
#include "wtf/PassRefPtr.h" |
@@ -40,19 +42,55 @@ |
namespace WebCore { |
+class ScriptPromiseResolver; |
+ |
typedef int ExceptionCode; |
class CryptoOperation : public ScriptWrappable, public RefCounted<CryptoOperation> { |
public: |
- static PassRefPtr<CryptoOperation> create(const WebKit::WebCryptoAlgorithm& algorithm) { return adoptRef(new CryptoOperation(algorithm)); } |
+ ~CryptoOperation(); |
+ static PassRefPtr<CryptoOperation> create(const WebKit::WebCryptoAlgorithm&, WebKit::WebCryptoOperation*); |
+ |
+ CryptoOperation* process(ArrayBuffer* data); |
+ CryptoOperation* process(ArrayBufferView* data); |
+ |
+ CryptoOperation* finish(); |
+ CryptoOperation* abort(); |
Algorithm* algorithm(); |
+ const ScriptValue& promise(); |
private: |
- explicit CryptoOperation(const WebKit::WebCryptoAlgorithm&); |
+ class Result; |
+ friend class Result; |
+ |
+ enum State { |
+ // Accepting calls to process(). |
+ Processing, |
+ |
+ // finish() has been called, but the Promise has not been resolved yet. |
+ Finishing, |
+ |
+ // The operation either: |
+ // - completed successfully |
+ // - failed |
+ // - was aborted |
+ Done, |
+ }; |
+ |
+ CryptoOperation(const WebKit::WebCryptoAlgorithm&, WebKit::WebCryptoOperation*); |
+ |
+ void process(const unsigned char*, size_t); |
WebKit::WebCryptoAlgorithm m_algorithm; |
+ WebKit::WebCryptoOperation* m_impl; |
RefPtr<Algorithm> m_algorithmNode; |
+ State m_state; |
+ |
+ RefPtr<ScriptPromiseResolver> m_promiseResolver; |
+ ScriptObject m_promise; |
abarth-chromium
2013/07/12 03:53:24
This isn't good. You can't hold a ScriptObject as
eroman
2013/07/12 04:24:37
I have changed it so the accessor returns a copy o
|
+ |
+ OwnPtr<Result> m_result; |
}; |
} // namespace WebCore |