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

Unified Diff: include/v8.h

Issue 2107673003: Add an API to create a detached global object (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 4 years, 5 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/api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/v8.h
diff --git a/include/v8.h b/include/v8.h
index ce5eff642ad06b36e2c8473aa4fefd4bffe0f696..39c87dcf6a13f16b6a6b0841143029aedf35433e 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -7158,14 +7158,35 @@ class V8_EXPORT Context {
*/
static Local<Context> New(
Isolate* isolate, ExtensionConfiguration* extensions = NULL,
- Local<ObjectTemplate> global_template = Local<ObjectTemplate>(),
- Local<Value> global_object = Local<Value>());
+ MaybeLocal<ObjectTemplate> global_template = MaybeLocal<ObjectTemplate>(),
+ MaybeLocal<Value> global_object = MaybeLocal<Value>());
static MaybeLocal<Context> FromSnapshot(
Isolate* isolate, size_t context_snapshot_index,
- ExtensionConfiguration* extensions = NULL,
- Local<ObjectTemplate> global_template = Local<ObjectTemplate>(),
- Local<Value> global_object = Local<Value>());
+ ExtensionConfiguration* extensions = nullptr,
+ MaybeLocal<ObjectTemplate> global_template = MaybeLocal<ObjectTemplate>(),
+ MaybeLocal<Value> global_object = MaybeLocal<Value>());
+
+ /**
+ * Returns an global object that isn't backed by an actual context.
+ *
+ * The global template needs to have access checks with handlers installed.
+ * If an existing global object is passed in, the global object is detached
+ * from its context.
+ *
+ * Note that this is different from a detached context where all accesses to
+ * the global proxy will fail. Instead, the access check handlers are invoked.
+ *
+ * It is also not possible to detach an object returned by this method.
+ * Instead, the access check handlers need to return nothing to achieve the
+ * same effect.
+ *
+ * It is possible, however, the create a new context from the global object
dcheng 2016/07/11 07:07:44 I think there might be a typo in this comment?
+ * returned by this method.
+ */
+ static MaybeLocal<Object> NewRemoteContext(
+ Isolate* isolate, Local<ObjectTemplate> global_template,
+ MaybeLocal<Value> global_object = MaybeLocal<Value>());
/**
* Sets the security token for the context. To access an object in
« no previous file with comments | « no previous file | src/api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698