Collectable resource. More...
#include <GC.h>
Public Member Functions | |
GcResource () | |
Create a Garbage-collected resource. | |
void | setReachable () const |
Mark this resource as being reachable, possibly triggering further marking of all resources reachable by this object. | |
bool | isReachable () const |
Return true if this object is marked as reachable. | |
void | clearReachable () const |
Clear the reachable flag. | |
Protected Member Functions | |
virtual void | markReachableResources () const |
Scan all GC resources reachable by this instance. | |
virtual | ~GcResource () |
Delete this resource. | |
Friends | |
class | GC |
Collectable resource.
Instances of this class can be managed by a GC object.
gnash::GcResource::GcResource | ( | ) | [inline] |
Create a Garbage-collected resource.
The resource will be automatically registered with the garbage collector singleton.
References gnash::get().
virtual gnash::GcResource::~GcResource | ( | ) | [inline, protected, virtual] |
Delete this resource.
This is protected to allow subclassing, but ideally it sould be private, so only the GC is allowed to delete us.
void gnash::GcResource::clearReachable | ( | ) | const [inline] |
Clear the reachable flag.
bool gnash::GcResource::isReachable | ( | ) | const [inline] |
Return true if this object is marked as reachable.
Referenced by gnash::GC::addCollectable().
virtual void gnash::GcResource::markReachableResources | ( | ) | const [inline, protected, virtual] |
Scan all GC resources reachable by this instance.
This function is invoked everytime this object switches from unreachable to reachable, and is used to recursively mark all contained resources as reachable.
See setReachable(), which is the function to invoke against all reachable methods.
Feel free to assert(_reachable) in your implementation.
The default implementation doesn't mark anything.
Reimplemented in gnash::as_object, gnash::AVM1Global, gnash::DisplayObject, and gnash::Function.
References _.
Referenced by setReachable().
void gnash::GcResource::setReachable | ( | ) | const [inline] |
Mark this resource as being reachable, possibly triggering further marking of all resources reachable by this object.
If the object wasn't reachable before, this call triggers scan of all contained objects too...
References _, markReachableResources(), and gnash::typeName().
Referenced by gnash::MovieClip::getAsRoot(), gnash::Button::markOwnResources(), gnash::VM::markReachableResources(), gnash::Timer::markReachableResources(), gnash::NetStream_as::markReachableResources(), gnash::NetConnection_as::markReachableResources(), gnash::MouseButtonState::markReachableResources(), gnash::AVM1Global::markReachableResources(), gnash::ExecutableCode::markReachableResources(), gnash::drag_state::markReachableResources(), gnash::DisplayObject::markReachableResources(), gnash::CallFrame::markReachableResources(), gnash::BitmapData_as::setPixel(), gnash::XMLNode_as::setReachable(), gnash::ActiveRelay::setReachable(), gnash::DelayedFunctionCall::setReachable(), gnash::CharacterProxy::setReachable(), and gnash::as_value::setReachable().
friend class GC [friend] |