Chromium Embedded Framework (CEF)  109.0.1+gcd5e37a+chromium-109.0.5414.8
CefV8Value Class Referenceabstract

Class representing a V8 value handle. More...

#include "include/cef_v8.h"

Inheritance diagram for CefV8Value:
CefBaseRefCounted

Public Types

typedef cef_v8_accesscontrol_t AccessControl
 
typedef cef_v8_propertyattribute_t PropertyAttribute
 

Public Member Functions

virtual bool IsValid ()=0
 Returns true if the underlying handle is valid and it can be accessed on the current thread. More...
 
virtual bool IsUndefined ()=0
 True if the value type is undefined. More...
 
virtual bool IsNull ()=0
 True if the value type is null. More...
 
virtual bool IsBool ()=0
 True if the value type is bool. More...
 
virtual bool IsInt ()=0
 True if the value type is int. More...
 
virtual bool IsUInt ()=0
 True if the value type is unsigned int. More...
 
virtual bool IsDouble ()=0
 True if the value type is double. More...
 
virtual bool IsDate ()=0
 True if the value type is Date. More...
 
virtual bool IsString ()=0
 True if the value type is string. More...
 
virtual bool IsObject ()=0
 True if the value type is object. More...
 
virtual bool IsArray ()=0
 True if the value type is array. More...
 
virtual bool IsArrayBuffer ()=0
 True if the value type is an ArrayBuffer. More...
 
virtual bool IsFunction ()=0
 True if the value type is function. More...
 
virtual bool IsPromise ()=0
 True if the value type is a Promise. More...
 
virtual bool IsSame (CefRefPtr< CefV8Value > that)=0
 Returns true if this object is pointing to the same handle as |that| object. More...
 
virtual bool GetBoolValue ()=0
 Return a bool value. More...
 
virtual int32 GetIntValue ()=0
 Return an int value. More...
 
virtual uint32 GetUIntValue ()=0
 Return an unsigned int value. More...
 
virtual double GetDoubleValue ()=0
 Return a double value. More...
 
virtual CefBaseTime GetDateValue ()=0
 Return a Date value. More...
 
virtual CefString GetStringValue ()=0
 Return a string value. More...
 
virtual bool IsUserCreated ()=0
 OBJECT METHODS - These methods are only available on objects. More...
 
virtual bool HasException ()=0
 Returns true if the last method call resulted in an exception. More...
 
virtual CefRefPtr< CefV8ExceptionGetException ()=0
 Returns the exception resulting from the last method call. More...
 
virtual bool ClearException ()=0
 Clears the last exception and returns true on success. More...
 
virtual bool WillRethrowExceptions ()=0
 Returns true if this object will re-throw future exceptions. More...
 
virtual bool SetRethrowExceptions (bool rethrow)=0
 Set whether this object will re-throw future exceptions. More...
 
virtual bool HasValue (const CefString &key)=0
 Returns true if the object has a value with the specified identifier. More...
 
virtual bool HasValue (int index)=0
 Returns true if the object has a value with the specified identifier. More...
 
virtual bool DeleteValue (const CefString &key)=0
 Deletes the value with the specified identifier and returns true on success. More...
 
virtual bool DeleteValue (int index)=0
 Deletes the value with the specified identifier and returns true on success. More...
 
virtual CefRefPtr< CefV8ValueGetValue (const CefString &key)=0
 Returns the value with the specified identifier on success. More...
 
virtual CefRefPtr< CefV8ValueGetValue (int index)=0
 Returns the value with the specified identifier on success. More...
 
virtual bool SetValue (const CefString &key, CefRefPtr< CefV8Value > value, PropertyAttribute attribute)=0
 Associates a value with the specified identifier and returns true on success. More...
 
virtual bool SetValue (int index, CefRefPtr< CefV8Value > value)=0
 Associates a value with the specified identifier and returns true on success. More...
 
virtual bool SetValue (const CefString &key, AccessControl settings, PropertyAttribute attribute)=0
 Registers an identifier and returns true on success. More...
 
