X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fimage-loader%2Fimage-load-thread.h;fp=dali-toolkit%2Finternal%2Fimage-atlas%2Fimage-load-thread.h;h=4eddce719f4f2accc42b1d703c8ce093c33ab4d5;hp=700815c5fbba37c17ee4c934fc5659bcd0fce1c4;hb=41307f75478fd6c6fb5f9ae7e7de5036647f39b3;hpb=0b656e1b343a93e2c9a92f50e84e3b30575a494d diff --git a/dali-toolkit/internal/image-atlas/image-load-thread.h b/dali-toolkit/internal/image-loader/image-load-thread.h similarity index 59% rename from dali-toolkit/internal/image-atlas/image-load-thread.h rename to dali-toolkit/internal/image-loader/image-load-thread.h index 700815c..4eddce7 100644 --- a/dali-toolkit/internal/image-atlas/image-load-thread.h +++ b/dali-toolkit/internal/image-loader/image-load-thread.h @@ -43,7 +43,7 @@ struct LoadingTask /** * Constructor. */ - LoadingTask( BitmapLoader loader, uint32_t packPositionX, uint32_t packPositionY, uint32_t width, uint32_t height ); + LoadingTask( uint32_t id, BitmapLoader loader ); private: @@ -55,123 +55,69 @@ private: public: - BitmapLoader loader; ///< The loader used to load the bitmap from URL - Rect packRect; ///< The x coordinate of the position to pack the image. - + BitmapLoader loader; ///< The loader used to load the bitmap from URL + uint32_t id; ///< The id associated with this task. }; + /** - * The queue of the tasks waiting to load the bitmap from the URL in the worker thread/ + * The worker thread for image loading. */ -class LoadQueue //: public TaskQueue +class ImageLoadThread : public Thread { public: /** - * Constructor + * Constructor. + * + * @param[in] mTrigger The trigger to wake up the main thread. */ - LoadQueue(); + ImageLoadThread( EventThreadCallback* mTrigger ); /** * Destructor. */ - ~LoadQueue(); - - /** - * Pop the next task out from the queue. - * - * @return The next task to be processed. - */ - LoadingTask* NextTask(); + virtual ~ImageLoadThread(); /** - * Add a task in to the queue + * Add a task in to the loading queue * * @param[in] task The task added to the queue. */ void AddTask( LoadingTask* task ); -private: - - // Undefined - LoadQueue( const LoadQueue& queue ); - - // Undefined - LoadQueue& operator=( const LoadQueue& queue ); - -private: - - Vector< LoadingTask* > mTasks; - ConditionalWait mConditionalWait; -}; - -/** - * The queue of the tasks, with the image loaded, waiting for the main thread to upload the bitmap. - */ -class CompleteQueue //: public TaskQueue -{ -public: - /** - * Constructor + * Pop the next task out from the completed queue. * - * @param[in] mTrigger The trigger to wake up the main thread. - */ - CompleteQueue( EventThreadCallback* mTrigger ); - - /** - * Destructor. + * @return The next task to be processed. */ - ~CompleteQueue(); + LoadingTask* NextCompletedTask(); /** - * Pop the next task out from the queue. - * - * @return The next task to be processed. + * Remove the loading task from the waiting queue. */ - LoadingTask* NextTask(); + bool CancelTask( uint32_t loadingTaskId ); /** - * Add a task in to the queue - * - * @param[in] task The task added to the queue. + * Remove all the loading tasks in the waiting queue. */ - void AddTask( LoadingTask* task ); - -private: - - // Undefined - CompleteQueue( const CompleteQueue& queue ); - - // Undefined - CompleteQueue& operator=( const CompleteQueue& queue ); + void CancelAll(); private: - Vector< LoadingTask* > mTasks; - Dali::Mutex mMutex; - EventThreadCallback* mTrigger; -}; - -/** - * The worker thread for image loading. - */ -class ImageLoadThread : public Thread -{ -public: - /** - * Constructor. + * Pop the next loading task out from the queue to process. * - * @param[in] loadQueue The task queue with images for loading. - * @param[in] completeQurue The task queue with images loaded. + * @return The next task to be processed. */ - ImageLoadThread( LoadQueue& loadQueue, CompleteQueue& completeQueue ); + LoadingTask* NextTaskToProcess(); /** - * Destructor. + * Add a task in to the loading queue + * + * @param[in] task The task added to the queue. */ - virtual ~ImageLoadThread(); + void AddCompletedTask( LoadingTask* task ); protected: @@ -191,8 +137,12 @@ private: private: - LoadQueue& mLoadQueue; /// mLoadQueue; /// mCompleteQueue; ///