Gnash  0.8.11dev
Public Member Functions | Protected Member Functions | Friends | List of all members
gnash::GcResource Class Reference

Collectable resource. More...

#include <GC.h>

Inheritance diagram for gnash::GcResource:
gnash::as_object gnash::DisplayObject gnash::abc::as_class gnash::as_function gnash::Global_as gnash::GtkExt gnash::Bitmap gnash::InteractiveObject gnash::MorphShape gnash::Shape gnash::StaticText gnash::Video

Public Member Functions

 GcResource (GC &gc)
 Create a Garbage-collected resource associated with a GC. More...
 
void setReachable () const
 Mark this resource as being reachable. More...
 
bool isReachable () const
 Return true if this object is marked as reachable. More...
 
void clearReachable () const
 Clear the reachable flag. More...
 

Protected Member Functions

virtual void markReachableResources () const
 Scan all GC resources reachable by this instance. More...
 
virtual ~GcResource ()
 Delete this resource. More...
 

Friends

class GC
 

Detailed Description

Collectable resource.

Instances of this class can be managed by a GC object.

Constructor & Destructor Documentation

§ GcResource()

gnash::GcResource::GcResource ( GC gc)
inline

Create a Garbage-collected resource associated with a GC.

Parameters
gcThe GC to register the resource with.

References gnash::GC::addCollectable().

§ ~GcResource()

virtual gnash::GcResource::~GcResource ( )
inlineprotectedvirtual

Delete this resource.

This is protected to allow subclassing, but ideally it sould be private, so only the GC is allowed to delete us.

Member Function Documentation

§ clearReachable()

void gnash::GcResource::clearReachable ( ) const
inline

Clear the reachable flag.

Referenced by gnash::GC::~GC().

§ isReachable()

bool gnash::GcResource::isReachable ( ) const
inline

Return true if this object is marked as reachable.

Referenced by gnash::GC::addCollectable(), and gnash::GC::~GC().

§ markReachableResources()

virtual void gnash::GcResource::markReachableResources ( ) const
inlineprotectedvirtual

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::DisplayObject, gnash::as_object, gnash::Function, and gnash::Global_as.

References _, gnash::log_debug(), and gnash::typeName().

§ setReachable()

void gnash::GcResource::setReachable ( ) const
inline

Friends And Related Function Documentation

§ GC

friend class GC
friend

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