virtual bool GetKeys (std::vector< CefString > &keys)=0
 Read the keys for the object's values into the specified vector. More...
 
virtual bool SetUserData (CefRefPtr< CefBaseRefCounted > user_data)=0
 Sets the user data for this object and returns true on success. More...
 
virtual CefRefPtr< CefBaseRefCountedGetUserData ()=0
 Returns the user data, if any, assigned to this object. More...
 
virtual int GetExternallyAllocatedMemory ()=0
 Returns the amount of externally allocated memory registered for the object. More...
 
virtual int AdjustExternallyAllocatedMemory (int change_in_bytes)=0
 Adjusts the amount of registered external memory for the object. More...
 
virtual int GetArrayLength ()=0
 Returns the number of elements in the array. More...
 
virtual CefRefPtr< CefV8ArrayBufferReleaseCallbackGetArrayBufferReleaseCallback ()=0
 Returns the ReleaseCallback object associated with the ArrayBuffer or NULL if the ArrayBuffer was not created with CreateArrayBuffer. More...
 
virtual bool NeuterArrayBuffer ()=0
 Prevent the ArrayBuffer from using it's memory block by setting the length to zero. More...
 
virtual CefString GetFunctionName ()=0
 Returns the function name. More...
 
virtual CefRefPtr< CefV8HandlerGetFunctionHandler ()=0
 Returns the function handler or NULL if not a CEF-created function. More...
 
virtual CefRefPtr< CefV8ValueExecuteFunction (CefRefPtr< CefV8Value > object, const CefV8ValueList &arguments)=0
 Execute the function using the current V8 context. More...
 
virtual CefRefPtr< CefV8ValueExecuteFunctionWithContext (CefRefPtr< CefV8Context > context, CefRefPtr< CefV8Value > object, const CefV8ValueList &arguments)=0
 Execute the function using the specified V8 context. More...
 
virtual bool ResolvePromise (CefRefPtr< CefV8Value > arg)=0
 Resolve the Promise using the current V8 context. More...
 
virtual bool RejectPromise (const CefString &errorMsg)=0
 Reject the Promise using the current V8 context. More...
 
- Public Member Functions inherited from CefBaseRefCounted
virtual void AddRef () const =0
 Called to increment the reference count for the object. More...
 
virtual bool Release () const =0
 Called to decrement the reference count for the object. More...
 
virtual bool HasOneRef () const =0
 Returns true if the reference count is 1. More...
 
virtual bool HasAtLeastOneRef () const =0
 Returns true if the reference count is at least 1. More...
 

Static Public Member Functions

static CefRefPtr< CefV8ValueCreateUndefined ()
 Create a new CefV8Value object of type undefined. More...
 
static CefRefPtr< CefV8ValueCreateNull ()
 Create a new CefV8Value object of type null. More...
 
static CefRefPtr< CefV8ValueCreateBool (bool value)
 Create a new CefV8Value object of type bool. More...
 
static CefRefPtr< CefV8ValueCreateInt (int32 value)
 Create a new CefV8Value object of type int. More...
 
static CefRefPtr< CefV8ValueCreateUInt (uint32 value)
 Create a new CefV8Value object of type unsigned int. More...
 
static CefRefPtr< CefV8ValueCreateDouble (double value)
 Create a new CefV8Value object of type double. More...
 
static CefRefPtr< CefV8ValueCreateDate (CefBaseTime date)
 Create a new CefV8Value object of type Date. More...
 
static CefRefPtr< CefV8ValueCreateString (const CefString &value)
 Create a new CefV8Value object of type string. More...
 
static CefRefPtr< CefV8ValueCreateObject (CefRefPtr< CefV8Accessor > accessor, CefRefPtr< CefV8Interceptor > interceptor)
 Create a new CefV8Value object of type object with optional accessor and/or interceptor. More...
 
static CefRefPtr< CefV8ValueCreateArray (int length)
 Create a new CefV8Value object of type array with the specified |length|. More...
 
