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

Unified Diff: Source/modules/crypto/CryptoResult.h

Issue 23338006: Cleanup: remove WebCryptoResultPrivate from blink API. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove extra newline Created 7 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/core/platform/chromium/support/WebCrypto.cpp ('k') | Source/modules/crypto/CryptoResult.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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> {
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
« no previous file with comments | « Source/core/platform/chromium/support/WebCrypto.cpp ('k') | Source/modules/crypto/CryptoResult.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698