#pragma once #include "V8Tree/Instance.h" #include "V8Tree/Service.h" #include "Util/LRUCache.h" #include "Util/ContentId.h" namespace RBX { class KeyframeSequence; extern const char* const sKeyframeSequenceProvider; class KeyframeSequenceProvider : public DescribedNonCreatable , public Service { private: int activeKeyframeId; std::map > activeKeyframeTable; typedef SizeEnforcedLRUCache > KeyframeSequenceCache; boost::mutex keyframeSequenceCacheMutex; //synchronizes the keyframeSequenceCache KeyframeSequenceCache keyframeSequenceCache; shared_ptr privateGetKeyframeSequence(ContentId assetId, bool blocking, bool useCache, const std::string& contextString = "", const Instance* contextInstance = NULL); void JSONHttpHelper(const std::string* response, const std::exception* exception, boost::function)> resumeFunction, boost::function errorFunction); public: KeyframeSequenceProvider(); ContentId registerKeyframeSequence(shared_ptr keyframeSequence); ContentId registerActiveKeyframeSequence(shared_ptr keyframeSequence); shared_ptr getKeyframeSequenceLua(ContentId assetId); shared_ptr getKeyframeSequenceByIdLua(int assetId, bool useCache); shared_ptr getKeyframeSequence(ContentId assetId, const Instance* context); void getAnimations(int userId, int page, boost::function)> resumeFunction, boost::function errorFunction); }; }