static CefRefPtr< CefV8ValueCreateArrayBuffer (void *buffer, size_t length, CefRefPtr< CefV8ArrayBufferReleaseCallback > release_callback)
 Create a new CefV8Value object of type ArrayBuffer which wraps the provided |buffer| of size |length| bytes. More...
 
static CefRefPtr< CefV8ValueCreateFunction (const CefString &name, CefRefPtr< CefV8Handler > handler)
 Create a new CefV8Value object of type function. More...
 
static CefRefPtr< CefV8ValueCreatePromise ()
 Create a new CefV8Value object of type Promise. More...
 

Additional Inherited Members

- Protected Member Functions inherited from CefBaseRefCounted
virtual ~CefBaseRefCounted ()
 

Detailed Description

Class representing a V8 value handle.

V8 handles can only be accessed from the thread on which they are created. Valid threads for creating a V8 handle include the render process main thread (TID_RENDERER) and WebWorker threads. A task runner for posting tasks on the associated thread can be retrieved via the CefV8Context::GetTaskRunner() method.

Member Typedef Documentation

◆ AccessControl

◆ PropertyAttribute

Member Function Documentation

◆ AdjustExternallyAllocatedMemory()

virtual int CefV8Value::AdjustExternallyAllocatedMemory ( int  change_in_bytes)
pure virtual

Adjusts the amount of registered external memory for the object.

Used to give V8 an indication of the amount of externally allocated memory that is kept alive by JavaScript objects. V8 uses this information to decide when to perform global garbage collection. Each CefV8Value tracks the amount of external memory associated with it and automatically decreases the global total by the appropriate amount on its destruction. |change_in_bytes| specifies the number of bytes to adjust by. This method returns the number of bytes associated with the object after the adjustment. This method can only be called on user created objects.

◆ ClearException()

virtual bool CefV8Value::ClearException ( )
pure virtual

Clears the last exception and returns true on success.

◆ CreateArray()

static CefRefPtr<CefV8Value> CefV8Value::CreateArray ( int  length)
static

Create a new CefV8Value object of type array with the specified |length|.

If |length| is negative the returned array will have length 0. This method should only be called from within the scope of a CefRenderProcessHandler, CefV8Handler or CefV8Accessor callback, or in combination with calling Enter() and Exit() on a stored CefV8Context reference.

◆ CreateArrayBuffer()

static CefRefPtr<CefV8Value> CefV8Value::CreateArrayBuffer ( void *  buffer,
size_t  length,
CefRefPtr< CefV8ArrayBufferReleaseCallback release_callback 
)
static

Create a new CefV8Value object of type ArrayBuffer which wraps the provided |buffer| of size |length| bytes.

The ArrayBuffer is externalized, meaning that it does not own |buffer|. The caller is responsible for freeing |buffer| when requested via a call to CefV8ArrayBufferReleaseCallback::ReleaseBuffer. This method should only be called from within the scope of a CefRenderProcessHandler, CefV8Handler or CefV8Accessor callback, or in combination with calling Enter() and Exit() on a stored CefV8Context reference.

◆ CreateBool()

static CefRefPtr<CefV8Value> CefV8Value::CreateBool ( bool  value)
static

Create a new CefV8Value object of type bool.

◆ CreateDate()

static CefRefPtr<CefV8Value> CefV8Value::CreateDate ( CefBaseTime  date)
static

Create a new CefV8Value object of type Date.

This method should only be called from within the scope of a CefRenderProcessHandler, CefV8Handler or CefV8Accessor callback, or in combination with calling Enter() and Exit() on a stored CefV8Context reference.

◆ CreateDouble()

static CefRefPtr<CefV8Value> CefV8Value::CreateDouble ( double  value)
static

Create a new CefV8Value object of type double.

◆ CreateFunction()

static CefRefPtr<CefV8Value> CefV8Value::CreateFunction ( const CefString name,
CefRefPtr< CefV8Handler handler 
)
static

Create a new CefV8Value object of type function.

This method should only be called from within the scope of a CefRenderProcessHandler, CefV8Handler or CefV8Accessor callback, or in combination with calling Enter() and Exit() on a stored CefV8Context reference.

◆ CreateInt()

