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

Unified Diff: src/isolate.h

Issue 367583003: Reland 22105 "Remove static initializer from isolate" (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/isolate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/isolate.h
diff --git a/src/isolate.h b/src/isolate.h
index 157839fb6459bdbd121c92c72d7d0d869ac887d6..9605699ff25e357fb6eb1d353050cf7b18ef6a6e 100644
--- a/src/isolate.h
+++ b/src/isolate.h
@@ -448,12 +448,14 @@ 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);
@@ -461,6 +463,7 @@ class Isolate {
}
INLINE(static Isolate* UncheckedCurrent()) {
+ EnsureInitialized();
return reinterpret_cast<Isolate*>(
base::Thread::GetThreadLocal(isolate_key_));
}
@@ -486,13 +489,6 @@ 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();
@@ -505,11 +501,13 @@ 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_;
}
@@ -1090,6 +1088,8 @@ class Isolate {
void CountUsage(v8::Isolate::UseCounterFeature feature);
private:
+ static void EnsureInitialized();
+
Isolate();
friend struct GlobalState;
@@ -1149,7 +1149,7 @@ class Isolate {
};
// This mutex protects highest_thread_id_ and thread_data_table_.
- static base::Mutex process_wide_mutex_;
+ static base::LazyMutex process_wide_mutex_;
static base::Thread::LocalStorageKey per_isolate_thread_data_key_;
static base::Thread::LocalStorageKey isolate_key_;
« no previous file with comments | « no previous file | src/isolate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698