Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Attributes | Protected Member Functions | Friends | List of all members
v8::String::ExternalStringResourceBase Class Reference

#include <v8-primitive.h>

Inheritance diagram for v8::String::ExternalStringResourceBase:
[legend]

Classes

class  SharedMemoryUsageRecorder
 

Public Member Functions

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
 

Static Public Attributes

static constexpr size_t kDefaultMemoryEstimate = static_cast<size_t>(-1)
 

Protected Member Functions

 ExternalStringResourceBase ()=default
 
virtual void Dispose ()
 
virtual void Lock () const
 
virtual void Unlock () const
 

Friends

class internal::ExternalString
 
class v8::String
 
class internal::StringForwardingTable
 
class internal::ScopedExternalStringLock
 

Constructor & Destructor Documentation

◆ ~ExternalStringResourceBase()

virtual v8::String::ExternalStringResourceBase::~ExternalStringResourceBase ( )
virtualdefault

◆ ExternalStringResourceBase() [1/2]

v8::String::ExternalStringResourceBase::ExternalStringResourceBase ( const ExternalStringResourceBase )
delete

◆ ExternalStringResourceBase() [2/2]

v8::String::ExternalStringResourceBase::ExternalStringResourceBase ( )
protecteddefault

Member Function Documentation

◆ Dispose()

virtual void v8::String::ExternalStringResourceBase::Dispose ( )
inlineprotectedvirtual

Internally V8 will call this Dispose method when the external string resource is no longer needed. The default implementation will use the delete operator. This method can be overridden in subclasses to control how allocated external string resources are disposed.

◆ EstimateMemoryUsage()

virtual size_t v8::String::ExternalStringResourceBase::EstimateMemoryUsage ( ) const
inlinevirtual

Returns an estimate of the memory occupied by this external string, to be used by V8 when producing a heap snapshot. If this function returns kDefaultMemoryEstimate, then V8 will estimate the external size based on the string length. This function should return only memory that is uniquely owned by this resource. If the resource has shared ownership of a secondary allocation, it can report that memory by implementing EstimateSharedMemoryUsage.

◆ EstimateSharedMemoryUsage()

virtual void v8::String::ExternalStringResourceBase::EstimateSharedMemoryUsage ( SharedMemoryUsageRecorder recorder) const
inlinevirtual

Estimates memory that this string resource may share with other string resources, to be used by V8 when producing a heap snapshot.

◆ IsCacheable()

virtual bool v8::String::ExternalStringResourceBase::IsCacheable ( ) const
inlinevirtual

If a string is cacheable, the value returned by ExternalStringResource::data() may be cached, otherwise it is not expected to be stable beyond the current top-level task.

◆ Lock()

virtual void v8::String::ExternalStringResourceBase::Lock ( ) const
inlineprotectedvirtual

For a non-cacheable string, the value returned by |ExternalStringResource::data()| has to be stable between |Lock()| and |Unlock()|, that is the string must behave as is |IsCacheable()| returned true.

These two functions must be thread-safe, and can be called from anywhere. They also must handle lock depth, in the sense that each can be called several times, from different threads, and unlocking should only happen when the balance of Lock() and Unlock() calls is 0.

◆ operator=()

void v8::String::ExternalStringResourceBase::operator= ( const ExternalStringResourceBase )
delete

◆ Unaccount()

virtual void v8::String::ExternalStringResourceBase::Unaccount ( Isolate isolate)
inlinevirtual

Internally V8 will call this Unaccount method when the external string resource should be unaccounted for. This method can be overridden in subclasses to control how allocated external bytes are accounted.

◆ Unlock()

virtual void v8::String::ExternalStringResourceBase::Unlock ( ) const
inlineprotectedvirtual

Unlocks the string.

Friends And Related Function Documentation

◆ internal::ExternalString

friend class internal::ExternalString
friend

◆ internal::ScopedExternalStringLock

friend class internal::ScopedExternalStringLock
friend

◆ internal::StringForwardingTable

friend class internal::StringForwardingTable
friend

◆ v8::String

friend class v8::String
friend

Member Data Documentation

◆ kDefaultMemoryEstimate

constexpr size_t v8::String::ExternalStringResourceBase::kDefaultMemoryEstimate = static_cast<size_t>(-1)
staticconstexpr

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