static CefRefPtr<CefV8Value> CefV8Value::CreateInt ( int32  value)
static

Create a new CefV8Value object of type int.

◆ CreateNull()

static CefRefPtr<CefV8Value> CefV8Value::CreateNull ( )
static

Create a new CefV8Value object of type null.

◆ CreateObject()

static CefRefPtr<CefV8Value> CefV8Value::CreateObject ( CefRefPtr< CefV8Accessor accessor,
CefRefPtr< CefV8Interceptor interceptor 
)
static

Create a new CefV8Value object of type object with optional accessor and/or interceptor.

This method should only be called from within the scope of a CefRenderProcessHandler, CefV8Handler or CefV8Accessor callback, or in combination with calling Enter() and Exit() on a stored CefV8Context reference.

◆ CreatePromise()

static CefRefPtr<CefV8Value> CefV8Value::CreatePromise ( )
static

Create a new CefV8Value object of type Promise.

This method should only be called from within the scope of a CefRenderProcessHandler, CefV8Handler or CefV8Accessor callback, or in combination with calling Enter() and Exit() on a stored CefV8Context reference.

◆ CreateString()

static CefRefPtr<CefV8Value> CefV8Value::CreateString ( const CefString value)
static

Create a new CefV8Value object of type string.

◆ CreateUInt()

static CefRefPtr<CefV8Value> CefV8Value::CreateUInt ( uint32  value)
static

Create a new CefV8Value object of type unsigned int.

◆ CreateUndefined()

static CefRefPtr<CefV8Value> CefV8Value::CreateUndefined ( )
static

Create a new CefV8Value object of type undefined.

◆ DeleteValue() [1/2]

virtual bool CefV8Value::DeleteValue ( const CefString key)
pure virtual

Deletes the value with the specified identifier and returns true on success.

Returns false if this method is called incorrectly or an exception is thrown. For read-only and don't-delete values this method will return true even though deletion failed.

◆ DeleteValue() [2/2]

virtual bool CefV8Value::DeleteValue ( int  index)
pure virtual

Deletes the value with the specified identifier and returns true on success.

Returns false if this method is called incorrectly, deletion fails or an exception is thrown. For read-only and don't-delete values this method will return true even though deletion failed.

◆ ExecuteFunction()

virtual CefRefPtr<CefV8Value> CefV8Value::ExecuteFunction ( CefRefPtr< CefV8Value object,
const CefV8ValueList arguments 
)
pure virtual

Execute the function using the current V8 context.

This method should only be called from within the scope of a CefV8Handler or CefV8Accessor callback, or in combination with calling Enter() and Exit() on a stored CefV8Context reference. |object| is the receiver ('this' object) of the function. If |object| is empty the current context's global object will be used. |arguments| is the list of arguments that will be passed to the function. Returns the function return value on success. Returns NULL if this method is called incorrectly or an exception is thrown.

◆ ExecuteFunctionWithContext()

virtual CefRefPtr<CefV8Value> CefV8Value::ExecuteFunctionWithContext ( CefRefPtr< CefV8Context context,
CefRefPtr< CefV8Value object,
const CefV8ValueList arguments 
)
pure virtual

Execute the function using the specified V8 context.

|object| is the receiver ('this' object) of the function. If |object| is empty the specified context's global object will be used. |arguments| is the list of arguments that will be passed to the function. Returns the function return value on success. Returns NULL if this method is called incorrectly or an exception is thrown.

◆ GetArrayBufferReleaseCallback()

virtual CefRefPtr<CefV8ArrayBufferReleaseCallback> CefV8Value::GetArrayBufferReleaseCallback ( )
pure virtual

Returns the ReleaseCallback object associated with the ArrayBuffer or NULL if the ArrayBuffer was not created with CreateArrayBuffer.

◆ GetArrayLength()

virtual int CefV8Value::GetArrayLength ( )
pure virtual

Returns the number of elements in the array.

◆ GetBoolValue()

virtual bool CefV8Value::GetBoolValue ( )
pure virtual

Return a bool value.

◆ GetDateValue()

virtual CefBaseTime CefV8Value::GetDateValue ( )
pure virtual

Return a Date value.

◆ GetDoubleValue()

virtual double CefV8Value::GetDoubleValue ( )
pure virtual

Return a double value.

◆ GetException()

virtual CefRefPtr<CefV8Exception> CefV8Value::GetException ( )
pure virtual

Returns the exception resulting from the last method call.

This attribute exists only in the scope of the current CEF value object.

◆ GetExternallyAllocatedMemory()

virtual int CefV8Value::GetExternallyAllocatedMemory ( )
pure virtual

Returns the amount of externally allocated memory registered for the object.

◆ GetFunctionHandler()

virtual CefRefPtr<CefV8Handler> CefV8Value::GetFunctionHandler ( )
pure virtual

Returns the function handler or NULL if not a CEF-created function.

◆ GetFunctionName()

virtual CefString CefV8Value::GetFunctionName ( )
pure virtual

Returns the function name.

◆ GetIntValue()

virtual int32 CefV8Value::GetIntValue ( )
pure virtual

Return an int value.

◆ GetKeys()

virtual bool CefV8Value::GetKeys ( std::vector< CefString > &  keys)
pure virtual

Read the keys for the object's values into the specified vector.

Integer- based keys will also be returned as strings.

◆ GetStringValue()

virtual CefString CefV8Value::GetStringValue ( )
pure virtual

Return a string value.

◆ GetUIntValue()

virtual uint32 CefV8Value::GetUIntValue ( )
pure virtual

Return an unsigned int value.

◆ GetUserData()

virtual CefRefPtr<CefBaseRefCounted> CefV8Value::GetUserData ( )
pure virtual

Returns the user data, if any, assigned to this object.

◆ GetValue() [1/2]

virtual CefRefPtr<CefV8Value> CefV8Value::GetValue ( const CefString key)
pure virtual

Returns the value with the specified identifier on success.

Returns NULL if this method is called incorrectly or an exception is thrown.

◆ GetValue() [2/2]

virtual CefRefPtr<CefV8Value> CefV8Value::GetValue ( int  index)
pure virtual

Returns the value with the specified identifier on success.

Returns NULL if this method is called incorrectly or an exception is thrown.

◆ HasException()

virtual bool CefV8Value::HasException ( )
pure virtual

Returns true if the last method call resulted in an exception.

This attribute exists only in the scope of the current CEF value object.

◆ HasValue() [1/2]

virtual bool CefV8Value::HasValue ( const CefString key)
pure virtual

Returns true if the object has a value with the specified identifier.

◆ HasValue() [2/2]

virtual bool CefV8Value::HasValue ( int  index)
pure virtual

Returns true if the object has a value with the specified identifier.

◆ IsArray()

virtual bool CefV8Value::IsArray ( )
pure virtual

True if the value type is array.

◆ IsArrayBuffer()

virtual bool CefV8Value::IsArrayBuffer ( )
pure virtual

True if the value type is an ArrayBuffer.

◆ IsBool()

virtual bool CefV8Value::IsBool ( )
pure virtual

True if the value type is bool.

◆ IsDate()

virtual bool CefV8Value::IsDate ( )
pure virtual

True if the value type is Date.

◆ IsDouble()

virtual bool CefV8Value::IsDouble ( )
pure virtual

True if the value type is double.

◆ IsFunction()

virtual bool CefV8Value::IsFunction ( )
pure virtual

True if the value type is function.

◆ IsInt()

virtual bool CefV8Value::IsInt ( )
pure virtual

True if the value type is int.

◆ IsNull()

virtual bool CefV8Value::IsNull ( )
pure virtual

True if the value type is null.

◆ IsObject()

virtual bool CefV8Value::IsObject ( )
pure virtual

True if the value type is object.

◆ IsPromise()

virtual bool CefV8Value::IsPromise ( )
pure virtual

True if the value type is a Promise.

◆ IsSame()

virtual bool CefV8Value::IsSame ( CefRefPtr< CefV8Value that)
pure virtual

Returns true if this object is pointing to the same handle as |that| object.

