1 #ifndef __DALI_INTERNAL_RESOURCE_MANAGER_H__
2 #define __DALI_INTERNAL_RESOURCE_MANAGER_H__
5 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
7 // Licensed under the Flora License, Version 1.0 (the License);
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
11 // http://floralicense.org/license/
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an AS IS BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
22 #include <boost/functional/hash.hpp>
25 #include <dali/public-api/images/image.h>
26 #include <dali/public-api/images/native-image.h>
27 #include <dali/public-api/images/bitmap-image.h>
28 #include <dali/public-api/common/ref-counted-dali-vector.h>
30 #include <dali/integration-api/bitmap.h>
31 #include <dali/integration-api/platform-abstraction.h>
32 #include <dali/integration-api/resource-cache.h>
33 #include <dali/integration-api/shader-data.h>
35 #include <dali/internal/common/event-to-update.h>
36 #include <dali/internal/common/message.h>
37 #include <dali/internal/common/bitmap-upload.h>
38 #include <dali/internal/event/text/font-impl.h>
39 #include <dali/internal/event/modeling/model-data-impl.h>
40 #include <dali/internal/event/resources/resource-client-declarations.h>
41 #include <dali/internal/event/effects/shader-factory.h>
42 #include <dali/internal/update/modeling/internal-mesh-data.h>
43 #include <dali/internal/update/modeling/scene-graph-mesh-declarations.h>
44 #include <dali/internal/update/resources/resource-manager-declarations.h>
45 #include <dali/internal/update/resources/bitmap-metadata.h>
50 typedef boost::hash<const std::string> StringHash;
62 // value types used by messages
63 template <> struct ParameterType< Integration::LoadResourcePriority >
64 : public BasicType< Integration::LoadResourcePriority > {};
65 template <> struct ParameterType< Pixel::Format >
66 : public BasicType< Pixel::Format > {};
67 template <> struct ParameterType< Integration::ResourceTypeId >
68 : public BasicType< Integration::ResourceTypeId > {};
74 class TextureCacheDispatcher;
75 class PostProcessResourceDispatcher;
78 class NotificationManager;
80 /** Raw bytes of a resource laid out exactly as it wouldbe in a file, but in memory. */
81 typedef Dali::RefCountedVector<uint8_t> RequestBuffer;
82 /** Counting smart pointer for managing a buffer of raw bytes. */
83 typedef IntrusivePtr<RequestBuffer> RequestBufferPtr;
86 * ResourceManager keeps track of resource loading requests, and caches resources that are loaded.
87 * It uses ResourceTicket objects, to keep track of the lifetime of each request.
88 * If the same resource is required by two client objects, they will share the same ResourceTicket
89 * i.e. only one load will occur using the native filesystem.
91 * Multi-threading notes:
92 * Resources are received from the PlatformAbstraction API during the Core::Render() method, which
93 * may be called from a dedicated rendering thread.
94 * Loading requests must be made from the application's main thread e.g. when Dali::Image is created.
96 class ResourceManager : public Integration::ResourceCache
101 * Create a resource manager.
102 * There should exactly one of these objects per Dali Core.
103 * @param[in] platformAbstraction Used to request resources from the native filesystem.
104 * @param[in] notificationManager Used to send NotifyTickets message.
105 * @param[in] postProcessResourcesQueue Used for performing post processing on resources
106 * @param[in] discardQueue Used to cleanup nodes & resources when no longer in use.
107 * @param[in] renderQueue Used to queue resource updates until the next Render.
109 ResourceManager( Integration::PlatformAbstraction& platformAbstraction,
110 NotificationManager& notificationManager,
111 SceneGraph::TextureCacheDispatcher& textureCacheDispatcher,
112 ResourcePostProcessList& postProcessResourcesQueue,
113 SceneGraph::PostProcessResourceDispatcher& postProcessResourceDispatcher,
114 SceneGraph::DiscardQueue& discardQueue,
115 SceneGraph::RenderQueue& renderQueue );
118 * Virtual destructor.
120 virtual ~ResourceManager();
122 public: // Used by ResourceClient
124 /********************************************************************************
125 ************************ ResourceClient direct interface **********************
126 ********************************************************************************/
129 * Resource client passes itself for secondary intialisation.
130 * (The resource client requires the ResourceManager to be instantiated first).
131 * @param[in] resourceClient The ResourceClient.
133 void SetClient( ResourceClient& resourceClient );
135 /********************************************************************************
136 ************************ UpdateManager direct interface ***********************
137 ********************************************************************************/
140 * Called to update the resource cache before rendering.
141 * New resources will be added to the cache using PlatformAbstraction::FillResourceCache().
142 * Unwanted resources will be added to the DiscardQueue.
143 * @param[in] updateBufferIndex The current update buffer index.
144 * @return true, if a resource load was completed or failed
146 bool UpdateCache( BufferIndex updateBufferIndex );
149 * Iterate through the post process queue, performing requested updates.
150 * @param[in] updateBufferIndex The current update buffer index.
152 void PostProcessResources( BufferIndex updateBufferIndex );
154 /********************************************************************************
155 *************************** CoreImpl direct interface *************************
156 ********************************************************************************/
159 * Returns whether the Resource Manager is still processing any resource requests.
160 * @return true if still processing, false otherwise.
162 bool ResourcesToProcess();
164 /********************************************************************************
165 ********************************* Message handlers *****************************
166 ********************************************************************************/
169 * Request a resource from the native filesystem.
170 * @param[in] id The Id of the requested resource
171 * @param[in] typePath The type & path of requested resource.
172 * @param[in] priority The priority of the request. This is ignored if the resource is already being loaded.
174 void HandleLoadResourceRequest( ResourceId id,
175 const ResourceTypePath& typePath,
176 Integration::LoadResourcePriority priority );
179 * Decode a resource from a memory buffer with the semantics of loading.
180 * Notifications of partial completion, success, and failure will happen via
181 * the same loading notification path used for loading from files: Update()
182 * will retrieve loading events in its main loop and notify listeners to its
183 * own loading events, and forward them, still as loading events, to the event
184 * thread via its update queue.
185 * Resource manager and lower levels make no attempt to detect resource
186 * aliases as is done for multiple requests to load the same resource
187 * file, so the caller is responsible for ensuring that it only requests
188 * the decoding of an in-memory resource once and for doing the sharing of the
189 * resulting object itself. Ultimately this responsibility resides with the
191 * @note ! Only Bitmap resources are supported for decoding from memory !
192 * @param[in] id The Id of the requested resource.
193 * @param[in] typePath The type of the requested resource and a path that is ignored.
194 * @param[in] buffer The raw encoded bytes of the resource as they would appear in a file.
195 * @param[in] priority The priority of the request. This is ignored if the resource is already being loaded.
197 void HandleDecodeResourceRequest( ResourceId id,
198 const ResourceTypePath& typePath,
199 RequestBufferPtr buffer,
200 Integration::LoadResourcePriority priority );
203 * Injects a bitmap resource (does not require loading).
204 * @pre bitmap has to be initialized
205 * @param[in] id The resource id
206 * @param[in] bitmap an initialized bitmap
208 void HandleAddBitmapImageRequest(ResourceId id, Integration::Bitmap* bitmap);
211 * Add an existing resource to the resource manager.
212 * @param[in] id The resource id
213 * @param [in] resourceData the NativeImage object
214 * @return A ref-counted request object. Keep a copy until the resource is no longer required.
216 void HandleAddNativeImageRequest( ResourceId id, NativeImagePtr resourceData );
219 * Add an existing resource to the resource manager.
220 * @param[in] id The resource id
221 * @param[in] width width in pixels
222 * @param[in] height height in pixels
223 * @param[in] pixelFormat Pixel format
225 void HandleAddFrameBufferImageRequest( ResourceId id, unsigned int width, unsigned int height, Pixel::Format pixelFormat );
228 * Add an existing resource to the resource manager.
229 * @param[in] id The resource id
230 * @param[in] nativeImage The NativeImage
232 void HandleAddFrameBufferImageRequest( ResourceId id, NativeImagePtr nativeImage );
235 * Allocate a new empty texture.
236 * @param[in] id The resource id
237 * @param[in] width width in pixels
238 * @param[in] height height in pixels
239 * @param[in] pixelFormat Pixel format
241 void HandleAllocateTextureRequest( ResourceId id, unsigned int width, unsigned int height, Pixel::Format pixelFormat );
244 * Upload an array of bitmaps to a texture.
245 * @param[in] id The resource id
246 * @param[in] uploadArray bitmap upload array.
248 void HandleUpdateTextureRequest( ResourceId id, const BitmapUploadArray& uploadArray );
251 * Requests allocation of a mesh resource
252 * @param[in] id The resource id
253 * @param[in] meshData The mesh data
255 void HandleAllocateMeshRequest (ResourceId id, MeshData* meshData);
258 * Requests allocation of a font resource
260 void HandleAllocateFontRequest(ResourceId id, const std::string& familyNameAndStyle);
263 * Load a shader program from a file
264 * @param[in] id The resource id
265 * @param[in] typePath The type & path of the resource
267 void HandleLoadShaderRequest(ResourceId id, const ResourceTypePath& typePath );
270 * Update bitmap area request
271 * @param[in] textureId The resource ID of a bitmap-texture to remove.
272 * @param[in] area The updated area. Zero width/height indicates the whole bitmap has been updated
274 void HandleUpdateBitmapAreaRequest( ResourceId textureId, const Dali::RectArea& area );
277 * Upload mesh buffer changes.
278 * @param[in] updateBufferIndex The current update buffer index.
279 * @param[in] id The ID of a Mesh resource.
280 * @param[in] meshData Newly allocated mesh data; ownership is taken.
282 void HandleUpdateMeshRequest( BufferIndex updateBufferIndex, ResourceId id, MeshData* meshData );
285 * Request reloading a resource from the native filesystem.
286 * @param[in] id The resource id
287 * @param[in] typePath The type & path of the resource
288 * @param[in] priority The priority of the request. This is ignored if the resource is already being refreshed.
290 void HandleReloadResourceRequest( ResourceId id, const ResourceTypePath& typePath, Integration::LoadResourcePriority priority );
293 * Save a resource to the given url
294 * @param[in] id The resource id
295 * @param[in] typePath The type & path of the resource
297 void HandleSaveResourceRequest( ResourceId id, const ResourceTypePath& typePath );
300 * Resource ticket has been discarded, throw away the actual resource
302 void HandleDiscardResourceRequest( ResourceId id, Integration::ResourceTypeId typeId );
305 * Update font texture atlas status
306 * @param[in] id The resource id
307 * @param[in] atlasId texture ID of the atlas
308 * @param[in] loadStatus The status update.
310 void HandleAtlasUpdateRequest( ResourceId id, ResourceId atlasId, Integration::LoadStatus loadStatus );
312 /********************************************************************************
313 ******************** Event thread object direct interface *********************
314 ********************************************************************************/
317 * Called by model implementations which require access to the model
319 * @note Only called from event thread objects - ModelData is not used
321 * @param[in] id - the id of a ModelData resource.
322 * @return the model data or NULL if it has not been loaded.
324 Internal::ModelDataPtr GetModelData(ResourceId id);
326 /********************************************************************************
327 ******************** Update thread object direct interface ********************
328 ********************************************************************************/
331 * Check if a resource has completed loading.
332 * @param[in] id The ID of a bitmap/texture resource.
333 * @return true if the bitmap or texture has finished loading
335 bool IsResourceLoaded(ResourceId id);
338 * Check if a resource has failed to load, e.g. file not found, etc.
339 * @param[in] id The ID of a bitmap/texture resource.
340 * @return true if the bitmap or texture has failed to load
342 bool IsResourceLoadFailed(ResourceId id);
345 * Get bitmap metadata. This stores meta data about the resource, but
346 * doesn't keep track of the resource
348 BitmapMetadata GetBitmapMetadata(ResourceId id);
352 * @note Used by update thread objects (SceneGraph::Mesh) only
353 * @param[in] id - the id of a MeshData resource.
354 * @return the mesh data or NULL if this resource isn't valid
356 Internal::SceneGraph::Mesh* GetMesh(ResourceId id);
359 * Returns the shader resource corresponding to the Id
360 * @param[in] id - the id of a shader binary resource.
361 * @return the shader binary resource data or NULL if it has not been loaded.
363 Integration::ShaderDataPtr GetShaderData(ResourceId id);
366 * Check if current set of glyph requests on given atlas have finished loading
367 * @param[in] id Request Id of the text atlas texture
368 * @return true if the current set of glyph requests have all completed, false
369 * if there are outstanding glyph requests that haven't finished.
371 bool IsAtlasLoaded(ResourceId id);
374 * Check the load status of a given atlas.
375 * @param[in] id Request Id of the text atlas texture
378 Integration::LoadStatus GetAtlasLoadStatus( ResourceId atlasId );
380 /********************************************************************************
381 ************************* ResourceCache Implementation ************************
382 ********************************************************************************/
386 * @copydoc Integration::ResourceCache::LoadResponse
388 virtual void LoadResponse(ResourceId id, Integration::ResourceTypeId type, Integration::ResourcePointer resource, Integration::LoadStatus loadStatus);
391 * @copydoc Integration::ResourceCache::SaveComplete
393 virtual void SaveComplete(ResourceId id, Integration::ResourceTypeId type);
396 * @copydoc Integration::ResourceCache::LoadFailed
398 virtual void LoadFailed(ResourceId id, Integration::ResourceFailure failure);
401 * @copydoc Integration::ResourceCache::SaveFailed
403 virtual void SaveFailed(ResourceId id, Integration::ResourceFailure failure);
405 /********************************************************************************
406 ********************************* Private Methods *****************************
407 ********************************************************************************/
410 * @param[in] id Resource id to clear
411 * @param[in] typePath Glyphs to be loaded, and cleared beforehand
413 void ClearRequestedGlyphArea( ResourceId id, const ResourceTypePath& typePath );
416 * Sends loaded glyphs to texture atlas for uploading
417 * @param[in] glyphSet Loaded glyphs
419 void UploadGlyphsToTexture( const Integration::GlyphSet& glyphSet );
422 * Sends notification messages for load sucess & failure,
423 * pushes from newComplete / newFailed into oldComplete / oldFailed respectively
425 void NotifyTickets();
428 * Triggers message to Event thread to update the ticket's image attributes
429 * @pre An Image resource with the given id should exist in the cache.
430 * @param id ID of the image resource
431 * @param attributes Resource image attributes
433 void UpdateImageTicket( ResourceId id, ImageAttributes& attributes );
436 * Send message to ResourceClient in event thread
437 * @param[in] message The message to send
439 void SendToClient( MessageBase* message );
442 * Discard all dead resources.
443 * @param[in] updateBufferIndex The current update buffer index.
445 void DiscardDeadResources( BufferIndex updateBufferIndex );
448 struct ResourceManagerImpl;
449 ResourceManagerImpl* mImpl;
452 // Messages sent to resource manager from other threads:
453 // These functions are run on other threads and insert messages to be
454 // picked-up by the update thread in its main loop and executed on that in
457 inline void RequestLoadResourceMessage( EventToUpdate& eventToUpdate,
458 ResourceManager& manager,
460 const ResourceTypePath& typePath,
461 Integration::LoadResourcePriority priority )
463 typedef MessageValue3< ResourceManager, ResourceId, ResourceTypePath, Integration::LoadResourcePriority > LocalType;
465 // Reserve some memory inside the message queue
466 unsigned int* slot = eventToUpdate.ReserveMessageSlot( sizeof( LocalType ), false );
468 // Construct message in the message queue memory; note that delete should not be called on the return value
469 new (slot) LocalType( &manager, &ResourceManager::HandleLoadResourceRequest, id, typePath, priority );
472 inline void RequestDecodeResourceMessage( EventToUpdate& eventToUpdate,
473 ResourceManager& manager,
475 /// We use typePath instead of the raw type for ownership and to enable copying of a concrete type.
476 const ResourceTypePath& typePath,
477 RequestBufferPtr buffer,
478 Integration::LoadResourcePriority priority )
480 typedef MessageValue4< ResourceManager, ResourceId, ResourceTypePath, RequestBufferPtr, Integration::LoadResourcePriority > LocalType;
482 // Reserve some memory inside the message queue
483 unsigned int* slot = eventToUpdate.ReserveMessageSlot( sizeof( LocalType ), false );
485 // Construct message in the message queue memory; note that delete should not be called on the return value
486 new (slot) LocalType( &manager, &ResourceManager::HandleDecodeResourceRequest, id, typePath, buffer, priority );
489 inline void RequestAddBitmapImageMessage( EventToUpdate& eventToUpdate,
490 ResourceManager& manager,
492 Integration::Bitmap* resourceData )
494 typedef MessageValue2< ResourceManager, ResourceId, Integration::Bitmap* > LocalType;
496 // Reserve some memory inside the message queue
497 unsigned int* slot = eventToUpdate.ReserveMessageSlot( sizeof( LocalType ) );
499 // Construct message in the message queue memory; note that delete should not be called on the return value
500 new (slot) LocalType( &manager, &ResourceManager::HandleAddBitmapImageRequest, id, resourceData );
503 inline void RequestAddNativeImageMessage( EventToUpdate& eventToUpdate,
504 ResourceManager& manager,
506 NativeImagePtr resourceData )
508 typedef MessageValue2< ResourceManager, ResourceId, NativeImagePtr > LocalType;
510 // Reserve some memory inside the message queue
511 unsigned int* slot = eventToUpdate.ReserveMessageSlot( sizeof( LocalType ) );
513 // Construct message in the message queue memory; note that delete should not be called on the return value
514 new (slot) LocalType( &manager, &ResourceManager::HandleAddNativeImageRequest, id, resourceData );
517 inline void RequestAddFrameBufferImageMessage( EventToUpdate& eventToUpdate,
518 ResourceManager& manager,
522 Pixel::Format pixelFormat )
524 typedef MessageValue4< ResourceManager, ResourceId, unsigned int, unsigned int, Pixel::Format > LocalType;
526 // Reserve some memory inside the message queue
527 unsigned int* slot = eventToUpdate.ReserveMessageSlot( sizeof( LocalType ) );
529 // Construct message in the message queue memory; note that delete should not be called on the return value
530 new (slot) LocalType( &manager, &ResourceManager::HandleAddFrameBufferImageRequest, id, width, height, pixelFormat );
533 inline void RequestAddFrameBufferImageMessage( EventToUpdate& eventToUpdate,
534 ResourceManager& manager,
536 NativeImagePtr resourceData )
538 typedef MessageValue2< ResourceManager, ResourceId, NativeImagePtr > LocalType;
540 // Reserve some memory inside the message queue
541 unsigned int* slot = eventToUpdate.ReserveMessageSlot( sizeof( LocalType ) );
543 // Construct message in the message queue memory; note that delete should not be called on the return value
544 new (slot) LocalType( &manager, &ResourceManager::HandleAddFrameBufferImageRequest, id, resourceData );
547 inline void RequestAllocateTextureMessage(EventToUpdate& eventToUpdate,
548 ResourceManager& manager,
552 Pixel::Format pixelFormat)
554 typedef MessageValue4< ResourceManager, ResourceId, unsigned int, unsigned int, Pixel::Format > LocalType;
556 // Reserve some memory inside the message queue
557 unsigned int* slot = eventToUpdate.ReserveMessageSlot( sizeof( LocalType ) );
559 // Construct message in the message queue memory; note that delete should not be called on the return value
560 new (slot) LocalType( &manager, &ResourceManager::HandleAllocateTextureRequest, id, width, height, pixelFormat );
563 inline void RequestUpdateTextureMessage(EventToUpdate& eventToUpdate,
564 ResourceManager& manager,
566 BitmapUploadArray uploadArray )
568 typedef MessageValue2< ResourceManager, ResourceId, BitmapUploadArray > LocalType;
570 // Reserve some memory inside the message queue
571 unsigned int* slot = eventToUpdate.ReserveMessageSlot( sizeof( LocalType ) );
573 // Construct message in the message queue memory; note that delete should not be called on the return value
574 new (slot) LocalType( &manager, &ResourceManager::HandleUpdateTextureRequest, id, uploadArray );
577 inline void RequestAllocateMeshMessage( EventToUpdate& eventToUpdate,
578 ResourceManager& manager,
580 OwnerPointer<MeshData>& meshData )
582 typedef MessageValue2< ResourceManager, ResourceId, OwnerPointer<MeshData> > LocalType;
584 // Reserve some memory inside the message queue
585 unsigned int* slot = eventToUpdate.ReserveMessageSlot( sizeof( LocalType ) );
587 // Construct message in the message queue memory; note that delete should not be called on the return value
588 new (slot) LocalType( &manager, &ResourceManager::HandleAllocateMeshRequest, id, meshData.Release() );
591 inline void RequestAllocateFontMessage( EventToUpdate& eventToUpdate,
592 ResourceManager& manager,
594 const std::string& familyNameAndStyle)
596 typedef MessageValue2< ResourceManager, ResourceId, std::string > LocalType;
598 // Reserve some memory inside the message queue
599 unsigned int* slot = eventToUpdate.ReserveMessageSlot( sizeof( LocalType ) );
601 // Construct message in the message queue memory; note that delete should not be called on the return value
602 new (slot) LocalType( &manager, &ResourceManager::HandleAllocateFontRequest, id, familyNameAndStyle );
605 inline void RequestLoadShaderMessage( EventToUpdate& eventToUpdate,
606 ResourceManager& manager,
608 const ResourceTypePath& typePath )
610 typedef MessageValue2< ResourceManager, ResourceId, ResourceTypePath > LocalType;
612 // Reserve some memory inside the message queue
613 unsigned int* slot = eventToUpdate.ReserveMessageSlot( sizeof( LocalType ) );
615 // Construct message in the message queue memory; note that delete should not be called on the return value
616 new (slot) LocalType( &manager, &ResourceManager::HandleLoadShaderRequest, id, typePath );
619 inline void RequestUpdateBitmapAreaMessage( EventToUpdate& eventToUpdate,
620 ResourceManager& manager,
622 const Dali::RectArea& area )
624 typedef MessageValue2< ResourceManager, ResourceId, Dali::RectArea > LocalType;
626 // Reserve some memory inside the message queue
627 unsigned int* slot = eventToUpdate.ReserveMessageSlot( sizeof( LocalType ), false );
629 // Construct message in the message queue memory; note that delete should not be called on the return value
630 new (slot) LocalType( &manager, &ResourceManager::HandleUpdateBitmapAreaRequest, id, area );
633 inline void RequestUpdateMeshMessage( EventToUpdate& eventToUpdate,
634 ResourceManager& manager,
636 const Dali::MeshData& meshData )
638 typedef MessageDoubleBuffered2< ResourceManager, ResourceId, OwnerPointer< MeshData > > LocalType;
640 // Reserve some memory inside the message queue
641 unsigned int* slot = eventToUpdate.ReserveMessageSlot( sizeof( LocalType ) );
643 MeshData* internalMeshData = new MeshData( meshData, true, false );
645 // Construct message in the message queue memory; note that delete should not be called on the return value
646 new (slot) LocalType( &manager, &ResourceManager::HandleUpdateMeshRequest, id, internalMeshData );
649 inline void RequestReloadResourceMessage( EventToUpdate& eventToUpdate,
650 ResourceManager& manager,
652 const ResourceTypePath& typePath,
653 Integration::LoadResourcePriority priority )
655 typedef MessageValue3< ResourceManager, ResourceId, ResourceTypePath, Integration::LoadResourcePriority > LocalType;
657 // Reserve some memory inside the message queue
658 unsigned int* slot = eventToUpdate.ReserveMessageSlot( sizeof( LocalType ), false );
660 // Construct message in the message queue memory; note that delete should not be called on the return value
661 new (slot) LocalType( &manager, &ResourceManager::HandleReloadResourceRequest, id, typePath, priority );
664 inline void RequestSaveResourceMessage( EventToUpdate& eventToUpdate,
665 ResourceManager& manager,
667 const ResourceTypePath& typePath )
669 typedef MessageValue2< ResourceManager, ResourceId, ResourceTypePath > LocalType;
671 // Reserve some memory inside the message queue
672 unsigned int* slot = eventToUpdate.ReserveMessageSlot( sizeof( LocalType ) );
674 // Construct message in the message queue memory; note that delete should not be called on the return value
675 new (slot) LocalType( &manager, &ResourceManager::HandleSaveResourceRequest, id, typePath );
678 inline void RequestDiscardResourceMessage( EventToUpdate& eventToUpdate,
679 ResourceManager& manager,
681 Integration::ResourceTypeId typeId )
683 typedef MessageValue2< ResourceManager, ResourceId, Integration::ResourceTypeId > LocalType;
685 // Reserve some memory inside the message queue
686 unsigned int* slot = eventToUpdate.ReserveMessageSlot( sizeof( LocalType ) );
688 // Construct message in the message queue memory; note that delete should not be called on the return value
689 new (slot) LocalType( &manager, &ResourceManager::HandleDiscardResourceRequest, id, typeId );
692 inline void RequestAtlasUpdateMessage( EventToUpdate& eventToUpdate,
693 ResourceManager& manager,
696 Integration::LoadStatus loadStatus )
698 typedef MessageValue3< ResourceManager, ResourceId, ResourceId, Integration::LoadStatus > LocalType;
700 // Reserve some memory inside the message queue
701 unsigned int* slot = eventToUpdate.ReserveMessageSlot( sizeof( LocalType ) );
703 // Construct message in the message queue memory; note that delete should not be called on the return value
704 new (slot) LocalType( &manager, &ResourceManager::HandleAtlasUpdateRequest, id, atlasId, loadStatus );
707 } // namespace Internal
711 #endif // __DALI_INTERNAL_RESOURCE_MANAGER_H__