Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** \mainpage V8 API Reference Guide | 5 /** \mainpage V8 API Reference Guide |
| 6 * | 6 * |
| 7 * V8 is Google's open source JavaScript engine. | 7 * V8 is Google's open source JavaScript engine. |
| 8 * | 8 * |
| 9 * This set of documents provides reference material generated from the | 9 * This set of documents provides reference material generated from the |
| 10 * V8 header file, include/v8.h. | 10 * V8 header file, include/v8.h. |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 96 class Script; | 96 class Script; |
| 97 class SharedArrayBuffer; | 97 class SharedArrayBuffer; |
| 98 class Signature; | 98 class Signature; |
| 99 class StartupData; | 99 class StartupData; |
| 100 class StackFrame; | 100 class StackFrame; |
| 101 class StackTrace; | 101 class StackTrace; |
| 102 class String; | 102 class String; |
| 103 class StringObject; | 103 class StringObject; |
| 104 class Symbol; | 104 class Symbol; |
| 105 class SymbolObject; | 105 class SymbolObject; |
| 106 class Private; | |
| 106 class Uint32; | 107 class Uint32; |
| 107 class Utils; | 108 class Utils; |
| 108 class Value; | 109 class Value; |
| 109 template <class T> class Local; | 110 template <class T> class Local; |
| 110 template <class T> | 111 template <class T> |
| 111 class MaybeLocal; | 112 class MaybeLocal; |
| 112 template <class T> class Eternal; | 113 template <class T> class Eternal; |
| 113 template<class T> class NonCopyablePersistentTraits; | 114 template<class T> class NonCopyablePersistentTraits; |
| 114 template<class T> class PersistentBase; | 115 template<class T> class PersistentBase; |
| 115 template <class T, class M = NonCopyablePersistentTraits<T> > | 116 template <class T, class M = NonCopyablePersistentTraits<T> > |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 304 template<class F> friend class PersistentBase; | 305 template<class F> friend class PersistentBase; |
| 305 template<class F, class M> friend class Persistent; | 306 template<class F, class M> friend class Persistent; |
| 306 template<class F> friend class Local; | 307 template<class F> friend class Local; |
| 307 template <class F> | 308 template <class F> |
| 308 friend class MaybeLocal; | 309 friend class MaybeLocal; |
| 309 template<class F> friend class FunctionCallbackInfo; | 310 template<class F> friend class FunctionCallbackInfo; |
| 310 template<class F> friend class PropertyCallbackInfo; | 311 template<class F> friend class PropertyCallbackInfo; |
| 311 friend class String; | 312 friend class String; |
| 312 friend class Object; | 313 friend class Object; |
| 313 friend class Context; | 314 friend class Context; |
| 315 friend class Private; | |
| 314 template<class F> friend class internal::CustomArguments; | 316 template<class F> friend class internal::CustomArguments; |
| 315 friend Local<Primitive> Undefined(Isolate* isolate); | 317 friend Local<Primitive> Undefined(Isolate* isolate); |
| 316 friend Local<Primitive> Null(Isolate* isolate); | 318 friend Local<Primitive> Null(Isolate* isolate); |
| 317 friend Local<Boolean> True(Isolate* isolate); | 319 friend Local<Boolean> True(Isolate* isolate); |
| 318 friend Local<Boolean> False(Isolate* isolate); | 320 friend Local<Boolean> False(Isolate* isolate); |
| 319 friend class HandleScope; | 321 friend class HandleScope; |
| 320 friend class EscapableHandleScope; | 322 friend class EscapableHandleScope; |
| 321 template <class F1, class F2, class F3> | 323 template <class F1, class F2, class F3> |
| 322 friend class PersistentValueMapBase; | 324 friend class PersistentValueMapBase; |
| 323 template<class F1, class F2> friend class PersistentValueVector; | 325 template<class F1, class F2> friend class PersistentValueVector; |
| (...skipping 2152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2476 | 2478 |
| 2477 V8_INLINE static Symbol* Cast(v8::Value* obj); | 2479 V8_INLINE static Symbol* Cast(v8::Value* obj); |
| 2478 | 2480 |
| 2479 private: | 2481 private: |
| 2480 Symbol(); | 2482 Symbol(); |
| 2481 static void CheckCast(v8::Value* obj); | 2483 static void CheckCast(v8::Value* obj); |
| 2482 }; | 2484 }; |
| 2483 | 2485 |
| 2484 | 2486 |
| 2485 /** | 2487 /** |
| 2488 * A private symbol | |
| 2489 * | |
| 2490 * This is an experimental feature. Use at your own risk. | |
| 2491 */ | |
| 2492 class V8_EXPORT Private : public Data { | |
| 2493 public: | |
| 2494 // Returns the print name string of the private symbol, or undefined if none. | |
| 2495 Local<Value> Name() const; | |
| 2496 | |
| 2497 // Create a private symbol. If name is not empty, it will be the description. | |
| 2498 static Local<Private> New(Isolate* isolate, | |
| 2499 Local<String> name = Local<String>()); | |
| 2500 | |
| 2501 // Retrieve a global private symbol. If a symbol with this name has not | |
| 2502 // been retrieved in the same isolate before, it is created. | |
| 2503 // Note that private symbols created this way are never collected, so | |
| 2504 // they should only be used for statically fixed properties. | |
| 2505 // Also, there is only one global name space for the names used as keys. | |
| 2506 // To minimize the potential for clashes, use qualified names as keys, | |
| 2507 // e.g., "Class#property". | |
| 2508 static Local<Private> ForApi(Isolate* isolate, Local<String> name); | |
| 2509 | |
| 2510 private: | |
| 2511 Private(); | |
| 2512 }; | |
| 2513 | |
| 2514 | |
| 2515 /** | |
| 2486 * A JavaScript number value (ECMA-262, 4.3.20) | 2516 * A JavaScript number value (ECMA-262, 4.3.20) |
| 2487 */ | 2517 */ |
| 2488 class V8_EXPORT Number : public Primitive { | 2518 class V8_EXPORT Number : public Primitive { |
| 2489 public: | 2519 public: |
| 2490 double Value() const; | 2520 double Value() const; |
| 2491 static Local<Number> New(Isolate* isolate, double value); | 2521 static Local<Number> New(Isolate* isolate, double value); |
| 2492 V8_INLINE static Number* Cast(v8::Value* obj); | 2522 V8_INLINE static Number* Cast(v8::Value* obj); |
| 2493 private: | 2523 private: |
| 2494 Number(); | 2524 Number(); |
| 2495 static void CheckCast(v8::Value* obj); | 2525 static void CheckCast(v8::Value* obj); |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2703 MaybeLocal<Value> data = MaybeLocal<Value>(), | 2733 MaybeLocal<Value> data = MaybeLocal<Value>(), |
| 2704 AccessControl settings = DEFAULT, | 2734 AccessControl settings = DEFAULT, |
| 2705 PropertyAttribute attribute = None); | 2735 PropertyAttribute attribute = None); |
| 2706 | 2736 |
| 2707 void SetAccessorProperty(Local<Name> name, Local<Function> getter, | 2737 void SetAccessorProperty(Local<Name> name, Local<Function> getter, |
| 2708 Local<Function> setter = Local<Function>(), | 2738 Local<Function> setter = Local<Function>(), |
| 2709 PropertyAttribute attribute = None, | 2739 PropertyAttribute attribute = None, |
| 2710 AccessControl settings = DEFAULT); | 2740 AccessControl settings = DEFAULT); |
| 2711 | 2741 |
| 2712 /** | 2742 /** |
| 2743 * Functionality for private properties. | |
| 2744 * This is an experimental feature, use at your own risk. | |
| 2745 * Note: Private properties are not inherited. Do not rely on this, since it | |
| 2746 * may change. | |
| 2747 */ | |
| 2748 Maybe<bool> HasPrivate(Local<Context> context, Local<Private> key); | |
| 2749 Maybe<bool> SetPrivate(Local<Context> context, Local<Private> key, | |
| 2750 Local<Value> value); | |
| 2751 Maybe<bool> DeletePrivate(Local<Context> context, Local<Private> key); | |
|
rossberg
2015/10/29 14:06:15
As discussed offline, if there is no real use case
| |
| 2752 MaybeLocal<Value> GetPrivate(Local<Context> context, Local<Private> key); | |
| 2753 | |
| 2754 /** | |
| 2713 * Returns an array containing the names of the enumerable properties | 2755 * Returns an array containing the names of the enumerable properties |
| 2714 * of this object, including properties from prototype objects. The | 2756 * of this object, including properties from prototype objects. The |
| 2715 * array returned by this method contains the same values as would | 2757 * array returned by this method contains the same values as would |
| 2716 * be enumerated by a for-in statement over this object. | 2758 * be enumerated by a for-in statement over this object. |
| 2717 */ | 2759 */ |
| 2718 V8_DEPRECATE_SOON("Use maybe version", Local<Array> GetPropertyNames()); | 2760 V8_DEPRECATE_SOON("Use maybe version", Local<Array> GetPropertyNames()); |
| 2719 V8_WARN_UNUSED_RESULT MaybeLocal<Array> GetPropertyNames( | 2761 V8_WARN_UNUSED_RESULT MaybeLocal<Array> GetPropertyNames( |
| 2720 Local<Context> context); | 2762 Local<Context> context); |
| 2721 | 2763 |
| 2722 /** | 2764 /** |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2870 | 2912 |
| 2871 /** | 2913 /** |
| 2872 * Returns the identity hash for this object. The current implementation | 2914 * Returns the identity hash for this object. The current implementation |
| 2873 * uses a hidden property on the object to store the identity hash. | 2915 * uses a hidden property on the object to store the identity hash. |
| 2874 * | 2916 * |
| 2875 * The return value will never be 0. Also, it is not guaranteed to be | 2917 * The return value will never be 0. Also, it is not guaranteed to be |
| 2876 * unique. | 2918 * unique. |
| 2877 */ | 2919 */ |
| 2878 int GetIdentityHash(); | 2920 int GetIdentityHash(); |
| 2879 | 2921 |
| 2880 /** | 2922 V8_DEPRECATE_SOON("Use v8::Object::SetPrivate instead.", |
| 2881 * Access hidden properties on JavaScript objects. These properties are | 2923 bool SetHiddenValue(Local<String> key, Local<Value> value)); |
| 2882 * hidden from the executing JavaScript and only accessible through the V8 | 2924 V8_DEPRECATE_SOON("Use v8::Object::GetHidden instead.", |
| 2883 * C++ API. Hidden properties introduced by V8 internally (for example the | 2925 Local<Value> GetHiddenValue(Local<String> key)); |
| 2884 * identity hash) are prefixed with "v8::". | 2926 V8_DEPRECATE_SOON("Use v8::Object::DeletePrivate instead.", |
| 2885 */ | 2927 bool DeleteHiddenValue(Local<String> key)); |
| 2886 // TODO(dcarney): convert these to take a isolate and optionally bailout? | |
| 2887 bool SetHiddenValue(Local<String> key, Local<Value> value); | |
| 2888 Local<Value> GetHiddenValue(Local<String> key); | |
| 2889 bool DeleteHiddenValue(Local<String> key); | |
| 2890 | 2928 |
| 2891 /** | 2929 /** |
| 2892 * Clone this object with a fast but shallow copy. Values will point | 2930 * Clone this object with a fast but shallow copy. Values will point |
| 2893 * to the same values as the original object. | 2931 * to the same values as the original object. |
| 2894 */ | 2932 */ |
| 2895 // TODO(dcarney): take an isolate and optionally bail out? | 2933 // TODO(dcarney): take an isolate and optionally bail out? |
| 2896 Local<Object> Clone(); | 2934 Local<Object> Clone(); |
| 2897 | 2935 |
| 2898 /** | 2936 /** |
| 2899 * Returns the context in which the object was created. | 2937 * Returns the context in which the object was created. |
| (...skipping 5533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8433 */ | 8471 */ |
| 8434 | 8472 |
| 8435 | 8473 |
| 8436 } // namespace v8 | 8474 } // namespace v8 |
| 8437 | 8475 |
| 8438 | 8476 |
| 8439 #undef TYPE_CHECK | 8477 #undef TYPE_CHECK |
| 8440 | 8478 |
| 8441 | 8479 |
| 8442 #endif // V8_H_ | 8480 #endif // V8_H_ |
| OLD | NEW |