*/
// INTERNAL INCLUDES
-#include <dali/internal/event/resources/resource-type-path-id-map.h>
+#include <dali/public-api/common/dali-vector.h>
#include <dali/internal/event/resources/resource-ticket.h>
+#include <dali/internal/event/images/context-recovery-interface.h>
#include <dali/internal/event/images/image-factory-cache.h>
namespace Dali
/**
* Issue a request which has already been registered with ImageFactory.
* If the associated Ticket is no longer alive ImageFactory issues a resource load request.
- * @param [in] req pointer to request
+ * @param [in] request Request to be loaded.
* @return intrusive pointer to image ticket. If Load fails, returned pointer is invalid. (!ret)
*/
- ResourceTicketPtr Load( ImageFactoryCache::Request* req );
+ ResourceTicketPtr Load( ImageFactoryCache::Request& request );
/**
* Tells ResourceManager to reload image from filesystem.
* This operation uses the originally requested attributes when reloading the image.
* @pre req must be registered with ImageFactory
* @note if image is still loading, no new load request will be issued
- * @param[in] requestPtr Request pointer
+ * @param[in] request Request to be reloaded.
* @return the ResourceTicket mapped to the request
*/
- ResourceTicketPtr Reload( ImageFactoryCache::Request* requestPtr );
+ ResourceTicketPtr Reload( ImageFactoryCache::Request& request );
/**
* Ensures all filesystem images are reloaded into textures.
void RecoverFromContextLoss();
/**
+ * Register an object into the context recovery list of the image factory.
+ * Thus its RecoverFromContextLoss() function would be called when the Stage regaining context.
+ * @param[in] object The object whose RecoverFromContextLoss() function needs to be called to regain the context.
+ */
+ void RegisterForContextRecovery( ContextRecoveryInterface* object );
+
+ /**
+ * Unregister an object from the context recovery list of the image factory
+ * @param[in] object The object whose RecoverFromContextLoss() function needs to be called to regain the context.
+ */
+ void UnregisterFromContextRecovery( ContextRecoveryInterface* object );
+
+ /**
* Get resource path used in request.
* @param [in] request of the image
* @return resource path
* @param [in] actual The actual attributes
* @return True if the attributes are compatible
*/
- bool CompareAttributes( const Dali::ImageAttributes& requested,
- const Dali::ImageAttributes& actual ) const;
+ bool CompareAttributes( const ImageAttributes& requested,
+ const ImageAttributes& actual ) const;
/**
* Inserts a new request to the request cache and url cache.
*/
ResourceTicketPtr IssueLoadRequest( const std::string& filename, const ImageAttributes* attributes );
+ /**
+ * Looks-up the hash of the string locator of the already-registered Request
+ * passed in.
+ * @param[in] request The image load request to return a locator string hash for.
+ * @return The hash of the locator string used in the request.
+ */
+ std::size_t GetHashForCachedRequest( const ImageFactoryCache::Request& request );
+
private:
- ResourceClient& mResourceClient;
- ImageFactoryCache::RequestPathHashMap mUrlCache; ///< A multimap of url hashes and request IDs
- ImageFactoryCache::RequestIdMap mRequestCache; ///< A map of request IDs and request information.
- ResourceTicketContainer mTicketsToRelease; ///< List of ticket handles
- float mMaxScale; ///< Defines maximum size difference between compatible resources
- ImageFactoryCache::RequestId mReqIdCurrent; ///< Internal counter for Request IDs
+ ResourceClient& mResourceClient;
+ ImageFactoryCache::RequestPathHashMap mUrlCache; ///< A multimap of url hashes and request IDs
+ ImageFactoryCache::RequestIdMap mRequestCache; ///< A map of request IDs and request information.
+ ResourceTicketContainer mTicketsToRelease; ///< List of ticket handles
+ Vector<ContextRecoveryInterface*> mContextRecoveryList; ///< List of the objects who needs context recovery
+ float mMaxScale; ///< Defines maximum size difference between compatible resources
+ ImageFactoryCache::RequestId mReqIdCurrent; ///< Internal counter for Request IDs
};
} // namespace Internal