Public Member Functions | Protected Member Functions | Friends

gnash::GcResource Class Reference

Collectable resource. More...

#include <GC.h>

Inheritance diagram for gnash::GcResource:
Inheritance graph
[legend]

List of all members.

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

Detailed Description

Collectable resource.

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


Constructor & Destructor Documentation

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.


Member Function Documentation

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]

Friends And Related Function Documentation

friend class GC [friend]

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