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

Side by Side Diff: include/v8.h

Issue 2807333003: [api] Add DefineProperty() method that skips interceptors.
Patch Set: Previous commit with rebasing Created 3 years, 7 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
« no previous file with comments | « no previous file | src/api.cc » ('j') | no next file with comments »
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 // 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 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 // Calling SetSecondPassCallback on the second pass will immediately crash. 449 // Calling SetSecondPassCallback on the second pass will immediately crash.
450 void SetSecondPassCallback(Callback callback) const { *callback_ = callback; } 450 void SetSecondPassCallback(Callback callback) const { *callback_ = callback; }
451 451
452 private: 452 private:
453 Isolate* isolate_; 453 Isolate* isolate_;
454 T* parameter_; 454 T* parameter_;
455 Callback* callback_; 455 Callback* callback_;
456 void* embedder_fields_[kEmbedderFieldsInWeakCallback]; 456 void* embedder_fields_[kEmbedderFieldsInWeakCallback];
457 }; 457 };
458 458
459
460 // kParameter will pass a void* parameter back to the callback, kInternalFields 459 // kParameter will pass a void* parameter back to the callback, kInternalFields
461 // will pass the first two internal fields back to the callback, kFinalizer 460 // will pass the first two internal fields back to the callback, kFinalizer
462 // will pass a void* parameter back, but is invoked before the object is 461 // will pass a void* parameter back, but is invoked before the object is
463 // actually collected, so it can be resurrected. In the last case, it is not 462 // actually collected, so it can be resurrected. In the last case, it is not
464 // possible to request a second pass callback. 463 // possible to request a second pass callback.
465 enum class WeakCallbackType { kParameter, kInternalFields, kFinalizer }; 464 enum class WeakCallbackType { kParameter, kInternalFields, kFinalizer };
466 465
467 /** 466 /**
468 * An object reference that is independent of any handle scope. Where 467 * An object reference that is independent of any handle scope. Where
469 * a Local handle only lives as long as the HandleScope in which it was 468 * a Local handle only lives as long as the HandleScope in which it was
(...skipping 2513 matching lines...) Expand 10 before | Expand all | Expand 10 after
2983 * kSkipIndices will exclude integer indicies from being collected. 2982 * kSkipIndices will exclude integer indicies from being collected.
2984 */ 2983 */
2985 enum class IndexFilter { kIncludeIndices, kSkipIndices }; 2984 enum class IndexFilter { kIncludeIndices, kSkipIndices };
2986 2985
2987 /** 2986 /**
2988 * Integrity level for objects. 2987 * Integrity level for objects.
2989 */ 2988 */
2990 enum class IntegrityLevel { kFrozen, kSealed }; 2989 enum class IntegrityLevel { kFrozen, kSealed };
2991 2990
2992 /** 2991 /**
2992 * DONT_SKIP_INTERCEPTORS is the default behaviour and triggers the definer
2993 * interceptor when setting an own property on an object using
2994 * DefineProperty, while SKIP_INTERCEPTORS bypasses the interceptors.
2995 */
2996 enum CallInterceptors { DONT_SKIP_INTERCEPTORS, SKIP_INTERCEPTORS };
jochen (gone - plz use gerrit) 2017/05/29 19:45:38 please use enum class CallInterceptors { kSkip, kD
2997
2998 /**
2993 * A JavaScript object (ECMA-262, 4.3.3) 2999 * A JavaScript object (ECMA-262, 4.3.3)
2994 */ 3000 */
2995 class V8_EXPORT Object : public Value { 3001 class V8_EXPORT Object : public Value {
2996 public: 3002 public:
2997 V8_DEPRECATE_SOON("Use maybe version", 3003 V8_DEPRECATE_SOON("Use maybe version",
2998 bool Set(Local<Value> key, Local<Value> value)); 3004 bool Set(Local<Value> key, Local<Value> value));
2999 V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, 3005 V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
3000 Local<Value> key, Local<Value> value); 3006 Local<Value> key, Local<Value> value);
3001 3007
3002 V8_DEPRECATE_SOON("Use maybe version", 3008 V8_DEPRECATE_SOON("Use maybe version",
(...skipping 16 matching lines...) Expand all
3019 Local<Value> value); 3025 Local<Value> value);
3020 3026
3021 // Implements DefineOwnProperty. 3027 // Implements DefineOwnProperty.
3022 // 3028 //
3023 // In general, CreateDataProperty will be faster, however, does not allow 3029 // In general, CreateDataProperty will be faster, however, does not allow
3024 // for specifying attributes. 3030 // for specifying attributes.
3025 // 3031 //
3026 // Returns true on success. 3032 // Returns true on success.
3027 V8_WARN_UNUSED_RESULT Maybe<bool> DefineOwnProperty( 3033 V8_WARN_UNUSED_RESULT Maybe<bool> DefineOwnProperty(
3028 Local<Context> context, Local<Name> key, Local<Value> value, 3034 Local<Context> context, Local<Name> key, Local<Value> value,
3029 PropertyAttribute attributes = None); 3035 PropertyAttribute attributes = None,
3036 CallInterceptors call_interceptors = DONT_SKIP_INTERCEPTORS);
3030 3037
3031 // Implements Object.DefineProperty(O, P, Attributes), see Ecma-262 19.1.2.4. 3038 // Implements Object.DefineProperty(O, P, Attributes), see Ecma-262 19.1.2.4.
3032 // 3039 //
3033 // The defineProperty function is used to add an own property or 3040 // The defineProperty function is used to add an own property or
3034 // update the attributes of an existing own property of an object. 3041 // update the attributes of an existing own property of an object.
3035 // 3042 //
3036 // Both data and accessor descriptors can be used. 3043 // Both data and accessor descriptors can be used.
3037 // 3044 //
3038 // In general, CreateDataProperty is faster, however, does not allow 3045 // In general, CreateDataProperty is faster, however, does not allow
3039 // for specifying attributes or an accessor descriptor. 3046 // for specifying attributes or an accessor descriptor.
3040 // 3047 //
3041 // The PropertyDescriptor can change when redefining a property. 3048 // The PropertyDescriptor can change when redefining a property.
3042 // 3049 //
3050 // CallInterceptors call_interceptors = SKIP_INTERCEPTORS
3051 // bypasses interceptors when setting property on an object.
3052 //
3043 // Returns true on success. 3053 // Returns true on success.
3044 V8_WARN_UNUSED_RESULT Maybe<bool> DefineProperty( 3054 V8_WARN_UNUSED_RESULT Maybe<bool> DefineProperty(
3045 Local<Context> context, Local<Name> key, PropertyDescriptor& descriptor); 3055 Local<Context> context, Local<Name> key, PropertyDescriptor& descriptor,
3056 CallInterceptors call_interceptors = DONT_SKIP_INTERCEPTORS);
3046 3057
3047 // Sets an own property on this object bypassing interceptors and 3058 // Sets an own property on this object bypassing interceptors and
3048 // overriding accessors or read-only properties. 3059 // overriding accessors or read-only properties.
3049 // 3060 //
3050 // Note that if the object has an interceptor the property will be set 3061 // Note that if the object has an interceptor the property will be set
3051 // locally, but since the interceptor takes precedence the local property 3062 // locally, but since the interceptor takes precedence the local property
3052 // will only be returned if the interceptor doesn't return a value. 3063 // will only be returned if the interceptor doesn't return a value.
3053 // 3064 //
3054 // Note also that this only works for named properties. 3065 // Note also that this only works for named properties.
3055 V8_DEPRECATED("Use CreateDataProperty / DefineOwnProperty", 3066 V8_DEPRECATED("Use CreateDataProperty / DefineOwnProperty",
(...skipping 7084 matching lines...) Expand 10 before | Expand all | Expand 10 after
10140 */ 10151 */
10141 10152
10142 10153
10143 } // namespace v8 10154 } // namespace v8
10144 10155
10145 10156
10146 #undef TYPE_CHECK 10157 #undef TYPE_CHECK
10147 10158
10148 10159
10149 #endif // INCLUDE_V8_H_ 10160 #endif // INCLUDE_V8_H_
OLDNEW
« 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