Rebel Fork Framework
Urho3D::BackgroundLoader Class Reference

#include <Urho3D/Resource/BackgroundLoader.h>

Inheritance diagram for Urho3D::BackgroundLoader:
Urho3D::RefCounted Urho3D::Thread

Public Member Functions

 BackgroundLoader (ResourceCache *owner)
 ~BackgroundLoader () override
 Destruct. Forcibly clear the load queue.
void ThreadFunction () override
 Resource background loading loop.
bool QueueResource (StringHash type, const ea::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.
 RefCounted (const RefCounted &rhs)=delete
 Prevent copy construction.
RefCountedoperator= (const RefCounted &rhs)=delete
 Prevent assignment.
int AddRef ()
int ReleaseRef ()
int Refs () const
int WeakRefs () const
RefCountRefCountPtr () const
 Return pointer to the reference count structure.
bool HasScriptObject () const
 Return true if script runtime object wrapping this native object exists.
bool IsScriptStrongRef () const
 Return true if script reference is strong.
- Public Member Functions inherited from Urho3D::Thread
 Thread (const ea::string &name=EMPTY_STRING)
 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.
void SetName (const ea::string &name)
 Set name of the platform thread on supported platforms. Must be called before Run().

Private Member Functions

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

Private Attributes

 Resource cache.
Mutex backgroundLoadMutex_
 Mutex for thread-safe access to the background load queue.
ea::unordered_map< ea::pair< StringHash, StringHash >, BackgroundLoadItembackgroundLoadQueue_
 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 ()
static bool IsMainThread ()
 Return whether is executing in the main thread.
- Static Protected Member Functions inherited from Urho3D::Thread
static void * ThreadFunctionStatic (void *data)
 Helper that executes Thread::ThreadFunction().
- Protected Attributes inherited from Urho3D::Thread
ea::string name_ {}
 Name of the thread. It will be propagated to underlying OS thread if possible.
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 file: