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

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: 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
« include/v8.h ('K') | « 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 5163 matching lines...) Expand 10 before | Expand all | Expand 10 after
5174 5174
5175 bool v8::V8::Initialize() { 5175 bool v8::V8::Initialize() {
5176 i::Isolate* isolate = i::Isolate::UncheckedCurrent(); 5176 i::Isolate* isolate = i::Isolate::UncheckedCurrent();
5177 if (isolate != NULL && isolate->IsInitialized()) { 5177 if (isolate != NULL && isolate->IsInitialized()) {
5178 return true; 5178 return true;
5179 } 5179 }
5180 return InitializeHelper(isolate); 5180 return InitializeHelper(isolate);
5181 } 5181 }
5182 5182
5183 5183
5184 void v8::V8::SetEntropySource(EntropySource entropy_source) { 5184 bool v8::V8::SetEntropySource(EntropySource entropy_source) {
5185 // The entropy source must be set before the library is initialized,
5186 // as otherwise not all random number generators will pick up the
5187 // entropy source and will fall back to weak entropy instead.
5188 i::Isolate* isolate = i::Isolate::UncheckedCurrent();
5189 if (isolate != NULL && isolate->IsInitialized())
Dmitry Lomov (no reviews) 2013/09/23 11:24:15 Looks like this should be isolate == NULL || !isol
Dmitry Lomov (no reviews) 2013/09/23 11:25:54 Nevermind.
5190 return false;
Dmitry Lomov (no reviews) 2013/09/23 11:24:15 I think just returning false will be ignored (also
Benedikt Meurer 2013/09/23 11:36:41 Done.
5191
5185 i::RandomNumberGenerator::SetEntropySource(entropy_source); 5192 i::RandomNumberGenerator::SetEntropySource(entropy_source);
5193 return true;
5186 } 5194 }
5187 5195
5188 5196
5189 void v8::V8::SetReturnAddressLocationResolver( 5197 void v8::V8::SetReturnAddressLocationResolver(
5190 ReturnAddressLocationResolver return_address_resolver) { 5198 ReturnAddressLocationResolver return_address_resolver) {
5191 i::V8::SetReturnAddressLocationResolver(return_address_resolver); 5199 i::V8::SetReturnAddressLocationResolver(return_address_resolver);
5192 } 5200 }
5193 5201
5194 5202
5195 bool v8::V8::SetFunctionEntryHook(FunctionEntryHook entry_hook) { 5203 bool v8::V8::SetFunctionEntryHook(FunctionEntryHook entry_hook) {
(...skipping 2696 matching lines...) Expand 10 before | Expand all | Expand 10 after
7892 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7900 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7893 Address callback_address = 7901 Address callback_address =
7894 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7902 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
7895 VMState<EXTERNAL> state(isolate); 7903 VMState<EXTERNAL> state(isolate);
7896 ExternalCallbackScope call_scope(isolate, callback_address); 7904 ExternalCallbackScope call_scope(isolate, callback_address);
7897 callback(info); 7905 callback(info);
7898 } 7906 }
7899 7907
7900 7908
7901 } } // namespace v8::internal 7909 } } // namespace v8::internal
OLDNEW
« include/v8.h ('K') | « include/v8.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698