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

Unified Diff: tools/dom/templates/html/impl/impl_Crypto.darttemplate

Issue 1387273002: Fix Crypto.getRandomValues to modify its argument, fix tests (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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 | « tools/dom/scripts/htmlrenamer.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/dom/templates/html/impl/impl_Crypto.darttemplate
diff --git a/tools/dom/templates/html/impl/impl_Crypto.darttemplate b/tools/dom/templates/html/impl/impl_Crypto.darttemplate
new file mode 100644
index 0000000000000000000000000000000000000000..1da09bb0eafb1512c5924a1f1a23d1b137e40181
--- /dev/null
+++ b/tools/dom/templates/html/impl/impl_Crypto.darttemplate
@@ -0,0 +1,26 @@
+// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+part of $LIBRARYNAME;
+
+$(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS {
+
+ TypedData getRandomValues(TypedData array) {
+$if DART2JS
+ return _getRandomValues(array);
+$else
+ var random = _getRandomValues(array);
+ // The semantics of the operation are that it modifies the argument, but we
+ // have no way of making a Dart typed data created initially in Dart reference
+ // externalized storage. So we copy the values back from the returned copy.
+ // TODO(alanknight): Make this less ridiculously slow.
+ for (var i = 0; i < random.length; i++) {
+ array[i] = random[i];
+ }
+ return array;
+$endif
+ }
+
+$!MEMBERS
+}
« no previous file with comments | « tools/dom/scripts/htmlrenamer.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698