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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/api.cc » ('j') | src/runtime.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1980 matching lines...) Expand 10 before | Expand all | Expand 10 after
1991 /** 1991 /**
1992 * A JavaScript symbol (ECMA-262 edition 6) 1992 * A JavaScript symbol (ECMA-262 edition 6)
1993 * 1993 *
1994 * This is an experimental feature. Use at your own risk. 1994 * This is an experimental feature. Use at your own risk.
1995 */ 1995 */
1996 class V8_EXPORT Symbol : public Primitive { 1996 class V8_EXPORT Symbol : public Primitive {
1997 public: 1997 public:
1998 // Returns the print name string of the symbol, or undefined if none. 1998 // Returns the print name string of the symbol, or undefined if none.
1999 Local<Value> Name() const; 1999 Local<Value> Name() const;
2000 2000
2001 // Create a symbol. If data is not NULL, it will be used as a print name. 2001 // 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.
2002 static Local<Symbol> New( 2002 static Local<Symbol> New(
2003 Isolate *isolate, const char* data = NULL, int length = -1); 2003 Isolate *isolate, Local<String> name = Local<String>());
2004
2005 // TODO(rossberg): Add For method (and Global?).
2004 2006
2005 V8_INLINE static Symbol* Cast(v8::Value* obj); 2007 V8_INLINE static Symbol* Cast(v8::Value* obj);
2006 private: 2008 private:
2007 Symbol(); 2009 Symbol();
2008 static void CheckCast(v8::Value* obj); 2010 static void CheckCast(v8::Value* obj);
2009 }; 2011 };
2010 2012
2011 2013
2012 /** 2014 /**
2013 * A private symbol 2015 * A private symbol
2014 * 2016 *
2015 * This is an experimental feature. Use at your own risk. 2017 * This is an experimental feature. Use at your own risk.
2016 */ 2018 */
2017 class V8_EXPORT Private : public Data { 2019 class V8_EXPORT Private : public Data {
2018 public: 2020 public:
2019 // Returns the print name string of the private symbol, or undefined if none. 2021 // Returns the print name string of the private symbol, or undefined if none.
2020 Local<Value> Name() const; 2022 Local<Value> Name() const;
2021 2023
2022 // Create a private symbol. If data is not NULL, it will be the print name. 2024 // 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.
2023 static Local<Private> New(Isolate *isolate, 2025 static Local<Private> New(
2024 Local<String> name = Local<String>()); 2026 Isolate *isolate, Local<String> name = Local<String>());
2027
2028 // Retrieve a global private symbol. If a symbol with this name has not
2029 // been retrieved in the same isolate before, it is created.
2030 // Note that private symbols created this way are never collected, so
2031 // they should only be used for statically fixed properties.
2032 // Also, there is only one global name space for the names used as keys.
2033 // To minimize the potential for clashed, use qualified names as keys,
2034 // e.g., "Class#property".
2035 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
2025 2036
2026 private: 2037 private:
2027 Private(); 2038 Private();
2028 }; 2039 };
2029 2040
2030 2041
2031 /** 2042 /**
2032 * A JavaScript number value (ECMA-262, 4.3.20) 2043 * A JavaScript number value (ECMA-262, 4.3.20)
2033 */ 2044 */
2034 class V8_EXPORT Number : public Primitive { 2045 class V8_EXPORT Number : public Primitive {
(...skipping 4576 matching lines...) Expand 10 before | Expand all | Expand 10 after
6611 */ 6622 */
6612 6623
6613 6624
6614 } // namespace v8 6625 } // namespace v8
6615 6626
6616 6627
6617 #undef TYPE_CHECK 6628 #undef TYPE_CHECK
6618 6629
6619 6630
6620 #endif // V8_H_ 6631 #endif // V8_H_
OLDNEW
« 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