v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
v8::PropertyCallbackInfo< T > Class Template Reference

#include <v8-function-callback.h>

Collaboration diagram for v8::PropertyCallbackInfo< T >:

Public Member Functions

V8_INLINE IsolateGetIsolate () const
 
V8_INLINE Local< ValueData () const
 
V8_INLINE Local< ObjectThis () const
 
 V8_DEPRECATE_SOON ("V8 will stop providing access to hidden prototype (i.e. " "JSGlobalObject). Use HolderV2() instead. \n" "DO NOT try to workaround this by accessing JSGlobalObject via " "v8::Object::GetPrototype() - it'll be deprecated soon too. \n" "See http://crbug.com/333672197. ") V8_INLINE Local< Object > Holder() const
 
V8_INLINE Local< ObjectHolderV2 () const
 
V8_INLINE ReturnValue< TGetReturnValue () const
 
V8_INLINE bool ShouldThrowOnError () const
 

Private Member Functions

 PropertyCallbackInfo ()=default
 

Private Attributes

internal::Address args_ [kArgsLength]
 

Static Private Attributes

static constexpr int kPropertyKeyIndex = 0
 
static constexpr int kShouldThrowOnErrorIndex = 1
 
static constexpr int kHolderIndex = 2
 
static constexpr int kIsolateIndex = 3
 
static constexpr int kHolderV2Index = 4
 
static constexpr int kReturnValueIndex = 5
 
static constexpr int kDataIndex = 6
 
static constexpr int kThisIndex = 7
 
static constexpr int kArgsLength = 8
 
static constexpr int kSize = kArgsLength * internal::kApiSystemPointerSize
 

Friends

template<typename U >
class PropertyCallbackInfo
 
class MacroAssembler
 
class internal::PropertyCallbackArguments
 
class internal::CustomArguments< PropertyCallbackInfo >
 
void internal::PrintPropertyCallbackInfo (void *)
 

Detailed Description

template<typename T>
class v8::PropertyCallbackInfo< T >

The information passed to a property callback about the context of the property access.

Definition at line 24 of file v8-object.h.

Constructor & Destructor Documentation

◆ PropertyCallbackInfo()

template<typename T >
v8::PropertyCallbackInfo< T >::PropertyCallbackInfo ( )
privatedefault

Member Function Documentation

◆ Data()

template<typename T >
Local< Value > v8::PropertyCallbackInfo< T >::Data ( ) const
Returns
The data set in the configuration, i.e., in NamedPropertyHandlerConfiguration or IndexedPropertyHandlerConfiguration.

Definition at line 670 of file v8-function-callback.h.

Here is the call graph for this function:

◆ GetIsolate()

template<typename T >
Isolate * v8::PropertyCallbackInfo< T >::GetIsolate ( ) const
Returns
The isolate of the property access.

Definition at line 665 of file v8-function-callback.h.

Here is the caller graph for this function:

◆ GetReturnValue()

template<typename T >
ReturnValue< T > v8::PropertyCallbackInfo< T >::GetReturnValue ( ) const
Returns
The return value of the callback. Can be changed by calling Set().
info.GetReturnValue().Set(...)

Definition at line 702 of file v8-function-callback.h.

◆ HolderV2()

template<typename T >
Local< Object > v8::PropertyCallbackInfo< T >::HolderV2 ( ) const
Returns
The object in the prototype chain of the receiver that has the interceptor. Suppose you have x and its prototype is y, and y has an interceptor. Then info.This() is x and info.Holder() is y. In case the property is installed on the global object the Holder() would return the global proxy.

Definition at line 692 of file v8-function-callback.h.

Here is the call graph for this function:

◆ ShouldThrowOnError()

template<typename T >
bool v8::PropertyCallbackInfo< T >::ShouldThrowOnError ( ) const
Returns
True if the intercepted function should throw if an error occurs. Usually, true corresponds to ‘'use strict’`.
Note
Always false when intercepting Reflect.set() independent of the language mode.

Definition at line 707 of file v8-function-callback.h.

Here is the call graph for this function:

◆ This()

