v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
v8::String::ExternalOneByteStringResource Class Referenceabstract

#include <v8-primitive.h>

Inheritance diagram for v8::String::ExternalOneByteStringResource:
Collaboration diagram for v8::String::ExternalOneByteStringResource:

Public Member Functions

 ~ExternalOneByteStringResource () override=default
 
virtual const char * data () const =0
 
virtual size_t length () const =0
 
const char * cached_data () const
 
void UpdateDataCache ()
 
- Public Member Functions inherited from v8::String::ExternalStringResourceBase
virtual ~ExternalStringResourceBase ()=default
 
virtual bool IsCacheable () const
 
virtual void Unaccount (Isolate *isolate)
 
virtual size_t EstimateMemoryUsage () const
 
virtual void EstimateSharedMemoryUsage (SharedMemoryUsageRecorder *recorder) const
 
 ExternalStringResourceBase (const ExternalStringResourceBase &)=delete
 
void operator= (const ExternalStringResourceBase &)=delete
 

Protected Member Functions

 ExternalOneByteStringResource ()=default
 
- Protected Member Functions inherited from v8::String::ExternalStringResourceBase
 ExternalStringResourceBase ()=default
 
virtual void Dispose ()
 
virtual void Lock () const
 
virtual void Unlock () const
 

Private Member Functions

void CheckCachedDataInvariants () const
 

Private Attributes

const char * cached_data_ = nullptr
 

Additional Inherited Members

- Static Public Attributes inherited from v8::String::ExternalStringResourceBase
static constexpr size_t kDefaultMemoryEstimate = static_cast<size_t>(-1)
 

Detailed Description

An ExternalOneByteStringResource is a wrapper around an one-byte string buffer that resides outside V8's heap. Implement an ExternalOneByteStringResource to manage the life cycle of the underlying buffer. Note that the string data must be immutable and that the data must be Latin-1 and not UTF-8, which would require special treatment internally in the engine and do not allow efficient indexing. Use String::New or convert to 16 bit data for non-Latin1.

Definition at line 444 of file v8-primitive.h.

Constructor & Destructor Documentation

◆ ~ExternalOneByteStringResource()

v8::String::ExternalOneByteStringResource::~ExternalOneByteStringResource ( )
overridedefault

Override the destructor to manage the life cycle of the underlying buffer.

◆ ExternalOneByteStringResource()

v8::String::ExternalOneByteStringResource::ExternalOneByteStringResource ( )
protecteddefault

Member Function Documentation

◆ cached_data()

const char * v8::String::ExternalOneByteStringResource::cached_data ( ) const
inline

Returns the cached data from the underlying buffer. If the resource is uncacheable or if UpdateDataCache() was not called before, it has undefined behaviour.

Definition at line 467 of file v8-primitive.h.

◆ CheckCachedDataInvariants()

void v8::String::ExternalOneByteStringResource::CheckCachedDataInvariants ( ) const
private

Definition at line 6163 of file api.cc.

◆ data()

virtual const char * v8::String::ExternalOneByteStringResource::data ( ) const
pure virtual

The string data from the underlying buffer. If the resource is cacheable then data() must return the same value for all invocations.

Implemented in v8::ExternalOwningOneByteStringResource.

Here is the caller graph for this function:

◆ length()

virtual size_t v8::String::ExternalOneByteStringResource::length ( ) const
pure virtual

The number of Latin-1 characters in the string.

Implemented in v8::ExternalOwningOneByteStringResource.

Here is the caller graph for this function:

◆ UpdateDataCache()

void v8::String::ExternalOneByteStringResource::UpdateDataCache ( )

Update {cached_data_} with the data from the underlying buffer. This can be called only for cacheable resources.

Definition at line 6158 of file api.cc.

Member Data Documentation

◆ cached_data_

const char* v8::String::ExternalOneByteStringResource::cached_data_ = nullptr
private

Definition at line 484 of file v8-primitive.h.


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