Index: src/isolate.h |
diff --git a/src/isolate.h b/src/isolate.h |
index 5c4725b7d077fe2111cc2ddc424f1142dc280a74..3b572d71514ea99f383a44d74a51dee7276dbe93 100644 |
--- a/src/isolate.h |
+++ b/src/isolate.h |
@@ -447,14 +447,12 @@ class Isolate { |
// Returns the PerIsolateThreadData for the current thread (or NULL if one is |
// not currently set). |
static PerIsolateThreadData* CurrentPerIsolateThreadData() { |
- EnsureInitialized(); |
return reinterpret_cast<PerIsolateThreadData*>( |
base::Thread::GetThreadLocal(per_isolate_thread_data_key_)); |
} |
// Returns the isolate inside which the current thread is running. |
INLINE(static Isolate* Current()) { |
- EnsureInitialized(); |
Isolate* isolate = reinterpret_cast<Isolate*>( |
base::Thread::GetExistingThreadLocal(isolate_key_)); |
ASSERT(isolate != NULL); |
@@ -462,17 +460,6 @@ class Isolate { |
} |
INLINE(static Isolate* UncheckedCurrent()) { |
- EnsureInitialized(); |
- return reinterpret_cast<Isolate*>( |
- base::Thread::GetThreadLocal(isolate_key_)); |
- } |
- |
- // Like UncheckCurrent, but returns NULL if called reentrantly during |
- // initialization. |
- INLINE(static Isolate* UncheckedReentrantCurrent()) { |
- if (!process_wide_mutex_.Pointer()->TryLock()) return NULL; |
- process_wide_mutex_.Pointer()->Unlock(); |
- EnsureInitialized(); |
return reinterpret_cast<Isolate*>( |
base::Thread::GetThreadLocal(isolate_key_)); |
} |
@@ -498,6 +485,13 @@ class Isolate { |
static void GlobalTearDown(); |
+ static void SetCrashIfDefaultIsolateInitialized(); |
+ // Ensures that process-wide resources and the default isolate have been |
+ // allocated. It is only necessary to call this method in rare cases, for |
+ // example if you are using V8 from within the body of a static initializer. |
+ // Safe to call multiple times. |
+ static void EnsureDefaultIsolate(); |
+ |
// Find the PerThread for this particular (isolate, thread) combination |
// If one does not yet exist, return null. |
PerIsolateThreadData* FindPerThreadDataForThisThread(); |
@@ -510,13 +504,11 @@ class Isolate { |
// Used internally for V8 threads that do not execute JavaScript but still |
// are part of the domain of an isolate (like the context switcher). |
static base::Thread::LocalStorageKey isolate_key() { |
- EnsureInitialized(); |
return isolate_key_; |
} |
// Returns the key used to store process-wide thread IDs. |
static base::Thread::LocalStorageKey thread_id_key() { |
- EnsureInitialized(); |
return thread_id_key_; |
} |
@@ -1097,8 +1089,6 @@ class Isolate { |
void CountUsage(v8::Isolate::UseCounterFeature feature); |
private: |
- static void EnsureInitialized(); |
- |
Isolate(); |
friend struct GlobalState; |
@@ -1158,7 +1148,7 @@ class Isolate { |
}; |
// This mutex protects highest_thread_id_ and thread_data_table_. |
- static base::LazyMutex process_wide_mutex_; |
+ static base::Mutex process_wide_mutex_; |
static base::Thread::LocalStorageKey per_isolate_thread_data_key_; |
static base::Thread::LocalStorageKey isolate_key_; |