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

Side by Side Diff: src/api.cc

Issue 24357002: Let SetEntropySource() fail if called after V8::Initialize(). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments. Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « include/v8.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 5157 matching lines...) Expand 10 before | Expand all | Expand 10 after
5168 bool v8::V8::Initialize() { 5168 bool v8::V8::Initialize() {
5169 i::Isolate* isolate = i::Isolate::UncheckedCurrent(); 5169 i::Isolate* isolate = i::Isolate::UncheckedCurrent();
5170 if (isolate != NULL && isolate->IsInitialized()) { 5170 if (isolate != NULL && isolate->IsInitialized()) {
5171 return true; 5171 return true;
5172 } 5172 }
5173 return InitializeHelper(isolate); 5173 return InitializeHelper(isolate);
5174 } 5174 }
5175 5175
5176 5176
5177 void v8::V8::SetEntropySource(EntropySource entropy_source) { 5177 void v8::V8::SetEntropySource(EntropySource entropy_source) {
5178 // The entropy source must be set before the library is initialized,
5179 // as otherwise not all random number generators will pick up the
5180 // entropy source and will fall back to weak entropy instead.
5181 i::Isolate* isolate = i::Isolate::UncheckedCurrent();
Michael Starzinger 2013/09/23 14:51:31 We try to get rid of Isolate::Current, please try
Benedikt Meurer 2013/09/23 20:25:51 I know, but there's currently no other way to perf
5182 ApiCheck(isolate != NULL && isolate->IsInitialized(),
5183 "v8::V8::SetEntropySource",
5184 "Cannot set entropy source once V8 is initialized.");
5178 i::RandomNumberGenerator::SetEntropySource(entropy_source); 5185 i::RandomNumberGenerator::SetEntropySource(entropy_source);
5179 } 5186 }
5180 5187
5181 5188
5182 void v8::V8::SetReturnAddressLocationResolver( 5189 void v8::V8::SetReturnAddressLocationResolver(
5183 ReturnAddressLocationResolver return_address_resolver) { 5190 ReturnAddressLocationResolver return_address_resolver) {
5184 i::V8::SetReturnAddressLocationResolver(return_address_resolver); 5191 i::V8::SetReturnAddressLocationResolver(return_address_resolver);
5185 } 5192 }
5186 5193
5187 5194
(...skipping 2680 matching lines...) Expand 10 before | Expand all | Expand 10 after
7868 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7875 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7869 Address callback_address = 7876 Address callback_address =
7870 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7877 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
7871 VMState<EXTERNAL> state(isolate); 7878 VMState<EXTERNAL> state(isolate);
7872 ExternalCallbackScope call_scope(isolate, callback_address); 7879 ExternalCallbackScope call_scope(isolate, callback_address);
7873 callback(info); 7880 callback(info);
7874 } 7881 }
7875 7882
7876 7883
7877 } } // namespace v8::internal 7884 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « include/v8.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698