forked from organicmaps/organicmaps
renamed mergeResources into updatePoolState for consistency.
This commit is contained in:
parent
8be29e4490
commit
dedcdd220c
6 changed files with 45 additions and 48 deletions
|
@ -51,8 +51,7 @@ struct BasePoolTraits
|
|||
return m_pool.IsCancelled();
|
||||
}
|
||||
|
||||
/// non-intuitive name, should refactor to more meaningfull
|
||||
void Merge()
|
||||
void UpdateState()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
@ -87,7 +86,7 @@ struct SeparateFreePoolTraits : TBase
|
|||
}
|
||||
}
|
||||
|
||||
void MergeImpl(list<elem_t> & l)
|
||||
void UpdateStateImpl(list<elem_t> & l)
|
||||
{
|
||||
for (typename list<elem_t>::const_iterator it = l.begin();
|
||||
it != l.end();
|
||||
|
@ -103,9 +102,9 @@ struct SeparateFreePoolTraits : TBase
|
|||
l.clear();
|
||||
}
|
||||
|
||||
void Merge()
|
||||
void UpdateState()
|
||||
{
|
||||
m_freePool.ProcessList(bind(&SeparateFreePoolTraits<TElemFactory, TBase>::MergeImpl, this, _1));
|
||||
m_freePool.ProcessList(bind(&SeparateFreePoolTraits<TElemFactory, TBase>::UpdateStateImpl, this, _1));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -189,7 +188,7 @@ public:
|
|||
virtual void EnterBackground() = 0;
|
||||
virtual void Cancel() = 0;
|
||||
virtual bool IsCancelled() const = 0;
|
||||
virtual void Merge() = 0;
|
||||
virtual void UpdateState() = 0;
|
||||
virtual void SetIsDebugging(bool flag) = 0;
|
||||
};
|
||||
|
||||
|
@ -245,9 +244,9 @@ public:
|
|||
return m_traits->IsCancelled();
|
||||
}
|
||||
|
||||
void Merge()
|
||||
void UpdateState()
|
||||
{
|
||||
m_traits->Merge();
|
||||
m_traits->UpdateState();
|
||||
}
|
||||
|
||||
void SetIsDebugging(bool isDebugging)
|
||||
|
|
|
@ -57,7 +57,7 @@ void QueuedRenderPolicy::DrawFrame(shared_ptr<PaintEvent> const & ev, ScreenBase
|
|||
for (unsigned i = 0; i < m_PipelinesCount; ++i)
|
||||
{
|
||||
RenderQueuedCommands(i, state);
|
||||
m_resourceManager->mergeFreeResources();
|
||||
m_resourceManager->updatePoolState();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -179,7 +179,7 @@ void RenderPolicyMT::EndFrame(shared_ptr<PaintEvent> const & e,
|
|||
void RenderPolicyMT::DrawFrame(shared_ptr<PaintEvent> const & e,
|
||||
ScreenBase const & s)
|
||||
{
|
||||
m_resourceManager->mergeFreeResources();
|
||||
m_resourceManager->updatePoolState();
|
||||
|
||||
m_renderQueue->renderStatePtr()->m_doRepaintAll = DoForceUpdate();
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ namespace yg
|
|||
|
||||
struct FreeStorage : public Command
|
||||
{
|
||||
ResourceManager::TStoragePool * m_storagePool;
|
||||
TStoragePool * m_storagePool;
|
||||
Storage m_storage;
|
||||
|
||||
void perform();
|
||||
|
@ -95,7 +95,7 @@ namespace yg
|
|||
|
||||
struct FreeTexture : public Command
|
||||
{
|
||||
ResourceManager::TTexturePool * m_texturePool;
|
||||
TTexturePool * m_texturePool;
|
||||
shared_ptr<BaseTexture> m_texture;
|
||||
|
||||
void perform();
|
||||
|
|
|
@ -666,68 +666,68 @@ namespace yg
|
|||
return 1 + m_params.m_glyphCacheParams.m_renderThreadCount;
|
||||
}
|
||||
|
||||
ResourceManager::TStoragePool * ResourceManager::primaryStorages()
|
||||
TStoragePool * ResourceManager::primaryStorages()
|
||||
{
|
||||
return m_primaryStorages.get();
|
||||
}
|
||||
|
||||
ResourceManager::TStoragePool * ResourceManager::smallStorages()
|
||||
TStoragePool * ResourceManager::smallStorages()
|
||||
{
|
||||
return m_smallStorages.get();
|
||||
}
|
||||
|
||||
ResourceManager::TStoragePool * ResourceManager::guiThreadStorages()
|
||||
TStoragePool * ResourceManager::guiThreadStorages()
|
||||
{
|
||||
return m_guiThreadStorages.get();
|
||||
}
|
||||
|
||||
ResourceManager::TStoragePool * ResourceManager::blitStorages()
|
||||
TStoragePool * ResourceManager::blitStorages()
|
||||
{
|
||||
return m_blitStorages.get();
|
||||
}
|
||||
|
||||
ResourceManager::TStoragePool * ResourceManager::multiBlitStorages()
|
||||
TStoragePool * ResourceManager::multiBlitStorages()
|
||||
{
|
||||
return m_multiBlitStorages.get();
|
||||
}
|
||||
|
||||
ResourceManager::TTexturePool * ResourceManager::primaryTextures()
|
||||
TTexturePool * ResourceManager::primaryTextures()
|
||||
{
|
||||
return m_primaryTextures.get();
|
||||
}
|
||||
|
||||
ResourceManager::TTexturePool * ResourceManager::fontTextures()
|
||||
TTexturePool * ResourceManager::fontTextures()
|
||||
{
|
||||
return m_fontTextures.get();
|
||||
}
|
||||
|
||||
ResourceManager::TTexturePool * ResourceManager::renderTargetTextures()
|
||||
TTexturePool * ResourceManager::renderTargetTextures()
|
||||
{
|
||||
return m_renderTargets.get();
|
||||
}
|
||||
|
||||
ResourceManager::TTexturePool * ResourceManager::styleCacheTextures()
|
||||
TTexturePool * ResourceManager::styleCacheTextures()
|
||||
{
|
||||
return m_styleCacheTextures.get();
|
||||
}
|
||||
|
||||
ResourceManager::TTexturePool * ResourceManager::guiThreadTextures()
|
||||
TTexturePool * ResourceManager::guiThreadTextures()
|
||||
{
|
||||
return m_guiThreadTextures.get();
|
||||
}
|
||||
|
||||
void ResourceManager::mergeFreeResources()
|
||||
void ResourceManager::updatePoolState()
|
||||
{
|
||||
if (m_guiThreadStorages.get())
|
||||
m_guiThreadStorages->Merge();
|
||||
m_guiThreadStorages->UpdateState();
|
||||
if (m_primaryStorages.get())
|
||||
m_primaryStorages->Merge();
|
||||
m_primaryStorages->UpdateState();
|
||||
if (m_smallStorages.get())
|
||||
m_smallStorages->Merge();
|
||||
m_smallStorages->UpdateState();
|
||||
if (m_blitStorages.get())
|
||||
m_blitStorages->Merge();
|
||||
m_blitStorages->UpdateState();
|
||||
if (m_multiBlitStorages.get())
|
||||
m_multiBlitStorages->Merge();
|
||||
m_multiBlitStorages->UpdateState();
|
||||
}
|
||||
|
||||
void ResourceManager::cancel()
|
||||
|
|
|
@ -50,27 +50,25 @@ namespace yg
|
|||
void BeforeMerge(gl::Storage const & e);
|
||||
};
|
||||
|
||||
typedef BasePoolTraits<shared_ptr<gl::BaseTexture>, TTextureFactory> TBaseTexturePoolTraits;
|
||||
typedef FixedSizePoolTraits<TTextureFactory, TBaseTexturePoolTraits > TTexturePoolTraits;
|
||||
typedef ResourcePoolImpl<TTexturePoolTraits> TTexturePoolImpl;
|
||||
|
||||
typedef ResourcePool<shared_ptr<gl::BaseTexture> > TTexturePool;
|
||||
|
||||
typedef BasePoolTraits<gl::Storage, TStorageFactory> TBaseStoragePoolTraits;
|
||||
typedef SeparateFreePoolTraits<TStorageFactory, TBaseStoragePoolTraits> TSeparateFreeStoragePoolTraits;
|
||||
|
||||
typedef FixedSizePoolTraits<TStorageFactory, TSeparateFreeStoragePoolTraits> TMergeableStoragePoolTraits;
|
||||
typedef ResourcePoolImpl<TMergeableStoragePoolTraits> TMergeableStoragePoolImpl;
|
||||
|
||||
typedef FixedSizePoolTraits<TStorageFactory, TBaseStoragePoolTraits> TNonMergeableStoragePoolTraits;
|
||||
typedef ResourcePoolImpl<TNonMergeableStoragePoolTraits> TNonMergeableStoragePoolImpl;
|
||||
|
||||
typedef ResourcePool<gl::Storage> TStoragePool;
|
||||
|
||||
class ResourceManager
|
||||
{
|
||||
public:
|
||||
|
||||
typedef BasePoolTraits<shared_ptr<gl::BaseTexture>, TTextureFactory> TBaseTexturePoolTraits;
|
||||
typedef FixedSizePoolTraits<TTextureFactory, TBaseTexturePoolTraits > TTexturePoolTraits;
|
||||
typedef ResourcePoolImpl<TTexturePoolTraits> TTexturePoolImpl;
|
||||
|
||||
typedef ResourcePool<shared_ptr<gl::BaseTexture> > TTexturePool;
|
||||
|
||||
typedef BasePoolTraits<gl::Storage, TStorageFactory> TBaseStoragePoolTraits;
|
||||
typedef SeparateFreePoolTraits<TStorageFactory, TBaseStoragePoolTraits> TSeparateFreeStoragePoolTraits;
|
||||
|
||||
typedef FixedSizePoolTraits<TStorageFactory, TSeparateFreeStoragePoolTraits> TMergeableStoragePoolTraits;
|
||||
typedef ResourcePoolImpl<TMergeableStoragePoolTraits> TMergeableStoragePoolImpl;
|
||||
|
||||
typedef FixedSizePoolTraits<TStorageFactory, TBaseStoragePoolTraits> TNonMergeableStoragePoolTraits;
|
||||
typedef ResourcePoolImpl<TNonMergeableStoragePoolTraits> TNonMergeableStoragePoolImpl;
|
||||
|
||||
typedef ResourcePool<gl::Storage> TStoragePool;
|
||||
|
||||
public:
|
||||
|
||||
struct StoragePoolParams
|
||||
|
@ -267,7 +265,7 @@ namespace yg
|
|||
void enterBackground();
|
||||
void enterForeground();
|
||||
|
||||
void mergeFreeResources();
|
||||
void updatePoolState();
|
||||
|
||||
void cancel();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue