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

Unified Diff: Source/bindings/v8/custom/V8CryptoCustom.cpp

Issue 16820007: Expose crypto.getRandomValues() to workers. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 years, 6 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/bindings/bindings.gypi ('k') | Source/bindings/v8/custom/V8WorkerCryptoCustom.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/v8/custom/V8CryptoCustom.cpp
diff --git a/Source/bindings/v8/custom/V8CryptoCustom.cpp b/Source/bindings/v8/custom/V8CryptoCustom.cpp
index 1149c4fb7f75421f621dce5576bd2936433221f1..1d44dee57fe00ac4bfb6899c7a4a4bb4affea5ca 100644
--- a/Source/bindings/v8/custom/V8CryptoCustom.cpp
+++ b/Source/bindings/v8/custom/V8CryptoCustom.cpp
@@ -35,6 +35,9 @@
namespace WebCore {
+// This custom binding is shared by V8WorkerCrypto. As such:
+// * Do not call V8Crypto::toNative()
+// * Must be threadsafe
abarth-chromium 2013/06/13 21:48:33 It's too bad the code generator isn't smart enough
void V8Crypto::getRandomValuesMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& args)
{
if (args.Length() < 1) {
@@ -51,9 +54,8 @@ void V8Crypto::getRandomValuesMethodCustom(const v8::FunctionCallbackInfo<v8::Va
ArrayBufferView* arrayBufferView = V8ArrayBufferView::toNative(v8::Handle<v8::Object>::Cast(buffer));
ASSERT(arrayBufferView);
- Crypto* crypto = V8Crypto::toNative(args.Holder());
ExceptionCode ec = 0;
- crypto->getRandomValues(arrayBufferView, ec);
+ Crypto::getRandomValues(arrayBufferView, ec);
if (ec) {
setDOMException(ec, args.GetIsolate());
« no previous file with comments | « Source/bindings/bindings.gypi ('k') | Source/bindings/v8/custom/V8WorkerCryptoCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698