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

Side by Side Diff: runtime/lib/math.cc

Issue 1807293002: - Fix for issue 25950 (add registration of a thread exit callback) (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: self-review-comments Created 4 years, 9 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 unified diff | Download patch
« no previous file with comments | « runtime/include/dart_api.h ('k') | runtime/vm/bootstrap.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include <ctype.h> // isspace. 5 #include <ctype.h> // isspace.
6 6
7 #include "vm/bootstrap_natives.h" 7 #include "vm/bootstrap_natives.h"
8 8
9 #include "vm/exceptions.h" 9 #include "vm/exceptions.h"
10 #include "vm/native_entry.h" 10 #include "vm/native_entry.h"
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 seed |= (static_cast<uint64_t>(rnd->NextUInt32()) << 32); 198 seed |= (static_cast<uint64_t>(rnd->NextUInt32()) << 32);
199 return CreateRandomState(zone, seed); 199 return CreateRandomState(zone, seed);
200 } 200 }
201 201
202 202
203 DEFINE_NATIVE_ENTRY(SecureRandom_getBytes, 1) { 203 DEFINE_NATIVE_ENTRY(SecureRandom_getBytes, 1) {
204 GET_NON_NULL_NATIVE_ARGUMENT(Smi, count, arguments->NativeArgAt(0)); 204 GET_NON_NULL_NATIVE_ARGUMENT(Smi, count, arguments->NativeArgAt(0));
205 const intptr_t n = count.Value(); 205 const intptr_t n = count.Value();
206 ASSERT((n > 0) && (n <= 8)); 206 ASSERT((n > 0) && (n <= 8));
207 uint8_t buffer[8]; 207 uint8_t buffer[8];
208 Dart_EntropySource entropy_source = isolate->entropy_source_callback(); 208 Dart_EntropySource entropy_source = Dart::entropy_source_callback();
209 if ((entropy_source == NULL) || !entropy_source(buffer, n)) { 209 if ((entropy_source == NULL) || !entropy_source(buffer, n)) {
210 const String& error = String::Handle(String::New( 210 const String& error = String::Handle(String::New(
211 "No source of cryptographically secure random numbers available.")); 211 "No source of cryptographically secure random numbers available."));
212 const Array& args = Array::Handle(Array::New(1)); 212 const Array& args = Array::Handle(Array::New(1));
213 args.SetAt(0, error); 213 args.SetAt(0, error);
214 Exceptions::ThrowByType(Exceptions::kUnsupported, args); 214 Exceptions::ThrowByType(Exceptions::kUnsupported, args);
215 } 215 }
216 uint64_t result = 0; 216 uint64_t result = 0;
217 for (intptr_t i = 0; i < n; i++) { 217 for (intptr_t i = 0; i < n; i++) {
218 result = (result << 8) | buffer[i]; 218 result = (result << 8) | buffer[i];
219 } 219 }
220 return Integer::New(result); 220 return Integer::New(result);
221 } 221 }
222 222
223 } // namespace dart 223 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/include/dart_api.h ('k') | runtime/vm/bootstrap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698