Make sure we register extensions only once. Removed unused member variable.

V8::Initialize() can be called from various threads simultaneously, so
everything should be done only once per process or within the Isolate. For
registering extensions, we do the former now.

R=dslomov@chromium.org

Review URL: https://codereview.chromium.org/15564002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14730 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
svenpanne@chromium.org 2013-05-21 12:03:49 +00:00
parent 8743661682
commit 4a7ed948fe
4 changed files with 7 additions and 2 deletions

View File

@ -149,12 +149,10 @@ class RegisteredExtension {
static void UnregisterAll();
Extension* extension() { return extension_; }
RegisteredExtension* next() { return next_; }
RegisteredExtension* next_auto() { return next_auto_; }
static RegisteredExtension* first_extension() { return first_extension_; }
private:
Extension* extension_;
RegisteredExtension* next_;
RegisteredExtension* next_auto_;
static RegisteredExtension* first_extension_;
};

View File

@ -95,6 +95,10 @@ Handle<String> Bootstrapper::NativesSourceLookup(int index) {
void Bootstrapper::Initialize(bool create_heap_objects) {
extensions_cache_.Initialize(create_heap_objects);
}
void Bootstrapper::InitializeOncePerProcess() {
GCExtension::Register();
ExternalizeStringExtension::Register();
StatisticsExtension::Register();

View File

@ -88,6 +88,8 @@ class SourceCodeCache BASE_EMBEDDED {
// context.
class Bootstrapper {
public:
static void InitializeOncePerProcess();
// Requires: Heap::SetUp has been called.
void Initialize(bool create_heap_objects);
void TearDown();

View File

@ -281,6 +281,7 @@ void V8::InitializeOncePerProcessImpl() {
LOperand::SetUpCaches();
SetUpJSCallerSavedCodeData();
ExternalReference::SetUp();
Bootstrapper::InitializeOncePerProcess();
}
void V8::InitializeOncePerProcess() {