X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fresourcemanager.h;h=9dcd9b997a56a25214ea691d27f2f616197ae55f;hp=5cc427f729cabaa4ec15eec927283d38297f4a68;hb=f141ae14619bfbd51a7e6871c55edbdd17ac3417;hpb=5f84c8caeb789571503b5491f941c8ec31b700fe diff --git a/source/resourcemanager.h b/source/resourcemanager.h index 5cc427f7..9dcd9b99 100644 --- a/source/resourcemanager.h +++ b/source/resourcemanager.h @@ -11,11 +11,12 @@ namespace Msp { namespace GL { -class ResourceWatcher; +class ResourceObserver; class resource_load_error: public std::runtime_error { public: + resource_load_error(const std::string &, const std::string &); resource_load_error(const std::string &, const std::exception &); virtual ~resource_load_error() throw() { } }; @@ -55,12 +56,13 @@ private: Resource *resource; ResourceLocation location; + bool load_priority; IO::Seekable *io; Resource::AsyncLoader *loader; State state; unsigned last_used; UInt64 data_size; - std::vector watchers; + std::vector observers; ManagedResource(Resource &); @@ -70,8 +72,8 @@ private: void finish_loading(); void unload(); - void add_watcher(ResourceWatcher &); - void remove_watcher(ResourceWatcher &); + void add_observer(ResourceObserver &); + void remove_observer(ResourceObserver &); }; typedef std::list LoadQueue; @@ -86,6 +88,8 @@ private: unsigned capacity; unsigned size; std::list error_queue; + Mutex data_size_mutex; + UInt64 loaded_data_size; volatile bool done; public: @@ -104,6 +108,7 @@ private: public: bool sync(); bool needs_work() const { return size