◆ IsString()

virtual bool CefV8Value::IsString ( )
pure virtual

True if the value type is string.

◆ IsUInt()

virtual bool CefV8Value::IsUInt ( )
pure virtual

True if the value type is unsigned int.

◆ IsUndefined()

virtual bool CefV8Value::IsUndefined ( )
pure virtual

True if the value type is undefined.

◆ IsUserCreated()

virtual bool CefV8Value::IsUserCreated ( )
pure virtual

OBJECT METHODS - These methods are only available on objects.

Arrays and functions are also objects. String- and integer-based keys can be used interchangably with the framework converting between them as necessary. Returns true if this is a user created object.

◆ IsValid()

virtual bool CefV8Value::IsValid ( )
pure virtual

Returns true if the underlying handle is valid and it can be accessed on the current thread.

Do not call any other methods if this method returns false.

◆ NeuterArrayBuffer()

virtual bool CefV8Value::NeuterArrayBuffer ( )
pure virtual

Prevent the ArrayBuffer from using it's memory block by setting the length to zero.

This operation cannot be undone. If the ArrayBuffer was created with CreateArrayBuffer then CefV8ArrayBufferReleaseCallback::ReleaseBuffer will be called to release the underlying buffer.

◆ RejectPromise()

virtual bool CefV8Value::RejectPromise ( const CefString errorMsg)
pure virtual

Reject the Promise using the current V8 context.

This method should only be called from within the scope of a CefV8Handler or CefV8Accessor callback, or in combination with calling Enter() and Exit() on a stored CefV8Context reference. Returns true on success. Returns false if this method is called incorrectly or an exception is thrown.

◆ ResolvePromise()

virtual bool CefV8Value::ResolvePromise ( CefRefPtr< CefV8Value arg)
pure virtual

Resolve the Promise using the current V8 context.

This method should only be called from within the scope of a CefV8Handler or CefV8Accessor callback, or in combination with calling Enter() and Exit() on a stored CefV8Context reference. |arg| is the argument passed to the resolved promise. Returns true on success. Returns false if this method is called incorrectly or an exception is thrown.

◆ SetRethrowExceptions()

virtual bool CefV8Value::SetRethrowExceptions ( bool  rethrow)
pure virtual

Set whether this object will re-throw future exceptions.

By default exceptions are not re-thrown. If a exception is re-thrown the current context should not be accessed again until after the exception has been caught and not re-thrown. Returns true on success. This attribute exists only in the scope of the current CEF value object.

◆ SetUserData()

virtual bool CefV8Value::SetUserData ( CefRefPtr< CefBaseRefCounted user_data)
pure virtual

Sets the user data for this object and returns true on success.

Returns false if this method is called incorrectly. This method can only be called on user created objects.

◆ SetValue() [1/3]

virtual bool CefV8Value::SetValue ( const CefString key,
AccessControl  settings,
PropertyAttribute  attribute 
)
pure virtual

Registers an identifier and returns true on success.

Access to the identifier will be forwarded to the CefV8Accessor instance passed to CefV8Value::CreateObject(). Returns false if this method is called incorrectly or an exception is thrown. For read-only values this method will return true even though assignment failed.

◆ SetValue() [2/3]

virtual bool CefV8Value::SetValue ( const CefString key,
CefRefPtr< CefV8Value value,
PropertyAttribute  attribute 
)
pure virtual

Associates a value with the specified identifier and returns true on success.

Returns false if this method is called incorrectly or an exception is thrown. For read-only values this method will return true even though assignment failed.

◆ SetValue() [3/3]

virtual bool CefV8Value::SetValue ( int  index,
CefRefPtr< CefV8Value value 
)
pure virtual

Associates a value with the specified identifier and returns true on success.

Returns false if this method is called incorrectly or an exception is thrown. For read-only values this method will return true even though assignment failed.

◆ WillRethrowExceptions()

virtual bool CefV8Value::WillRethrowExceptions ( )
pure virtual

Returns true if this object will re-throw future exceptions.

This attribute exists only in the scope of the current CEF value object.


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