V8 Project
|
A stack-allocated class that governs a number of local handles. More...
#include <v8.h>
Public Member Functions | |
HandleScope (Isolate *isolate) | |
~HandleScope () | |
Isolate * | GetIsolate () const |
Static Public Member Functions | |
static int | NumberOfHandles (Isolate *isolate) |
Counts the number of allocated handles. More... | |
Protected Member Functions | |
HandleScope () | |
void | Initialize (Isolate *isolate) |
Static Protected Member Functions | |
static internal::Object ** | CreateHandle (internal::Isolate *isolate, internal::Object *value) |
Private Member Functions | |
HandleScope (const HandleScope &) | |
void | operator= (const HandleScope &) |
void * | operator new (size_t size) |
void | operator delete (void *, size_t) |
Static Private Member Functions | |
static internal::Object ** | CreateHandle (internal::HeapObject *heap_object, internal::Object *value) |
Private Attributes | |
internal::Isolate * | isolate_ |
internal::Object ** | prev_next_ |
internal::Object ** | prev_limit_ |
Friends | |
template<class F > | |
class | Local |
class | Object |
class | Context |
A stack-allocated class that governs a number of local handles.
After a handle scope has been created, all local handles will be allocated within that handle scope until either the handle scope is deleted or another handle scope is created. If there is already a handle scope and a new one is created, all allocations will take place in the new handle scope until it is deleted. After that, new handles will again be allocated in the original handle scope.
After the handle scope of a local handle has been deleted the garbage collector will no longer track the object stored in the handle and may deallocate it. The behavior of accessing a handle for which the handle scope has been deleted is undefined.
v8::HandleScope::HandleScope | ( | Isolate * | isolate | ) |
Definition at line 546 of file api.cc.
References Initialize().
v8::HandleScope::~HandleScope | ( | ) |
Definition at line 568 of file api.cc.
References v8::internal::HandleScope::CloseScope(), isolate_, prev_limit_, and prev_next_.
|
private |
|
staticprivate |
Definition at line 584 of file api.cc.
References v8::internal::HandleScope::CreateHandle(), DCHECK, and v8::internal::HeapObject::GetIsolate().
|
staticprotected |
Definition at line 579 of file api.cc.
References v8::internal::HandleScope::CreateHandle().
Referenced by v8::EscapableHandleScope::EscapableHandleScope(), v8::Context::GetEmbedderData(), v8::Object::GetInternalField(), v8::Handle< T >::New(), and v8::Local< T >::New().
|
inline |
Definition at line 813 of file v8.h.
Referenced by v8::EscapableHandleScope::Escape().
|
protected |
Definition at line 551 of file api.cc.
References v8::Utils::ApiCheck(), v8::internal::Isolate::handle_scope_data(), v8::Locker::IsActive(), v8::internal::ThreadManager::IsLockedByCurrentThread(), isolate_, v8::internal::HandleScopeData::level, v8::internal::HandleScopeData::limit, v8::internal::HandleScopeData::next, prev_limit_, prev_next_, and v8::internal::Isolate::thread_manager().
Referenced by v8::EscapableHandleScope::EscapableHandleScope(), and HandleScope().
Counts the number of allocated handles.
Definition at line 573 of file api.cc.
References v8::internal::HandleScope::NumberOfHandles().
|
private |
|
private |
|
private |
|
private |
Definition at line 837 of file v8.h.
Referenced by Initialize(), and ~HandleScope().
|
private |
Definition at line 839 of file v8.h.
Referenced by Initialize(), and ~HandleScope().
|
private |
Definition at line 838 of file v8.h.
Referenced by Initialize(), and ~HandleScope().