Make sure we register extensions only once. Removed unused member variable.
authorsvenpanne@chromium.org <svenpanne@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 21 May 2013 12:03:49 +0000 (12:03 +0000)
committersvenpanne@chromium.org <svenpanne@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 21 May 2013 12:03:49 +0000 (12:03 +0000)
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

src/api.h
src/bootstrapper.cc
src/bootstrapper.h
src/v8.cc

index 686abf75c4af0e2108da34f28a48987e5f510eec..12d6e3d08229343644b3f571933c15543b90c19b 100644 (file)
--- a/src/api.h
+++ b/src/api.h
@@ -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_;
 };
 
index 85812ca28cc8679cd9a9504967dc4405554f1dfa..7c9e4366ed7847641fbb3b6042cff7f2d5e31783 100644 (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();
index e33415eeb9ca5f9e5157f0bf23a8b93cff8af286..476ac12e1491e70431ad9059463ed13fa75c11c7 100644 (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();
index 274128ed4c4b66f4d9f3163e980e9f4a1f7c80ab..e21c815ff51743a80626c23add4f8e4f1b689e0f 100644 (file)
--- a/src/v8.cc
+++ b/src/v8.cc
@@ -281,6 +281,7 @@ void V8::InitializeOncePerProcessImpl() {
   LOperand::SetUpCaches();
   SetUpJSCallerSavedCodeData();
   ExternalReference::SetUp();
+  Bootstrapper::InitializeOncePerProcess();
 }
 
 void V8::InitializeOncePerProcess() {