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

Unified Diff: include/v8.h

Issue 196103004: Add support for per-isolate private symbols (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: More comments; force dictionary mode Created 6 years, 9 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') | src/isolate.cc » ('J')
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 7a153b0011a1b166b57748748c3404edff93a01c..918199b644f540dc797a28cf8732b7dfa08c94db 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -1998,9 +1998,20 @@ class V8_EXPORT Symbol : public Primitive {
// Returns the print name string of the symbol, or undefined if none.
Local<Value> Name() const;
- // Create a symbol. If data is not NULL, it will be used as a print name.
+ // Create a symbol. If name is not empty, it will be used as the description.
static Local<Symbol> New(
- Isolate *isolate, const char* data = NULL, int length = -1);
+ Isolate *isolate, Local<String> name = Local<String>());
+
+ // Access global symbol registry.
+ // Note that symbols created this way are never collected, so
+ // they should only be used for statically fixed properties.
+ // Also, there is only one global name space for the names used as keys.
+ // To minimize the potential for clashes, use qualified names as keys.
+ static Local<Symbol> For(Isolate *isolate, Local<String> name);
+
+ // Retrieve a global symbol. Similar to |For|, but using a separate
+ // registry that is not accessible by (and cannot clash with) JavaScript code.
+ static Local<Symbol> ForApi(Isolate *isolate, Local<String> name);
V8_INLINE static Symbol* Cast(v8::Value* obj);
private:
@@ -2019,9 +2030,18 @@ class V8_EXPORT Private : public Data {
// Returns the print name string of the private symbol, or undefined if none.
Local<Value> Name() const;
- // Create a private symbol. If data is not NULL, it will be the print name.
- static Local<Private> New(Isolate *isolate,
- Local<String> name = Local<String>());
+ // Create a private symbol. If name is not empty, it will be the description.
+ static Local<Private> New(
+ Isolate *isolate, Local<String> name = Local<String>());
+
+ // Retrieve a global private symbol. If a symbol with this name has not
+ // been retrieved in the same isolate before, it is created.
+ // Note that private symbols created this way are never collected, so
+ // they should only be used for statically fixed properties.
+ // Also, there is only one global name space for the names used as keys.
+ // To minimize the potential for clashes, use qualified names as keys,
+ // e.g., "Class#property".
+ static Local<Private> ForApi(Isolate *isolate, Local<String> name);
private:
Private();
« no previous file with comments | « no previous file | src/api.cc » ('j') | src/isolate.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698