Chromium Code Reviews| Index: Source/modules/crypto/CryptoResult.h |
| diff --git a/Source/core/workers/WorkerClients.h b/Source/modules/crypto/CryptoResult.h |
| similarity index 67% |
| copy from Source/core/workers/WorkerClients.h |
| copy to Source/modules/crypto/CryptoResult.h |
| index b362662a0aa6e53bc04529eb6b3d4954ef112e33..ae95b24d49ca7c22847e48e664527a0d6b9f7828 100644 |
| --- a/Source/core/workers/WorkerClients.h |
| +++ b/Source/modules/crypto/CryptoResult.h |
| @@ -28,31 +28,45 @@ |
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| */ |
| -#ifndef WorkerClients_h |
| -#define WorkerClients_h |
| +#ifndef CryptoResult_h |
| +#define CryptoResult_h |
| -#include "core/platform/Supplementable.h" |
| +#include "bindings/v8/ScriptObject.h" |
| +#include "public/platform/WebCrypto.h" |
| #include "wtf/Forward.h" |
| +#include "wtf/ThreadSafeRefCounted.h" |
| namespace WebCore { |
| -// This is created on the main thread, passed to the worker thread and |
| -// attached to WorkerGlobalScope when it is created. |
| -// This class can be used to provide "client" implementations to Workers. |
| -class WorkerClients : public Supplementable<WorkerClients> { |
| - WTF_MAKE_NONCOPYABLE(WorkerClients); |
| +class ScriptPromiseResolver; |
| + |
| +// Wrapper around a Promise to notify completion of the crypto operation. |
| +class CryptoResult : public ThreadSafeRefCounted<CryptoResult> { |
|
eroman
2013/08/23 23:51:26
This class is unchanged except for adding a destru
|
| public: |
| - static PassOwnPtr<WorkerClients> create() |
| + ~CryptoResult(); |
| + |
| + static PassRefPtr<CryptoResult> create(); |
| + |
| + void completeWithError(); |
| + void completeWithBuffer(const WebKit::WebArrayBuffer&); |
| + void completeWithBoolean(bool); |
| + void completeWithKey(const WebKit::WebCryptoKey&); |
| + |
| + WebKit::WebCryptoResult result() |
| { |
| - return adoptPtr(new WorkerClients()); |
| + return WebKit::WebCryptoResult(this); |
| } |
| - virtual ~WorkerClients() { } |
| + ScriptObject promise(); |
| private: |
| - WorkerClients() { } |
| + CryptoResult(); |
| + void finish(); |
| + |
| + RefPtr<ScriptPromiseResolver> m_promiseResolver; |
| + bool m_finished; |
| }; |
| } // namespace WebCore |
| -#endif // WorkerClients_h |
| +#endif |