Index: include/v8.h |
=================================================================== |
--- include/v8.h (revision 3427) |
+++ include/v8.h (working copy) |
@@ -132,6 +132,7 @@ |
class Arguments; |
class Object; |
class Top; |
+class V8Context; |
} |
@@ -2761,14 +2762,12 @@ |
/** |
* Returns whether v8::Locker is being used by this V8 instance. |
*/ |
- static bool IsActive() { return active_; } |
+ static bool IsActive(); |
private: |
bool has_lock_; |
bool top_level_; |
- static bool active_; |
- |
// Disallow copying and assigning. |
Locker(const Locker&); |
void operator=(const Locker&); |
@@ -3207,6 +3206,58 @@ |
/** |
+ * Encapsulates V8 instance |
+ */ |
+class V8EXPORT V8ContextProvider { |
+ public: |
+ V8ContextProvider(); |
+ ~V8ContextProvider(); |
+ |
+ operator internal::V8Context*() const { |
+ return v8context_; |
+ } |
+ private: |
+ V8ContextProvider(const V8ContextProvider&); |
+ void operator=(const V8ContextProvider&); |
+ void* operator new(size_t size); |
+ void operator delete(void*, size_t); |
+ |
+ internal::V8Context* const v8context_; |
+ friend class V8ContextBinder; |
+}; |
+ |
+/** |
+ * Manages binding of V8 instance (from V8ContextProvider) to current thread |
+ * |
+ * V8ContextProvider context_provider; |
+ * ... |
+ * V8ContextBinder context_binder(context_provider); |
+ */ |
+class V8EXPORT V8ContextBinder { |
+ public: |
+ V8ContextBinder(internal::V8Context*, bool bind_default = false); |
+ ~V8ContextBinder(); |
+ private: |
+ V8ContextBinder(const V8ContextBinder&); |
+ void operator=(const V8ContextBinder&); |
+ void* operator new(size_t size); |
+ void operator delete(void*, size_t); |
+ |
+ internal::V8Context* const v8context_; |
+ bool bound_default_; |
+}; |
+ |
+/** |
+ * Allocated statically, implies intent of V8 host to have several instances |
+ * of V8 in process |
+ */ |
+class V8EXPORT AllowSeveralV8InstancesInProcess { |
+ public: |
+ AllowSeveralV8InstancesInProcess(); |
+ ~AllowSeveralV8InstancesInProcess(); |
+}; |
+ |
+/** |
* \example shell.cc |
* A simple shell that takes a list of expressions on the |
* command-line and executes them. |