| Index: Source/modules/crypto/CryptoOperation.h
|
| diff --git a/Source/modules/crypto/CryptoOperation.h b/Source/modules/crypto/CryptoOperation.h
|
| index 001747eb26e92fdea2ca96ba41e45434ac76e314..b26974dd9d66ca0e49bb83757d9af6833406e7f9 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,59 @@
|
|
|
| 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);
|
| +
|
| + ScriptObject finish();
|
| + ScriptObject abort();
|
|
|
| Algorithm* algorithm();
|
|
|
| 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);
|
| +
|
| + // Aborts and clears m_impl. If the operation has already comleted then
|
| + // returns false.
|
| + bool abortImpl();
|
| +
|
| + ScriptPromiseResolver* promiseResolver();
|
|
|
| WebKit::WebCryptoAlgorithm m_algorithm;
|
| + WebKit::WebCryptoOperation* m_impl;
|
| RefPtr<Algorithm> m_algorithmNode;
|
| + State m_state;
|
| +
|
| + RefPtr<ScriptPromiseResolver> m_promiseResolver;
|
| +
|
| + OwnPtr<Result> m_result;
|
| };
|
|
|
| } // namespace WebCore
|
|
|