Refactor ImageFactory file path to hash lookup 41/31141/7
authorAndrew Cox <andrew.cox@partner.samsung.com>
Mon, 1 Dec 2014 21:57:21 +0000 (21:57 +0000)
committerAndrew Cox <andrew.cox@partner.samsung.com>
Tue, 2 Dec 2014 15:32:53 +0000 (15:32 +0000)
Also beefs-up some documentation around resource loading.

Change-Id: Ifd6b240a700ee0b57d29c8a6f95a1186cff84d7e
Signed-off-by: Andrew Cox <andrew.cox@partner.samsung.com>
automated-tests/src/dali-internal/utc-Dali-Internal-ImageFactory.cpp
dali/integration-api/resource-declarations.h
dali/internal/event/images/image-factory-cache.h
dali/internal/event/images/image-factory.cpp
dali/internal/event/images/image-factory.h
dali/internal/event/images/image-impl.cpp
dali/internal/event/resources/resource-ticket.h

index 59bc9ad..fe2a488 100644 (file)
@@ -153,22 +153,22 @@ int UtcDaliImageFactoryUseCachedRequest03(void)
   ImageFactory& imageFactory  = Internal::ThreadLocalStorage::Get().GetImageFactory();
 
   RequestPtr req = imageFactory.RegisterRequest( gTestImageFilename, NULL );
-  ResourceTicketPtr ticket = imageFactory.Load( req.Get() );
+  ResourceTicketPtr ticket = imageFactory.Load( *req.Get() );
 
   RequestPtr req2 = imageFactory.RegisterRequest( gTestImageFilename, NULL );
-  ResourceTicketPtr ticket2 = imageFactory.Load( req2.Get() );
+  ResourceTicketPtr ticket2 = imageFactory.Load( *req2.Get() );
   DALI_TEST_EQUALS( req, req2, TEST_LOCATION );
   DALI_TEST_EQUALS( ticket, ticket2, TEST_LOCATION );
 
   req2 = imageFactory.RegisterRequest( gTestImageFilename, NULL );
-  ResourceTicketPtr ticket3 = imageFactory.Load( req2.Get() );
+  ResourceTicketPtr ticket3 = imageFactory.Load( *req2.Get() );
   DALI_TEST_EQUALS( req, req2, TEST_LOCATION );
   DALI_TEST_EQUALS( ticket, ticket3, TEST_LOCATION );
 
   // request differs in scaled size - not default size
   ImageAttributes attr = ImageAttributes::New( 80, 160, Pixel::BGR8888 );
   req2 = imageFactory.RegisterRequest( gTestImageFilename, &attr );
-  ResourceTicketPtr ticket4 = imageFactory.Load( req2.Get() );
+  ResourceTicketPtr ticket4 = imageFactory.Load( *req2.Get() );
   DALI_TEST_CHECK( req != req2 );
   END_TEST;
 }
@@ -203,7 +203,7 @@ int UtcDaliImageFactoryCompatibleResource01(void)
 
   // request with default attributes ( size is 0,0 )
   RequestPtr req = imageFactory.RegisterRequest( gTestImageFilename, NULL );
-  ResourceTicketPtr ticket = imageFactory.Load( req.Get() );
+  ResourceTicketPtr ticket = imageFactory.Load( *req.Get() );
 
   application.SendNotification();
   application.Render();
@@ -216,7 +216,7 @@ int UtcDaliImageFactoryCompatibleResource01(void)
   ImageAttributes attr = ImageAttributes::New();
   attr.SetSize( 80, 80 );
   RequestPtr req2 = imageFactory.RegisterRequest( gTestImageFilename, &attr );
-  ResourceTicketPtr ticket2 = imageFactory.Load( req2.Get() );
+  ResourceTicketPtr ticket2 = imageFactory.Load( *req2.Get() );
 
   DALI_TEST_CHECK( req != req2 ); // different requests
   DALI_TEST_EQUALS( ticket->GetId(), ticket2->GetId(), TEST_LOCATION ); // same resource
@@ -236,7 +236,7 @@ int UtcDaliImageFactoryCompatibleResource02(void)
 
   // request with default attributes ( size is 0,0 )
   RequestPtr req = imageFactory.RegisterRequest( gTestImageFilename, NULL );
-  ResourceTicketPtr ticket = imageFactory.Load( req.Get() );
+  ResourceTicketPtr ticket = imageFactory.Load( *req.Get() );
 
   application.SendNotification();
   application.Render();
@@ -254,7 +254,7 @@ int UtcDaliImageFactoryCompatibleResource02(void)
   ImageAttributes attr = ImageAttributes::New();
   attr.SetSize( 92, 92 );
   RequestPtr req2 = imageFactory.RegisterRequest( gTestImageFilename, &attr );
-  ResourceTicketPtr ticket2 = imageFactory.Load( req2.Get() );
+  ResourceTicketPtr ticket2 = imageFactory.Load( *req2.Get() );
 
   DALI_TEST_CHECK( req != req2 ); // different requests
   DALI_TEST_EQUALS( ticket->GetId(), ticket2->GetId(), TEST_LOCATION ); // same resource
@@ -278,7 +278,7 @@ int UtcDaliImageFactoryCompatibleResource03(void)
 
   // request with default attributes ( size is 0,0 )
   RequestPtr req = imageFactory.RegisterRequest( gTestImageFilename, &attr );
-  ResourceTicketPtr ticket = imageFactory.Load( req.Get() );
+  ResourceTicketPtr ticket = imageFactory.Load( *req.Get() );
 
   application.SendNotification();
   application.Render();
@@ -291,7 +291,7 @@ int UtcDaliImageFactoryCompatibleResource03(void)
   ImageAttributes attr2 = ImageAttributes::New();
   attr2.SetSize( 80, 80 );
   RequestPtr req2 = imageFactory.RegisterRequest( gTestImageFilename, &attr2 );
-  ResourceTicketPtr ticket2 = imageFactory.Load( req2.Get() );
+  ResourceTicketPtr ticket2 = imageFactory.Load( *req2.Get() );
 
   DALI_TEST_CHECK( req != req2 ); // different requests
   DALI_TEST_EQUALS( ticket->GetId(), ticket2->GetId(), TEST_LOCATION ); // same resource
@@ -310,12 +310,12 @@ int UtcDaliImageFactoryReload01(void)
   ImageFactory& imageFactory  = Internal::ThreadLocalStorage::Get().GetImageFactory();
 
   RequestPtr req = imageFactory.RegisterRequest( gTestImageFilename, NULL );
-  ResourceTicketPtr ticket = imageFactory.Load( req.Get() );
+  ResourceTicketPtr ticket = imageFactory.Load( *req.Get() );
 
-  ResourceTicketPtr ticket2 = imageFactory.Reload( req.Get() );
+  ResourceTicketPtr ticket2 = imageFactory.Reload( *req.Get() );
   DALI_TEST_EQUALS( ticket, ticket2, TEST_LOCATION );
 
-  ResourceTicketPtr ticket3 = imageFactory.Reload( req.Get() );
+  ResourceTicketPtr ticket3 = imageFactory.Reload( *req.Get() );
   DALI_TEST_EQUALS( ticket, ticket3, TEST_LOCATION );
   END_TEST;
 }
@@ -332,7 +332,7 @@ int UtcDaliImageFactoryReload02(void)
   application.GetPlatform().SetClosestImageSize(testSize);
 
   RequestPtr req = imageFactory.RegisterRequest( gTestImageFilename, NULL );
-  ResourceTicketPtr ticket = imageFactory.Load( req.Get() );
+  ResourceTicketPtr ticket = imageFactory.Load( *req.Get() );
 
   application.SendNotification();
   application.Render();
@@ -342,7 +342,7 @@ int UtcDaliImageFactoryReload02(void)
   DALI_TEST_CHECK( application.GetPlatform().WasCalled( TestPlatformAbstraction::LoadResourceFunc ) );
   application.GetPlatform().ResetTrace();
 
-  ResourceTicketPtr ticket2 = imageFactory.Reload( req.Get() );
+  ResourceTicketPtr ticket2 = imageFactory.Reload( *req.Get() );
 
   application.SendNotification();
   application.Render();
@@ -356,7 +356,7 @@ int UtcDaliImageFactoryReload02(void)
   // emulate load success
   EmulateImageLoaded( application, 80, 80 );
 
-  ResourceTicketPtr ticket3 = imageFactory.Reload( req.Get() );
+  ResourceTicketPtr ticket3 = imageFactory.Reload( *req.Get() );
 
   application.SendNotification();
   application.Render();
@@ -367,7 +367,7 @@ int UtcDaliImageFactoryReload02(void)
   DALI_TEST_CHECK( application.GetPlatform().WasCalled( TestPlatformAbstraction::LoadResourceFunc ) );
   application.GetPlatform().ResetTrace();
 
-  ticket3 = imageFactory.Reload( req.Get() );
+  ticket3 = imageFactory.Reload( *req.Get() );
 
   application.SendNotification();
   application.Render();
@@ -390,7 +390,7 @@ int UtcDaliImageFactoryReload03(void)
   application.GetPlatform().SetClosestImageSize( testSize );
 
   RequestPtr req = imageFactory.RegisterRequest( gTestImageFilename, NULL );
-  ResourceTicketPtr ticket = imageFactory.Load( req.Get() );
+  ResourceTicketPtr ticket = imageFactory.Load( *req.Get() );
 
   application.SendNotification();
   application.Render();
@@ -402,10 +402,10 @@ int UtcDaliImageFactoryReload03(void)
   application.GetPlatform().SetClosestImageSize( newSize );
 
   // Image file changed size, new resource request should be issued
-  ResourceTicketPtr ticket2 = imageFactory.Reload( req.Get() );
+  ResourceTicketPtr ticket2 = imageFactory.Reload( *req.Get() );
   DALI_TEST_CHECK( ticket != ticket2 );
 
-  ResourceTicketPtr ticket3 = imageFactory.Reload( req.Get() );
+  ResourceTicketPtr ticket3 = imageFactory.Reload( *req.Get() );
   DALI_TEST_EQUALS( ticket2, ticket3, TEST_LOCATION );
   END_TEST;
 }
@@ -422,7 +422,7 @@ int UtcDaliImageFactoryReload04(void)
   application.GetPlatform().SetClosestImageSize(testSize);
 
   RequestPtr req = imageFactory.RegisterRequest( gTestImageFilename, NULL );
-  ResourceTicketPtr ticket = imageFactory.Load( req.Get() );
+  ResourceTicketPtr ticket = imageFactory.Load( *req.Get() );
 
   application.SendNotification();
   application.Render();
@@ -430,7 +430,7 @@ int UtcDaliImageFactoryReload04(void)
   DALI_TEST_CHECK( application.GetPlatform().WasCalled( TestPlatformAbstraction::LoadResourceFunc ) );
   application.GetPlatform().ResetTrace();
 
-  ResourceTicketPtr ticket2 = imageFactory.Reload( req.Get() );
+  ResourceTicketPtr ticket2 = imageFactory.Reload( *req.Get() );
 
   application.SendNotification();
   application.Render();
@@ -444,7 +444,7 @@ int UtcDaliImageFactoryReload04(void)
   // emulate load success
   EmulateImageLoaded( application, 80, 80 );
 
-  ResourceTicketPtr ticket3 = imageFactory.Reload( req.Get() );
+  ResourceTicketPtr ticket3 = imageFactory.Reload( *req.Get() );
 
   application.SendNotification();
   application.Render();
@@ -457,7 +457,7 @@ int UtcDaliImageFactoryReload04(void)
   application.GetPlatform().ResetTrace();
 
   // still loading
-  ticket3 = imageFactory.Reload( req.Get() );
+  ticket3 = imageFactory.Reload( *req.Get() );
   application.SendNotification();
   application.Render();
   application.SendNotification();
@@ -490,13 +490,13 @@ int UtcDaliImageFactoryReload05(void)
   application.SendNotification();
   application.Render();
 
-  ResourceTicketPtr ticket = imageFactory.Reload( req.Get() );
+  ResourceTicketPtr ticket = imageFactory.Reload( *req.Get() );
 
   DALI_TEST_CHECK( !application.GetPlatform().WasCalled( TestPlatformAbstraction::LoadResourceFunc ) );
   DALI_TEST_CHECK( !ticket );
 
   // this happens when Image is put on stage
-  ticket = imageFactory.Load( req.Get() );
+  ticket = imageFactory.Load( *req.Get() );
 
   application.SendNotification();
   application.Render();
@@ -505,7 +505,7 @@ int UtcDaliImageFactoryReload05(void)
   DALI_TEST_CHECK( ticket );
   application.GetPlatform().ResetTrace();
 
-  ticket = imageFactory.Reload( req.Get() );
+  ticket = imageFactory.Reload( *req.Get() );
 
   application.SendNotification();
   application.Render();
@@ -518,7 +518,7 @@ int UtcDaliImageFactoryReload05(void)
   // emulate load success
   EmulateImageLoaded( application, 80, 80 );
 
-  ticket = imageFactory.Reload( req.Get() );
+  ticket = imageFactory.Reload( *req.Get() );
 
   application.SendNotification();
   application.Render();
@@ -545,7 +545,7 @@ int UtcDaliImageFactoryReload06(void)
 
   // request with default attributes ( size is 0,0 )
   RequestPtr req = imageFactory.RegisterRequest( gTestImageFilename, NULL );
-  ResourceTicketPtr ticket = imageFactory.Load( req.Get() );
+  ResourceTicketPtr ticket = imageFactory.Load( *req.Get() );
 
   application.SendNotification();
   application.Render();
@@ -562,7 +562,7 @@ int UtcDaliImageFactoryReload06(void)
   ImageAttributes attr = ImageAttributes::New();
   attr.SetSize( 92, 92 );
   RequestPtr req2 = imageFactory.RegisterRequest( gTestImageFilename, &attr );
-  ResourceTicketPtr ticket2 = imageFactory.Load( req2.Get() );
+  ResourceTicketPtr ticket2 = imageFactory.Load( *req2.Get() );
 
   DALI_TEST_CHECK( req != req2 ); // different requests
   DALI_TEST_EQUALS( ticket->GetId(), ticket2->GetId(), TEST_LOCATION ); // same resource
@@ -571,14 +571,14 @@ int UtcDaliImageFactoryReload06(void)
   application.GetPlatform().SetClosestImageSize(newSize);
 
   // reload fixed size (192,192) request
-  ticket2 = imageFactory.Reload( req2.Get() );
+  ticket2 = imageFactory.Reload( *req2.Get() );
 
   // emulate load success
   // note: this is the only way to emulate what size is loaded by platform abstraction
   EmulateImageLoaded( application, 92, 92 );
 
   // reload default size request
-  ticket = imageFactory.Reload( req.Get() );
+  ticket = imageFactory.Reload( *req.Get() );
 
   DALI_TEST_CHECK( ticket->GetId() != ticket2->GetId() ); // different resources
   END_TEST;
index 4fc10d0..69dface 100644 (file)
@@ -25,8 +25,28 @@ namespace Integration
 {
 
 /**
- * Used to identify a loading operation.
- * This begins with a call to PlatformAbstraction::LoadResource().
+ * @brief Used to identify a resource loading operation.
+ *
+ * These unique ResourceId values can be used to identify a resource loading
+ * transaction in core-adaptor communication.
+ * A resource transaction is asynchronous and many can be in-flight
+ * concurrently.
+ * A ResourceId allows the core to track a resource transaction over its
+ * lifetime and match an asynchronous completion notification to the
+ * corresponding load request or to cancel the operation early.
+ *
+ * A resource transaction begins with a call to PlatformAbstraction::LoadResource()
+ * Later asynchronous status notifications obtained by polling
+ * PlatformAbstraction::GetResources() can be mapped to corresponding
+ * LoadResource() invocations using the ResourceId value.
+ * It is the core's responsibility to ensure that each invocation of
+ * PlatformAbstraction::LoadResource() passes in a Request object with a unique
+ * integer ResourceId.
+ *
+ * @sa Dali::Integration::PlatformAbstraction::LoadResource
+ * Dali::Integration::PlatformAbstraction::GetResources
+ * Dali::Integration::ResourceCache
+ * Dali::Internal::ImageFactoryCache::RequestId
  */
 typedef unsigned int ResourceId;
 
index f719d81..17da0c5 100644 (file)
@@ -40,6 +40,17 @@ namespace ImageFactoryCache
  */
 struct Request;
 
+/**
+ * @brief Unique ID for image resource requests.
+ *
+ * Images are loaded from a string locator (typically a file path) using a set
+ * of ImageAttributes. Each unique pair of string and attributes is mapped to a
+ * unique RequestId value. This ensures multiple Image objects loading the same
+ * image file with the same attributes only generate one resource request and
+ * Core only issues one IO operation to Adaptor to do the load.
+ *
+ * @sa Dali::Integration::ResourceId
+ */
 typedef unsigned int RequestId;
 
 typedef std::multimap<size_t, RequestId>           RequestPathHashMap;
index 38203c6..8b17a27 100644 (file)
@@ -63,7 +63,7 @@ Request* ImageFactory::RegisterRequest( const std::string &filename, const Image
   std::size_t urlHash = CalculateHash( filename );
 
   Request* foundReq( NULL );
-  foundReq = FindRequest(filename, urlHash, attr);
+  foundReq = FindRequest( filename, urlHash, attr );
 
   if( !foundReq )
   {
@@ -74,45 +74,35 @@ Request* ImageFactory::RegisterRequest( const std::string &filename, const Image
   return foundReq;
 }
 
-ResourceTicketPtr ImageFactory::Load( Request *req )
+ResourceTicketPtr ImageFactory::Load( Request& request )
 {
   ResourceTicketPtr ticket;
-  DALI_ASSERT_DEBUG( req );
 
-  ResourceId resId = req->resourceId;
+  const ResourceId resId = request.resourceId;
   if( resId == 0 )
   {
-    // not yet associated with a resource, load
-    std::size_t urlHash(0);
-    RequestPathHashMap::const_iterator it;
-    for( it = mUrlCache.begin(); it != mUrlCache.end(); ++it )
-    {
-      if( it->second == req->GetId() )
-      {
-        urlHash = it->first;
-        break;
-      }
-    }
-    DALI_ASSERT_DEBUG( it!=mUrlCache.end() );
+    // Not yet associated with a ticketed async resource transaction, so attempt to
+    // find a cached one and issue a new load if there isn't one in-flight:
 
-    ticket = FindCompatibleResource( req->url, urlHash, req->attributes );
+    const std::size_t urlHash = GetHashForCachedRequest( request );
+    ticket = FindCompatibleResource( request.url, urlHash, request.attributes );
 
     if( !ticket )
     {
-      // didn't find compatible resource
-      ticket = IssueLoadRequest( req->url, req->attributes );
+      // Didn't find compatible resource already being loaded
+      ticket = IssueLoadRequest( request.url, request.attributes );
     }
 
-    req->resourceId = ticket->GetId();
+    request.resourceId = ticket->GetId();
   }
   else
   {
     ticket = mResourceClient.RequestResourceTicket( resId );
     if( !ticket )
     {
-      // resource has been discarded since
-      ticket = IssueLoadRequest( req->url, req->attributes );
-      req->resourceId = ticket->GetId();
+      // Resource has been discarded since last load
+      ticket = IssueLoadRequest( request.url, request.attributes );
+      request.resourceId = ticket->GetId();
     }
     DALI_ASSERT_DEBUG( ticket->GetTypePath().type->id == ResourceBitmap      ||
                        ticket->GetTypePath().type->id == ResourceNativeImage ||
@@ -130,26 +120,26 @@ ResourceTicketPtr ImageFactory::Load( Request *req )
 // In this case both requests will be associated with the resource of size (40, 40)
 // If image changes on filesystem to size (96, 96) -> now after reloading Req2 would load a
 // new resource of size (96, 96), but reloading Req1 would load a scaled down version
-ResourceTicketPtr ImageFactory::Reload( Request* request )
+ResourceTicketPtr ImageFactory::Reload( Request& request )
 {
-  DALI_ASSERT_ALWAYS( request );
+  DALI_ASSERT_ALWAYS( &request );
 
   // go through requests, check real size and attributes again. If different, update related ticket.
   ResourceTicketPtr ticket;
 
-  if( !request->resourceId )
+  if( !request.resourceId )
   {
     // in case of OnDemand loading, just return
     return NULL;
   }
 
-  ticket = mResourceClient.RequestResourceTicket( request->resourceId );
+  ticket = mResourceClient.RequestResourceTicket( request.resourceId );
 
   // ticket might have been deleted, eg. Image::Disconnect
   if( !ticket )
   {
-    ticket = IssueLoadRequest( request->url, request->attributes );
-    request->resourceId = ticket->GetId();
+    ticket = IssueLoadRequest( request.url, request.attributes );
+    request.resourceId = ticket->GetId();
   }
   else // ticket still alive
   {
@@ -164,7 +154,7 @@ ResourceTicketPtr ImageFactory::Reload( Request* request )
     }
 
     Vector2 size;
-    Internal::ThreadLocalStorage::Get().GetPlatformAbstraction().GetClosestImageSize( request->url, *request->attributes, size );
+    Internal::ThreadLocalStorage::Get().GetPlatformAbstraction().GetClosestImageSize( request.url, *request.attributes, size );
 
     const ImageAttributes& attrib = static_cast<ImageTicket*>(ticket.Get())->GetAttributes();
 
@@ -175,8 +165,8 @@ ResourceTicketPtr ImageFactory::Reload( Request* request )
     else
     {
       // if not, return a different ticket
-      ticket = IssueLoadRequest( request->url, request->attributes );
-      request->resourceId = ticket->GetId();
+      ticket = IssueLoadRequest( request.url, request.attributes );
+      request.resourceId = ticket->GetId();
     }
   }
   return ticket;
@@ -300,7 +290,7 @@ Request* ImageFactory::FindRequest( const std::string& filename, size_t hash, co
 
     // get cached request
     RequestIdMap::iterator foundRequestIter = mRequestCache.find( cachedReqId );
-    DALI_ASSERT_DEBUG( foundRequestIter != mRequestCache.end() );
+    DALI_ASSERT_DEBUG( foundRequestIter != mRequestCache.end() && "Only requests that are live in mRequestCache should appear in mUrlCache which is an index to speed-up lookups into it.");
     if( foundRequestIter != mRequestCache.end() )
     {
       const Request& cachedRequest = *(foundRequestIter->second);
@@ -445,6 +435,24 @@ void ImageFactory::RequestDiscarded( const Request& req )
   }
 }
 
+std::size_t ImageFactory::GetHashForCachedRequest( const Request& request )
+{
+  const RequestId requestId = request.GetId();
+  std::size_t locatorHash(0);
+  RequestPathHashMap::const_iterator it;
+
+  for( it = mUrlCache.begin(); it != mUrlCache.end(); ++it )
+  {
+    if( it->second == requestId )
+    {
+      locatorHash = it->first;
+      break;
+    }
+  }
+  DALI_ASSERT_DEBUG( it!=mUrlCache.end() && "Only already-cached requests can have their locator hashes looked-up." );
+  return locatorHash;
+}
+
 } // namespace Internal
 
 } // namespace Dali
index 1b09f50..fe8ed7b 100644 (file)
@@ -67,10 +67,10 @@ public:
   /**
    * 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.
@@ -78,10 +78,10 @@ public:
    * 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.
@@ -206,6 +206,14 @@ private:
    */
   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
index 218622c..581fd13 100644 (file)
@@ -91,7 +91,7 @@ ImagePtr Image::New( const std::string& filename, const Dali::ImageAttributes& a
     if( Dali::Image::Immediate == loadPol )
     {
       // Trigger loading of the image on a as soon as it can be done
-      image->mTicket = image->mImageFactory.Load( image->mRequest.Get() );
+      image->mTicket = image->mImageFactory.Load( *image->mRequest.Get() );
       image->mTicket->AddObserver( *image );
     }
   }
@@ -186,7 +186,7 @@ void Image::Reload()
 {
   if ( mRequest )
   {
-    ResourceTicketPtr ticket = mImageFactory.Reload( mRequest.Get() );
+    ResourceTicketPtr ticket = mImageFactory.Reload( *mRequest.Get() );
     SetTicket( ticket.Get() );
   }
 }
@@ -271,7 +271,8 @@ void Image::Connect()
     // ticket was thrown away when related actors went offstage or image loading on demand
     if( !mTicket )
     {
-      ResourceTicketPtr newTicket = mImageFactory.Load( mRequest.Get() );
+      DALI_ASSERT_DEBUG( mRequest.Get() );
+      ResourceTicketPtr newTicket = mImageFactory.Load( *mRequest.Get() );
       SetTicket( newTicket.Get() );
     }
   }
index 0c550c8..27c61b4 100644 (file)
@@ -40,7 +40,8 @@ class ResourceTicketObserver;
 class ResourceTicketLifetimeObserver;
 
 /**
- * ResourceTicket records the lifetime of a resource loading request.
+ * @brief ResourceTicket records the lifetime of a resource loading request.
+ *
  * When a resource is requested from ResourceClient, you get a ticket.
  * The state of the loading operation, can be observed using the ticket.
  * After the ticket is destroyed, the resource will be discarded.