| OLD | NEW | 
|     1 // Copyright 2012 the V8 project authors. All rights reserved. |     1 // Copyright 2012 the V8 project authors. All rights reserved. | 
|     2 // Use of this source code is governed by a BSD-style license that can be |     2 // Use of this source code is governed by a BSD-style license that can be | 
|     3 // found in the LICENSE file. |     3 // found in the LICENSE file. | 
|     4  |     4  | 
|     5 #ifndef V8_ISOLATE_H_ |     5 #ifndef V8_ISOLATE_H_ | 
|     6 #define V8_ISOLATE_H_ |     6 #define V8_ISOLATE_H_ | 
|     7  |     7  | 
|     8 #include "include/v8-debug.h" |     8 #include "include/v8-debug.h" | 
|     9 #include "src/allocation.h" |     9 #include "src/allocation.h" | 
|    10 #include "src/assert-scope.h" |    10 #include "src/assert-scope.h" | 
| (...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   479   // True if at least one thread Enter'ed this isolate. |   479   // True if at least one thread Enter'ed this isolate. | 
|   480   bool IsInUse() { return entry_stack_ != NULL; } |   480   bool IsInUse() { return entry_stack_ != NULL; } | 
|   481  |   481  | 
|   482   // Destroys the non-default isolates. |   482   // Destroys the non-default isolates. | 
|   483   // Sets default isolate into "has_been_disposed" state rather then destroying, |   483   // Sets default isolate into "has_been_disposed" state rather then destroying, | 
|   484   // for legacy API reasons. |   484   // for legacy API reasons. | 
|   485   void TearDown(); |   485   void TearDown(); | 
|   486  |   486  | 
|   487   static void GlobalTearDown(); |   487   static void GlobalTearDown(); | 
|   488  |   488  | 
|   489   static void SetCrashIfDefaultIsolateInitialized(); |  | 
|   490   // Ensures that process-wide resources and the default isolate have been |  | 
|   491   // allocated. It is only necessary to call this method in rare cases, for |  | 
|   492   // example if you are using V8 from within the body of a static initializer. |  | 
|   493   // Safe to call multiple times. |  | 
|   494   static void EnsureDefaultIsolate(); |  | 
|   495  |  | 
|   496   // Find the PerThread for this particular (isolate, thread) combination |   489   // Find the PerThread for this particular (isolate, thread) combination | 
|   497   // If one does not yet exist, return null. |   490   // If one does not yet exist, return null. | 
|   498   PerIsolateThreadData* FindPerThreadDataForThisThread(); |   491   PerIsolateThreadData* FindPerThreadDataForThisThread(); | 
|   499  |   492  | 
|   500   // Find the PerThread for given (isolate, thread) combination |   493   // Find the PerThread for given (isolate, thread) combination | 
|   501   // If one does not yet exist, return null. |   494   // If one does not yet exist, return null. | 
|   502   PerIsolateThreadData* FindPerThreadDataForThread(ThreadId thread_id); |   495   PerIsolateThreadData* FindPerThreadDataForThread(ThreadId thread_id); | 
|   503  |   496  | 
|   504   // Returns the key used to store the pointer to the current isolate. |   497   // Returns the key used to store the pointer to the current isolate. | 
|   505   // Used internally for V8 threads that do not execute JavaScript but still |   498   // Used internally for V8 threads that do not execute JavaScript but still | 
| (...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1083   void RemoveCallCompletedCallback(CallCompletedCallback callback); |  1076   void RemoveCallCompletedCallback(CallCompletedCallback callback); | 
|  1084   void FireCallCompletedCallback(); |  1077   void FireCallCompletedCallback(); | 
|  1085  |  1078  | 
|  1086   void EnqueueMicrotask(Handle<Object> microtask); |  1079   void EnqueueMicrotask(Handle<Object> microtask); | 
|  1087   void RunMicrotasks(); |  1080   void RunMicrotasks(); | 
|  1088  |  1081  | 
|  1089   void SetUseCounterCallback(v8::Isolate::UseCounterCallback callback); |  1082   void SetUseCounterCallback(v8::Isolate::UseCounterCallback callback); | 
|  1090   void CountUsage(v8::Isolate::UseCounterFeature feature); |  1083   void CountUsage(v8::Isolate::UseCounterFeature feature); | 
|  1091  |  1084  | 
|  1092  private: |  1085  private: | 
 |  1086   static void EnsureInitialized(); | 
 |  1087  | 
|  1093   Isolate(); |  1088   Isolate(); | 
|  1094  |  1089  | 
|  1095   friend struct GlobalState; |  1090   friend struct GlobalState; | 
|  1096   friend struct InitializeGlobalState; |  1091   friend struct InitializeGlobalState; | 
|  1097  |  1092  | 
|  1098   enum State { |  1093   enum State { | 
|  1099     UNINITIALIZED,    // Some components may not have been allocated. |  1094     UNINITIALIZED,    // Some components may not have been allocated. | 
|  1100     INITIALIZED       // All components are fully initialized. |  1095     INITIALIZED       // All components are fully initialized. | 
|  1101   }; |  1096   }; | 
|  1102  |  1097  | 
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1142     int entry_count; |  1137     int entry_count; | 
|  1143     PerIsolateThreadData* previous_thread_data; |  1138     PerIsolateThreadData* previous_thread_data; | 
|  1144     Isolate* previous_isolate; |  1139     Isolate* previous_isolate; | 
|  1145     EntryStackItem* previous_item; |  1140     EntryStackItem* previous_item; | 
|  1146  |  1141  | 
|  1147    private: |  1142    private: | 
|  1148     DISALLOW_COPY_AND_ASSIGN(EntryStackItem); |  1143     DISALLOW_COPY_AND_ASSIGN(EntryStackItem); | 
|  1149   }; |  1144   }; | 
|  1150  |  1145  | 
|  1151   // This mutex protects highest_thread_id_ and thread_data_table_. |  1146   // This mutex protects highest_thread_id_ and thread_data_table_. | 
|  1152   static base::Mutex process_wide_mutex_; |  1147   static base::LazyMutex process_wide_mutex_; | 
|  1153  |  1148  | 
|  1154   static base::Thread::LocalStorageKey per_isolate_thread_data_key_; |  1149   static base::Thread::LocalStorageKey per_isolate_thread_data_key_; | 
|  1155   static base::Thread::LocalStorageKey isolate_key_; |  1150   static base::Thread::LocalStorageKey isolate_key_; | 
|  1156   static base::Thread::LocalStorageKey thread_id_key_; |  1151   static base::Thread::LocalStorageKey thread_id_key_; | 
|  1157   static ThreadDataTable* thread_data_table_; |  1152   static ThreadDataTable* thread_data_table_; | 
|  1158  |  1153  | 
|  1159   // A global counter for all generated Isolates, might overflow. |  1154   // A global counter for all generated Isolates, might overflow. | 
|  1160   static base::Atomic32 isolate_counter_; |  1155   static base::Atomic32 isolate_counter_; | 
|  1161  |  1156  | 
|  1162   void Deinit(); |  1157   void Deinit(); | 
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1508   } |  1503   } | 
|  1509  |  1504  | 
|  1510   EmbeddedVector<char, 128> filename_; |  1505   EmbeddedVector<char, 128> filename_; | 
|  1511   FILE* file_; |  1506   FILE* file_; | 
|  1512   int scope_depth_; |  1507   int scope_depth_; | 
|  1513 }; |  1508 }; | 
|  1514  |  1509  | 
|  1515 } }  // namespace v8::internal |  1510 } }  // namespace v8::internal | 
|  1516  |  1511  | 
|  1517 #endif  // V8_ISOLATE_H_ |  1512 #endif  // V8_ISOLATE_H_ | 
| OLD | NEW |