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

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: Rebased 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/runtime.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..14ec7467eb81ccc25f81b03459a88695f2143aa7 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -2000,7 +2000,9 @@ class V8_EXPORT Symbol : public Primitive {
// Create a symbol. If data is not NULL, it will be used as a print name.
Michael Starzinger 2014/03/24 10:04:33 nit: Comment is outdated.
rossberg 2014/03/24 15:09:49 Done.
static Local<Symbol> New(
- Isolate *isolate, const char* data = NULL, int length = -1);
+ Isolate *isolate, Local<String> name = Local<String>());
+
+ // TODO(rossberg): Add For method (and Global?).
V8_INLINE static Symbol* Cast(v8::Value* obj);
private:
@@ -2020,8 +2022,17 @@ class V8_EXPORT Private : public Data {
Local<Value> Name() const;
// Create a private symbol. If data is not NULL, it will be the print name.
Michael Starzinger 2014/03/24 10:04:33 nit: Likewise.
rossberg 2014/03/24 15:09:49 Done.
- static Local<Private> New(Isolate *isolate,
- Local<String> name = Local<String>());
+ 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 clashed, use qualified names as keys,
+ // e.g., "Class#property".
+ static Local<Private> Global(Isolate *isolate, Local<String> name);
Michael Starzinger 2014/03/24 10:04:33 Using this name there is the risk that it gets con
rossberg 2014/03/24 15:09:49 Renamed to ForApi. Also added Symbol::For and Symb
private:
Private();
« no previous file with comments | « no previous file | src/api.cc » ('j') | src/runtime.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698