Background loader of resources. Owned by the ResourceCache. More...

#include <BackgroundLoader.h>

Inheritance diagram for Urho3D::BackgroundLoader:
[legend]
Collaboration diagram for Urho3D::BackgroundLoader:
[legend]

Public Member Functions

 BackgroundLoader (ResourceCache *owner)
 Construct.
 
virtual void ThreadFunction ()
 Resource background loading loop.
 
bool QueueResource (StringHash type, const String &name, bool sendEventOnFailure, Resource *caller)
 Queue loading of a resource. The name must be sanitated to ensure consistent format. Return true if queued (not a duplicate and resource was a known type).
 
void WaitForResource (StringHash type, StringHash nameHash)
 Wait and finish possible loading of a resource when being requested from the cache.
 
void FinishResources (int maxMs)
 Process resources that are ready to finish.
 
unsigned GetNumQueuedResources () const
 Return amount of resources in the load queue.
 
- Public Member Functions inherited from Urho3D::RefCounted
 RefCounted ()
 Construct. Allocate the reference count structure and set an initial self weak reference.
 
virtual ~RefCounted ()
 Destruct. Mark as expired and also delete the reference count structure if no outside weak references exist.
 
void AddRef ()
 Increment reference count. Can also be called outside of a SharedPtr for traditional reference counting.
 
void ReleaseRef ()
 Decrement reference count and delete self if no more references. Can also be called outside of a SharedPtr for traditional reference counting.
 
int Refs () const
 Return reference count.
 
int WeakRefs () const
 Return weak reference count.
 
RefCountRefCountPtr ()
 Return pointer to the reference count structure.
 
- Public Member Functions inherited from Urho3D::Thread
 Thread ()
 Construct. Does not start the thread yet.
 
virtual ~Thread ()
 Destruct. If running, stop and wait for thread to finish.
 
bool Run ()
 Start running the thread. Return true if successful, or false if already running or if can not create the thread.
 
void Stop ()
 Set the running flag to false and wait for the thread to finish.
 
void SetPriority (int priority)
 Set thread priority. The thread must have been started first.
 
bool IsStarted () const
 Return whether thread exists.
 

Private Member Functions

void FinishBackgroundLoading (BackgroundLoadItem &item)
 Finish one background loaded resource.
 

Private Attributes

ResourceCacheowner_
 Resource cache.
 
Mutex backgroundLoadMutex_
 Mutex for thread-safe access to the background load queue.
 
HashMap< Pair< StringHash,
StringHash >
, BackgroundLoadItem
backgroundLoadQueue_
 Resources that are queued for background loading.
 

Additional Inherited Members

- Static Public Member Functions inherited from Urho3D::Thread
static void SetMainThread ()
 Set the current thread as the main thread.
 
static ThreadID GetCurrentThreadID ()
 Return the current thread's ID.
 
static bool IsMainThread ()
 Return whether is executing in the main thread.
 
- Protected Attributes inherited from Urho3D::Thread
void * handle_
 Thread handle.
 
volatile bool shouldRun_
 Running flag.
 
- Static Protected Attributes inherited from Urho3D::Thread
static ThreadID mainThreadID
 Main thread's thread ID.
 

Detailed Description

Background loader of resources. Owned by the ResourceCache.


The documentation for this class was generated from the following files:
  • /home/travis/build/urho3d/Urho3D/Source/Urho3D/Resource/BackgroundLoader.h
  • /home/travis/build/urho3d/Urho3D/Source/Urho3D/Resource/BackgroundLoader.cpp