Chromium Embedded Framework (CEF) 148.0.4+ga59e378+chromium-148.0.7778.40
CefV8BackingStore Class Referenceabstract

Class representing a V8 ArrayBuffer backing store. More...

#include "include/cef_v8.h"

Inheritance diagram for CefV8BackingStore:
CefBaseRefCounted

Public Member Functions

virtual void * Data ()=0
 Returns a pointer to the allocated memory, or nullptr if the backing store has been consumed or is otherwise invalid.
 
virtual size_t ByteLength ()=0
 Returns the size of the allocated memory in bytes, or 0 if the backing store has been consumed.
 
virtual bool IsValid ()=0
 Returns true if this backing store has not yet been consumed by CreateArrayBufferFromBackingStore().
 
- Public Member Functions inherited from CefBaseRefCounted
virtual void AddRef () const =0
 Called to increment the reference count for the object.
 
virtual bool Release () const =0
 Called to decrement the reference count for the object.
 
virtual bool HasOneRef () const =0
 Returns true if the reference count is 1.
 
virtual bool HasAtLeastOneRef () const =0
 Returns true if the reference count is at least 1.
 

Static Public Member Functions

static CefRefPtr< CefV8BackingStoreCreate (size_t byte_length)
 Create a new backing store with allocated memory of |byte_length| bytes.
 

Additional Inherited Members

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

Detailed Description

Class representing a V8 ArrayBuffer backing store.

The backing store holds the memory that backs an ArrayBuffer. It must be created on a thread with a valid V8 isolate (renderer main thread or WebWorker thread). Once created, the Data() pointer can be safely read/written from any thread. This allows expensive operations like memcpy to be performed on a background thread before creating the ArrayBuffer on the V8 thread.

The backing store is consumed when passed to CefV8Value::CreateArrayBufferFromBackingStore(), after which IsValid() returns false.

Member Function Documentation

◆ ByteLength()

virtual size_t CefV8BackingStore::ByteLength ( )
pure virtual

Returns the size of the allocated memory in bytes, or 0 if the backing store has been consumed.

◆ Create()

static CefRefPtr< CefV8BackingStore > CefV8BackingStore::Create ( size_t  byte_length)
static

Create a new backing store with allocated memory of |byte_length| bytes.

The memory is uninitialized. This method must be called on a thread with a valid V8 isolate. The returned object can safely be passed to other threads. Returns nullptr on failure.

◆ Data()

virtual void * CefV8BackingStore::Data ( )
pure virtual

Returns a pointer to the allocated memory, or nullptr if the backing store has been consumed or is otherwise invalid.

The pointer is safe to read/write from any thread. The caller must ensure all writes are complete before passing this object to CreateArrayBufferFromBackingStore(). Pointers obtained from this method should not be retained after calling CreateArrayBufferFromBackingStore(), as the memory will then be owned by the ArrayBuffer and subject to V8 garbage collection.

◆ IsValid()

virtual bool CefV8BackingStore::IsValid ( )
pure virtual

Returns true if this backing store has not yet been consumed by CreateArrayBufferFromBackingStore().


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