template<typename T >
Local< Object > v8::PropertyCallbackInfo< T >::This ( ) const
Returns
The receiver. In many cases, this is the object on which the property access was intercepted. When using Reflect.get, Function.prototype.call, or similar functions, it is the object passed in as receiver or thisArg.
void GetterCallback(Local<Name> name,
auto context = info.GetIsolate()->GetCurrentContext();
info.This()
->GetRealNamedProperty(context, v8_str("a"))
.ToLocalChecked();
info.Holder()
->GetRealNamedProperty(context, v8_str("a"))
.ToLocalChecked();
CHECK(v8_str("r")->Equals(context, a_this).FromJust());
CHECK(v8_str("obj")->Equals(context, a_holder).FromJust());
info.GetReturnValue().Set(name);
}
templ->InstanceTemplate()->SetHandler(
LocalContext env;
env->Global()
->Set(env.local(), v8_str("obj"), templ->GetFunction(env.local())
.ToLocalChecked()
->NewInstance(env.local())
.ToLocalChecked())
.FromJust();
CompileRun("obj.a = 'obj'; var r = {a: 'r'}; Reflect.get(obj, 'x', r)");
static Local< FunctionTemplate > New(Isolate *isolate, FunctionCallback callback=nullptr, Local< Value > data=Local< Value >(), Local< Signature > signature=Local< Signature >(), int length=0, ConstructorBehavior behavior=ConstructorBehavior::kAllow, SideEffectType side_effect_type=SideEffectType::kHasSideEffect, const CFunction *c_function=nullptr, uint16_t instance_type=0, uint16_t allowed_receiver_instance_type_range_start=0, uint16_t allowed_receiver_instance_type_range_end=0)
Definition api.cc:1101
#define CHECK(condition)
Definition logging.h:124

Definition at line 675 of file v8-function-callback.h.

Here is the call graph for this function:

◆ V8_DEPRECATE_SOON()

template<typename T >
v8::PropertyCallbackInfo< T >::V8_DEPRECATE_SOON ( "V8 will stop providing access to hidden prototype (i.e. " "JSGlobalObject). Use HolderV2() instead. \n" "DO NOT try to workaround this by accessing JSGlobalObject via " "v8::Object::GetPrototype() - it'll be deprecated soon too. \n" "See http://crbug.com/333672197. " ) const
Returns
The object in the prototype chain of the receiver that has the interceptor. Suppose you have x and its prototype is y, and y has an interceptor. Then info.This() is x and info.Holder() is y. The Holder() could be a hidden object (the global object, rather than the global proxy).
Note
For security reasons, do not pass the object back into the runtime.

Friends And Related Symbol Documentation

◆ internal::CustomArguments< PropertyCallbackInfo >

template<typename T >
friend class internal::CustomArguments< PropertyCallbackInfo >
friend

Definition at line 293 of file v8-function-callback.h.

◆ internal::PrintPropertyCallbackInfo

template<typename T >
void internal::PrintPropertyCallbackInfo ( void * )
friend

◆ internal::PropertyCallbackArguments

template<typename T >
friend class internal::PropertyCallbackArguments
friend

Definition at line 293 of file v8-function-callback.h.

◆ MacroAssembler

template<typename T >
friend class MacroAssembler
friend

Definition at line 292 of file v8-function-callback.h.

◆ PropertyCallbackInfo

template<typename T >
template<typename U >
friend class PropertyCallbackInfo
friend

Definition at line 291 of file v8-function-callback.h.

Member Data Documentation

◆ args_

template<typename T >
internal::Address v8::PropertyCallbackInfo< T >::args_[kArgsLength]
mutableprivate

Definition at line 311 of file v8-function-callback.h.

◆ kArgsLength

template<typename T >
int v8::PropertyCallbackInfo< T >::kArgsLength = 8
staticconstexprprivate

Definition at line 305 of file v8-function-callback.h.

◆ kDataIndex

template<typename T >
int v8::PropertyCallbackInfo< T >::kDataIndex = 6
staticconstexprprivate

Definition at line 303 of file v8-function-callback.h.

◆ kHolderIndex

template<typename T >
int v8::PropertyCallbackInfo< T >::kHolderIndex = 2
staticconstexprprivate

Definition at line 299 of file v8-function-callback.h.

◆ kHolderV2Index

template<typename T >
int v8::PropertyCallbackInfo< T >::kHolderV2Index = 4
staticconstexprprivate

Definition at line 301 of file v8-function-callback.h.

◆ kIsolateIndex

template<typename T >
int v8::PropertyCallbackInfo< T >::kIsolateIndex = 3
staticconstexprprivate

Definition at line 300 of file v8-function-callback.h.

◆ kPropertyKeyIndex

template<typename T >
int v8::PropertyCallbackInfo< T >::kPropertyKeyIndex = 0
staticconstexprprivate

Definition at line 297 of file v8-function-callback.h.

◆ kReturnValueIndex

template<typename T >
int v8::PropertyCallbackInfo< T >::kReturnValueIndex = 5
staticconstexprprivate

Definition at line 302 of file v8-function-callback.h.

◆ kShouldThrowOnErrorIndex

template<typename T >
int v8::PropertyCallbackInfo< T >::kShouldThrowOnErrorIndex = 1
staticconstexprprivate

Definition at line 298 of file v8-function-callback.h.

◆ kSize

template<typename T >
int v8::PropertyCallbackInfo< T >::kSize = kArgsLength * internal::kApiSystemPointerSize
staticconstexprprivate

Definition at line 307 of file v8-function-callback.h.

◆ kThisIndex

template<typename T >
int v8::PropertyCallbackInfo< T >::kThisIndex = 7
staticconstexprprivate

Definition at line 304 of file v8-function-callback.h.


The documentation for this class was generated from the following files: