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 Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0
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.
23 #include <boost/functional/hash.hpp>
26 #include <dali/public-api/images/image.h>
27 #include <dali/public-api/images/native-image.h>
28 #include <dali/public-api/images/bitmap-image.h>
29 #include <dali/public-api/common/ref-counted-dali-vector.h>
31 #include <dali/integration-api/bitmap.h>
32 #include <dali/integration-api/platform-abstraction.h>
33 #include <dali/integration-api/resource-cache.h>
34 #include <dali/integration-api/shader-data.h>
36 #include <dali/internal/common/event-to-update.h>
37 #include <dali/internal/common/message.h>
38 #include <dali/internal/common/bitmap-upload.h>
39 #include <dali/internal/event/text/font-impl.h>
40 #include <dali/internal/event/modeling/model-data-impl.h>
41 #include <dali/internal/event/resources/resource-client-declarations.h>
42 #include <dali/internal/event/effects/shader-factory.h>
43 #include <dali/internal/update/modeling/internal-mesh-data.h>
44 #include <dali/internal/update/modeling/scene-graph-mesh-declarations.h>
45 #include <dali/internal/update/resources/resource-manager-declarations.h>
46 #include <dali/internal/update/resources/bitmap-metadata.h>
51 typedef boost::hash<const std::string> StringHash;
63 // value types used by messages
64 template <> struct ParameterType< Integration::LoadResourcePriority >
65 : public BasicType< Integration::LoadResourcePriority > {};
66 template <> struct ParameterType< Pixel::Format >
67 : public BasicType< Pixel::Format > {};
68 template <> struct ParameterType< Integration::ResourceTypeId >
69 : public BasicType< Integration::ResourceTypeId > {};
75 class TextureCacheDispatcher;
76 class PostProcessResourceDispatcher;
79 class NotificationManager;
81 /** Raw bytes of a resource laid out exactly as it wouldbe in a file, but in memory. */
82 typedef Dali::RefCountedVector<uint8_t> RequestBuffer;
83 /** Counting smart pointer for managing a buffer of raw bytes. */
84 typedef IntrusivePtr<RequestBuffer> RequestBufferPtr;
87 * ResourceManager keeps track of resource loading requests, and caches resources that are loaded.
88 * It uses ResourceTicket objects, to keep track of the lifetime of each request.
89 * If the same resource is required by two client objects, they will share the same ResourceTicket
90 * i.e. only one load will occur using the native filesystem.
92 * Multi-threading notes:
93 * Resources are received from the PlatformAbstraction API during the Core::Render() method, which
94 * may be called from a dedicated rendering thread.
95 * Loading requests must be made from the application's main thread e.g. when Dali::Image is created.
97 class ResourceManager : public Integration::ResourceCache
102 * Create a resource manager.
103 * There should exactly one of these objects per Dali Core.
104 * @param[in] platformAbstraction Used to request resources from the native filesystem.
105 * @param[in] notificationManager Used to send NotifyTickets message.
106 * @param[in] postProcessResourcesQueue Used for performing post processing on resources
107 * @param[in] discardQueue Used to cleanup nodes & resources when no longer in use.
108 * @param[in] renderQueue Used to queue resource updates until the next Render.
110 ResourceManager( Integration::PlatformAbstraction& platformAbstraction,
111 NotificationManager& notificationManager,
112 SceneGraph::TextureCacheDispatcher& textureCacheDispatcher,
113 ResourcePostProcessList& postProcessResourcesQueue,
114 SceneGraph::PostProcessResourceDispatcher& postProcessResourceDispatcher,
115 SceneGraph::DiscardQueue& discardQueue,
116 SceneGraph::RenderQueue& renderQueue );
119 * Virtual destructor.
121 virtual ~ResourceManager();
123 public: // Used by ResourceClient
125 /********************************************************************************
126 ************************ ResourceClient direct interface **********************
127 ********************************************************************************/
130 * Resource client passes itself for secondary intialisation.
131 * (The resource client requires the ResourceManager to be instantiated first).
132 * @param[in] resourceClient The ResourceClient.
134 void SetClient( ResourceClient& resourceClient );
136 /********************************************************************************
137 ************************ UpdateManager direct interface ***********************
138 ********************************************************************************/
141 * Called to update the resource cache before rendering.
142 * New resources will be added to the cache using PlatformAbstraction::FillResourceCache().
143 * Unwanted resources will be added to the DiscardQueue.
144 * @param[in] updateBufferIndex The current update buffer index.
145 * @return true, if a resource load was completed or failed
147 bool UpdateCache( BufferIndex updateBufferIndex );
150 * Iterate through the post process queue, performing requested updates.
151 * @param[in] updateBufferIndex The current update buffer index.
153 void PostProcessResources( BufferIndex updateBufferIndex );
155 /********************************************************************************
156 *************************** CoreImpl direct interface *************************
157 ********************************************************************************/
160 * Returns whether the Resource Manager is still processing any resource requests.
161 * @return true if still processing, false otherwise.
163 bool ResourcesToProcess();
165 /********************************************************************************
166 ********************************* Message handlers *****************************
167 ********************************************************************************/
170 * Request a resource from the native filesystem.
171 * @param[in] id The Id of the requested resource
172 * @param[in] typePath The type & path of requested resource.
173 * @param[in] priority The priority of the request. This is ignored if the resource is already being loaded.
175 void HandleLoadResourceRequest( ResourceId id,
176 const ResourceTypePath& typePath,
177 Integration::LoadResourcePriority priority );
180 * Decode a resource from a memory buffer with the semantics of loading.
181 * Notifications of partial completion, success, and failure will happen via
182 * the same loading notification path used for loading from files: Update()
183 * will retrieve loading events in its main loop and notify listeners to its
184 * own loading events, and forward them, still as loading events, to the event
185 * thread via its update queue.
186 * Resource manager and lower levels make no attempt to detect resource
187 * aliases as is done for multiple requests to load the same resource
188 * file, so the caller is responsible for ensuring that it only requests
189 * the decoding of an in-memory resource once and for doing the sharing of the
190 * resulting object itself. Ultimately this responsibility resides with the
192 * @note ! Only Bitmap resources are supported for decoding from memory !
193 * @param[in] id The Id of the requested resource.
194 * @param[in] typePath The type of the requested resource and a path that is ignored.
195 * @param[in] buffer The raw encoded bytes of the resource as they would appear in a file.
196 * @param[in] priority The priority of the request. This is ignored if the resource is already being loaded.
198 void HandleDecodeResourceRequest( ResourceId id,
199 const ResourceTypePath& typePath,
200 RequestBufferPtr buffer,
201 Integration::LoadResourcePriority priority );
204 * Injects a bitmap resource (does not require loading).
205 * @pre bitmap has to be initialized
206 * @param[in] id The resource id
207 * @param[in] bitmap an initialized bitmap
209 void HandleAddBitmapImageRequest(ResourceId id, Integration::Bitmap* bitmap);
212 * Add an existing resource to the resource manager.
213 * @param[in] id The resource id
214 * @param [in] resourceData the NativeImage object
215 * @return A ref-counted request object. Keep a copy until the resource is no longer required.
217 void HandleAddNativeImageRequest( ResourceId id, NativeImagePtr resourceData );
220 * Add an existing resource to the resource manager.
221 * @param[in] id The resource id
222 * @param[in] width width in pixels
223 * @param[in] height height in pixels
224 * @param[in] pixelFormat Pixel format
226 void HandleAddFrameBufferImageRequest( ResourceId id, unsigned int width, unsigned int height, Pixel::Format pixelFormat );
229 * Add an existing resource to the resource manager.
230 * @param[in] id The resource id
231 * @param[in] nativeImage The NativeImage
233 void HandleAddFrameBufferImageRequest( ResourceId id, NativeImagePtr nativeImage );
236 * Allocate a new empty texture.
237 * @param[in] id The resource id
238 * @param[in] width width in pixels
239 * @param[in] height height in pixels
240 * @param[in] pixelFormat Pixel format
242 void HandleAllocateTextureRequest( ResourceId id, unsigned int width, unsigned int height, Pixel::Format pixelFormat );
245 * Upload an array of bitmaps to a texture.
246 * @param[in] id The resource id
247 * @param[in] uploadArray bitmap upload array.
249 void HandleUpdateTextureRequest( ResourceId id, const BitmapUploadArray& uploadArray );
252 * Requests allocation of a mesh resource
253 * @param[in] id The resource id
254 * @param[in] meshData The mesh data
256 void HandleAllocateMeshRequest (ResourceId id, MeshData* meshData);
259 * Requests allocation of a font resource
261 void HandleAllocateFontRequest(ResourceId id, const std::string& familyNameAndStyle);
264 * Load a shader program from a file
265 * @param[in] id The resource id
266 * @param[in] typePath The type & path of the resource
268 void HandleLoadShaderRequest(ResourceId id, const ResourceTypePath& typePath );
271 * Update bitmap area request
272 * @param[in] textureId The resource ID of a bitmap-texture to remove.
273 * @param[in] area The updated area. Zero width/height indicates the whole bitmap has been updated
275 void HandleUpdateBitmapAreaRequest( ResourceId textureId, const Dali::RectArea& area );
278 * Upload mesh buffer changes.
279 * @param[in] updateBufferIndex The current update buffer index.
280 * @param[in] id The ID of a Mesh resource.
281 * @param[in] meshData Newly allocated mesh data; ownership is taken.
283 void HandleUpdateMeshRequest( BufferIndex updateBufferIndex, ResourceId id, MeshData* meshData );
286 * Request reloading a resource from the native filesystem.
287 * @param[in] id The resource id
288 * @param[in] typePath The type & path of the resource
289 * @param[in] priority The priority of the request. This is ignored if the resource is already being refreshed.
291 void HandleReloadResourceRequest( ResourceId id, const ResourceTypePath& typePath, Integration::LoadResourcePriority priority );
294 * Save a resource to the given url
295 * @param[in] id The resource id
296 * @param[in] typePath The type & path of the resource
298 void HandleSaveResourceRequest( ResourceId id, const ResourceTypePath& typePath );
301 * Resource ticket has been discarded, throw away the actual resource
303 void HandleDiscardResourceRequest( ResourceId id, Integration::ResourceTypeId typeId );
306 * Update font texture atlas status
307 * @param[in] id The resource id
308 * @param[in] atlasId texture ID of the atlas
309 * @param[in] loadStatus The status update.
311 void HandleAtlasUpdateRequest( ResourceId id, ResourceId atlasId, Integration::LoadStatus loadStatus );
313 /********************************************************************************
314 ******************** Event thread object direct interface *********************
315 ********************************************************************************/
318 * Called by model implementations which require access to the model
320 * @note Only called from event thread objects - ModelData is not used
322 * @param[in] id - the id of a ModelData resource.
323 * @return the model data or NULL if it has not been loaded.
325 Internal::ModelDataPtr GetModelData(ResourceId id);
327 /********************************************************************************
328 ******************** Update thread object direct interface ********************
329 ********************************************************************************/
332 * Check if a resource has completed loading.
333 * @param[in] id The ID of a bitmap/texture resource.
334 * @return true if the bitmap or texture has finished loading
336 bool IsResourceLoaded(ResourceId id);
339 * Check if a resource has failed to load, e.g. file not found, etc.
340 * @param[in] id The ID of a bitmap/texture resource.
341 * @return true if the bitmap or texture has failed to load
343 bool IsResourceLoadFailed(ResourceId id);
346 * Get bitmap metadata. This stores meta data about the resource, but
347 * doesn't keep track of the resource
349 BitmapMetadata GetBitmapMetadata(ResourceId id);
353 * @note Used by update thread objects (SceneGraph::Mesh) only
354 * @param[in] id - the id of a MeshData resource.
355 * @return the mesh data or NULL if this resource isn't valid
357 Internal::SceneGraph::Mesh* GetMesh(ResourceId id);
360 * Returns the shader resource corresponding to the Id
361 * @param[in] id - the id of a shader binary resource.
362 * @return the shader binary resource data or NULL if it has not been loaded.
364 Integration::ShaderDataPtr GetShaderData(ResourceId id);
367 * Check if current set of glyph requests on given atlas have finished loading
368 * @param[in] id Request Id of the text atlas texture
369 * @return true if the current set of glyph requests have all completed, false
370 * if there are outstanding glyph requests that haven't finished.
372 bool IsAtlasLoaded(ResourceId id);
375 * Check the load status of a given atlas.
376 * @param[in] id Request Id of the text atlas texture
379 Integration::LoadStatus GetAtlasLoadStatus( ResourceId atlasId );
381 /********************************************************************************
382 ************************* ResourceCache Implementation ************************
383 ********************************************************************************/
387 * @copydoc Integration::ResourceCache::LoadResponse
389 virtual void LoadResponse(ResourceId id, Integration::ResourceTypeId type, Integration::ResourcePointer resource, Integration::LoadStatus loadStatus);
392 * @copydoc Integration::ResourceCache::SaveComplete
394 virtual void SaveComplete(ResourceId id, Integration::ResourceTypeId type);
397 * @copydoc Integration::ResourceCache::LoadFailed
399 virtual void LoadFailed(ResourceId id, Integration::ResourceFailure failure);
402 * @copydoc Integration::ResourceCache::SaveFailed
404 virtual void SaveFailed(ResourceId id, Integration::ResourceFailure failure);
406 /********************************************************************************
407 ********************************* Private Methods *****************************
408 ********************************************************************************/
411 * @param[in] id Resource id to clear
412 * @param[in] typePath Glyphs to be loaded, and cleared beforehand
414 void ClearRequestedGlyphArea( ResourceId id, const ResourceTypePath& typePath );
417 * Sends loaded glyphs to texture atlas for uploading
418 * @param[in] glyphSet Loaded glyphs
420 void UploadGlyphsToTexture( const Integration::GlyphSet& glyphSet );
423 * Sends notification messages for load sucess & failure,
424 * pushes from newComplete / newFailed into oldComplete / oldFailed respectively
426 void NotifyTickets();
429 * Triggers message to Event thread to update the ticket's image attributes
430 * @pre An Image resource with the given id should exist in the cache.
431 * @param id ID of the image resource
432 * @param attributes Resource image attributes
434 void UpdateImageTicket( ResourceId id, ImageAttributes& attributes );
437 * Send message to ResourceClient in event thread
438 * @param[in] message The message to send
440 void SendToClient( MessageBase* message );
443 * Discard all dead resources.
444 * @param[in] updateBufferIndex The current update buffer index.
446 void DiscardDeadResources( BufferIndex updateBufferIndex );
449 struct ResourceManagerImpl;
450 ResourceManagerImpl* mImpl;
453 // Messages sent to resource manager from other threads:
454 // These functions are run on other threads and insert messages to be
455 // picked-up by the update thread in its main loop and executed on that in
458 inline void RequestLoadResourceMessage( EventToUpdate& eventToUpdate,
459 ResourceManager& manager,
461 const ResourceTypePath& typePath,
462 Integration::LoadResourcePriority priority )
464 typedef MessageValue3< ResourceManager, ResourceId, ResourceTypePath, Integration::LoadResourcePriority > LocalType;
466 // Reserve some memory inside the message queue
467 unsigned int* slot = eventToUpdate.ReserveMessageSlot( sizeof( LocalType ), false );
469 // Construct message in the message queue memory; note that delete should not be called on the return value
470 new (slot) LocalType( &manager, &ResourceManager::HandleLoadResourceRequest, id, typePath, priority );
473 inline void RequestDecodeResourceMessage( EventToUpdate& eventToUpdate,
474 ResourceManager& manager,
476 /// We use typePath instead of the raw type for ownership and to enable copying of a concrete type.
477 const ResourceTypePath& typePath,
478 RequestBufferPtr buffer,
479 Integration::LoadResourcePriority priority )
481 typedef MessageValue4< ResourceManager, ResourceId, ResourceTypePath, RequestBufferPtr, Integration::LoadResourcePriority > LocalType;
483 // Reserve some memory inside the message queue
484 unsigned int* slot = eventToUpdate.ReserveMessageSlot( sizeof( LocalType ), false );
486 // Construct message in the message queue memory; note that delete should not be called on the return value
487 new (slot) LocalType( &manager, &ResourceManager::HandleDecodeResourceRequest, id, typePath, buffer, priority );
490 inline void RequestAddBitmapImageMessage( EventToUpdate& eventToUpdate,
491 ResourceManager& manager,
493 Integration::Bitmap* resourceData )
495 typedef MessageValue2< ResourceManager, ResourceId, Integration::Bitmap* > LocalType;
497 // Reserve some memory inside the message queue
498 unsigned int* slot = eventToUpdate.ReserveMessageSlot( sizeof( LocalType ) );
500 // Construct message in the message queue memory; note that delete should not be called on the return value
501 new (slot) LocalType( &manager, &ResourceManager::HandleAddBitmapImageRequest, id, resourceData );
504 inline void RequestAddNativeImageMessage( EventToUpdate& eventToUpdate,
505 ResourceManager& manager,
507 NativeImagePtr resourceData )
509 typedef MessageValue2< ResourceManager, ResourceId, NativeImagePtr > LocalType;
511 // Reserve some memory inside the message queue
512 unsigned int* slot = eventToUpdate.ReserveMessageSlot( sizeof( LocalType ) );
514 // Construct message in the message queue memory; note that delete should not be called on the return value
515 new (slot) LocalType( &manager, &ResourceManager::HandleAddNativeImageRequest, id, resourceData );
518 inline void RequestAddFrameBufferImageMessage( EventToUpdate& eventToUpdate,
519 ResourceManager& manager,
523 Pixel::Format pixelFormat )
525 typedef MessageValue4< ResourceManager, ResourceId, unsigned int, unsigned int, Pixel::Format > LocalType;
527 // Reserve some memory inside the message queue
528 unsigned int* slot = eventToUpdate.ReserveMessageSlot( sizeof( LocalType ) );
530 // Construct message in the message queue memory; note that delete should not be called on the return value
531 new (slot) LocalType( &manager, &ResourceManager::HandleAddFrameBufferImageRequest, id, width, height, pixelFormat );
534 inline void RequestAddFrameBufferImageMessage( EventToUpdate& eventToUpdate,
535 ResourceManager& manager,
537 NativeImagePtr resourceData )
539 typedef MessageValue2< ResourceManager, ResourceId, NativeImagePtr > LocalType;
541 // Reserve some memory inside the message queue
542 unsigned int* slot = eventToUpdate.ReserveMessageSlot( sizeof( LocalType ) );
544 // Construct message in the message queue memory; note that delete should not be called on the return value
545 new (slot) LocalType( &manager, &ResourceManager::HandleAddFrameBufferImageRequest, id, resourceData );
548 inline void RequestAllocateTextureMessage(EventToUpdate& eventToUpdate,
549 ResourceManager& manager,
553 Pixel::Format pixelFormat)
555 typedef MessageValue4< ResourceManager, ResourceId, unsigned int, unsigned int, Pixel::Format > LocalType;
557 // Reserve some memory inside the message queue
558 unsigned int* slot = eventToUpdate.ReserveMessageSlot( sizeof( LocalType ) );
560 // Construct message in the message queue memory; note that delete should not be called on the return value
561 new (slot) LocalType( &manager, &ResourceManager::HandleAllocateTextureRequest, id, width, height, pixelFormat );
564 inline void RequestUpdateTextureMessage(EventToUpdate& eventToUpdate,
565 ResourceManager& manager,
567 BitmapUploadArray uploadArray )
569 typedef MessageValue2< ResourceManager, ResourceId, BitmapUploadArray > LocalType;
571 // Reserve some memory inside the message queue
572 unsigned int* slot = eventToUpdate.ReserveMessageSlot( sizeof( LocalType ) );
574 // Construct message in the message queue memory; note that delete should not be called on the return value
575 new (slot) LocalType( &manager, &ResourceManager::HandleUpdateTextureRequest, id, uploadArray );
578 inline void RequestAllocateMeshMessage( EventToUpdate& eventToUpdate,
579 ResourceManager& manager,
581 OwnerPointer<MeshData>& meshData )
583 typedef MessageValue2< ResourceManager, ResourceId, OwnerPointer<MeshData> > LocalType;
585 // Reserve some memory inside the message queue
586 unsigned int* slot = eventToUpdate.ReserveMessageSlot( sizeof( LocalType ) );
588 // Construct message in the message queue memory; note that delete should not be called on the return value
589 new (slot) LocalType( &manager, &ResourceManager::HandleAllocateMeshRequest, id, meshData.Release() );
592 inline void RequestAllocateFontMessage( EventToUpdate& eventToUpdate,
593 ResourceManager& manager,
595 const std::string& familyNameAndStyle)
597 typedef MessageValue2< ResourceManager, ResourceId, std::string > LocalType;
599 // Reserve some memory inside the message queue
600 unsigned int* slot = eventToUpdate.ReserveMessageSlot( sizeof( LocalType ) );
602 // Construct message in the message queue memory; note that delete should not be called on the return value
603 new (slot) LocalType( &manager, &ResourceManager::HandleAllocateFontRequest, id, familyNameAndStyle );
606 inline void RequestLoadShaderMessage( EventToUpdate& eventToUpdate,
607 ResourceManager& manager,
609 const ResourceTypePath& typePath )
611 typedef MessageValue2< ResourceManager, ResourceId, ResourceTypePath > LocalType;
613 // Reserve some memory inside the message queue
614 unsigned int* slot = eventToUpdate.ReserveMessageSlot( sizeof( LocalType ) );
616 // Construct message in the message queue memory; note that delete should not be called on the return value
617 new (slot) LocalType( &manager, &ResourceManager::HandleLoadShaderRequest, id, typePath );
620 inline void RequestUpdateBitmapAreaMessage( EventToUpdate& eventToUpdate,
621 ResourceManager& manager,
623 const Dali::RectArea& area )
625 typedef MessageValue2< ResourceManager, ResourceId, Dali::RectArea > LocalType;
627 // Reserve some memory inside the message queue
628 unsigned int* slot = eventToUpdate.ReserveMessageSlot( sizeof( LocalType ), false );
630 // Construct message in the message queue memory; note that delete should not be called on the return value
631 new (slot) LocalType( &manager, &ResourceManager::HandleUpdateBitmapAreaRequest, id, area );
634 inline void RequestUpdateMeshMessage( EventToUpdate& eventToUpdate,
635 ResourceManager& manager,
637 const Dali::MeshData& meshData )
639 typedef MessageDoubleBuffered2< ResourceManager, ResourceId, OwnerPointer< MeshData > > LocalType;
641 // Reserve some memory inside the message queue
642 unsigned int* slot = eventToUpdate.ReserveMessageSlot( sizeof( LocalType ) );
644 MeshData* internalMeshData = new MeshData( meshData, true, false );
646 // Construct message in the message queue memory; note that delete should not be called on the return value
647 new (slot) LocalType( &manager, &ResourceManager::HandleUpdateMeshRequest, id, internalMeshData );
650 inline void RequestReloadResourceMessage( EventToUpdate& eventToUpdate,
651 ResourceManager& manager,
653 const ResourceTypePath& typePath,
654 Integration::LoadResourcePriority priority )
656 typedef MessageValue3< ResourceManager, ResourceId, ResourceTypePath, Integration::LoadResourcePriority > LocalType;
658 // Reserve some memory inside the message queue
659 unsigned int* slot = eventToUpdate.ReserveMessageSlot( sizeof( LocalType ), false );
661 // Construct message in the message queue memory; note that delete should not be called on the return value
662 new (slot) LocalType( &manager, &ResourceManager::HandleReloadResourceRequest, id, typePath, priority );
665 inline void RequestSaveResourceMessage( EventToUpdate& eventToUpdate,
666 ResourceManager& manager,
668 const ResourceTypePath& typePath )
670 typedef MessageValue2< ResourceManager, ResourceId, ResourceTypePath > LocalType;
672 // Reserve some memory inside the message queue
673 unsigned int* slot = eventToUpdate.ReserveMessageSlot( sizeof( LocalType ) );
675 // Construct message in the message queue memory; note that delete should not be called on the return value
676 new (slot) LocalType( &manager, &ResourceManager::HandleSaveResourceRequest, id, typePath );
679 inline void RequestDiscardResourceMessage( EventToUpdate& eventToUpdate,
680 ResourceManager& manager,
682 Integration::ResourceTypeId typeId )
684 typedef MessageValue2< ResourceManager, ResourceId, Integration::ResourceTypeId > LocalType;
686 // Reserve some memory inside the message queue
687 unsigned int* slot = eventToUpdate.ReserveMessageSlot( sizeof( LocalType ) );
689 // Construct message in the message queue memory; note that delete should not be called on the return value
690 new (slot) LocalType( &manager, &ResourceManager::HandleDiscardResourceRequest, id, typeId );
693 inline void RequestAtlasUpdateMessage( EventToUpdate& eventToUpdate,
694 ResourceManager& manager,
697 Integration::LoadStatus loadStatus )
699 typedef MessageValue3< ResourceManager, ResourceId, ResourceId, Integration::LoadStatus > LocalType;
701 // Reserve some memory inside the message queue
702 unsigned int* slot = eventToUpdate.ReserveMessageSlot( sizeof( LocalType ) );
704 // Construct message in the message queue memory; note that delete should not be called on the return value
705 new (slot) LocalType( &manager, &ResourceManager::HandleAtlasUpdateRequest, id, atlasId, loadStatus );
708 } // namespace Internal
712 #endif // __DALI_INTERNAL_RESOURCE_MANAGER_H__