[iOS] Fixed freeze on start

This commit is contained in:
r.kuznetsov 2016-04-07 15:34:54 +03:00 committed by Alex Zolotarev
parent b945c68c8a
commit e7064976a6
10 changed files with 12 additions and 38 deletions

View file

@ -69,10 +69,9 @@ unique_ptr<threads::IRoutine> BackendRenderer::CreateRoutine()
return make_unique<Routine>(*this);
}
void BackendRenderer::RecacheGui(gui::TWidgetsInitInfo const & initInfo, gui::TWidgetsSizeInfo & sizeInfo,
bool needResetOldGui)
void BackendRenderer::RecacheGui(gui::TWidgetsInitInfo const & initInfo, bool needResetOldGui)
{
drape_ptr<gui::LayerRenderer> layerRenderer = m_guiCacher.RecacheWidgets(initInfo, sizeInfo, m_texMng);
drape_ptr<gui::LayerRenderer> layerRenderer = m_guiCacher.RecacheWidgets(initInfo, m_texMng);
drape_ptr<Message> outputMsg = make_unique_dp<GuiLayerRecachedMessage>(move(layerRenderer), needResetOldGui);
m_commutator->PostMessage(ThreadsCommutator::RenderThread, move(outputMsg), MessagePriority::Normal);
}
@ -117,7 +116,7 @@ void BackendRenderer::AcceptMessage(ref_ptr<Message> message)
case Message::GuiRecache:
{
ref_ptr<GuiRecacheMessage> msg = message;
RecacheGui(msg->GetInitInfo(), msg->GetSizeInfoMap(), msg->NeedResetOldGui());
RecacheGui(msg->GetInitInfo(), msg->NeedResetOldGui());
break;
}
case Message::GuiLayerLayout:

View file

@ -59,7 +59,7 @@ protected:
unique_ptr<threads::IRoutine> CreateRoutine() override;
private:
void RecacheGui(gui::TWidgetsInitInfo const & initInfo, gui::TWidgetsSizeInfo & sizeInfo, bool needResetOldGui);
void RecacheGui(gui::TWidgetsInitInfo const & initInfo, bool needResetOldGui);
void RecacheChoosePositionMark();
void RecacheMyPosition();

View file

@ -189,18 +189,15 @@ void DrapeEngine::UpdateMapStyle()
m_threadCommutator->PostMessage(ThreadsCommutator::ResourceUploadThread,
make_unique_dp<GuiLayerLayoutMessage>(m_widgetsLayout),
MessagePriority::High);
MessagePriority::Normal);
}
}
void DrapeEngine::RecacheGui(bool needResetOldGui)
{
GuiRecacheMessage::Blocker blocker;
m_threadCommutator->PostMessage(ThreadsCommutator::ResourceUploadThread,
make_unique_dp<GuiRecacheMessage>(blocker, m_widgetsInfo,
m_widgetSizes, needResetOldGui),
make_unique_dp<GuiRecacheMessage>(m_widgetsInfo, needResetOldGui),
MessagePriority::High);
blocker.Wait();
}
void DrapeEngine::AddUserEvent(UserEvent const & e)
@ -407,11 +404,6 @@ void DrapeEngine::SetWidgetLayout(gui::TWidgetsLayoutInfo && info)
MessagePriority::Normal);
}
gui::TWidgetsSizeInfo const & DrapeEngine::GetWidgetSizes()
{
return m_widgetSizes;
}
void DrapeEngine::Allow3dMode(bool allowPerspectiveInNavigation, bool allow3dBuildings, double rotationAngle, double angleFOV)
{
m_threadCommutator->PostMessage(ThreadsCommutator::ResourceUploadThread,

View file

@ -120,7 +120,6 @@ public:
void SetRoutePoint(m2::PointD const & position, bool isStart, bool isValid);
void SetWidgetLayout(gui::TWidgetsLayoutInfo && info);
gui::TWidgetsSizeInfo const & GetWidgetSizes();
void Allow3dMode(bool allowPerspectiveInNavigation, bool allow3dBuildings, double rotationAngle, double angleFOV);
void EnablePerspective(double rotationAngle, double angleFOV);
@ -162,7 +161,6 @@ private:
TUserPositionChangedFn m_userPositionChangedFn;
gui::TWidgetsInitInfo m_widgetsInfo;
gui::TWidgetsSizeInfo m_widgetSizes;
gui::TWidgetsLayoutInfo m_widgetsLayout;
bool m_choosePositionMode = false;

View file

@ -165,9 +165,7 @@ private:
} // namespace
drape_ptr<LayerRenderer> LayerCacher::RecacheWidgets(TWidgetsInitInfo const & initInfo,
TWidgetsSizeInfo & sizeInfo,
ref_ptr<dp::TextureManager> textures)
drape_ptr<LayerRenderer> LayerCacher::RecacheWidgets(TWidgetsInitInfo const & initInfo, ref_ptr<dp::TextureManager> textures)
{
using TCacheShape = function<m2::PointF (Position anchor, ref_ptr<LayerRenderer> renderer, ref_ptr<dp::TextureManager> textures)>;
static map<EWidget, TCacheShape> cacheFunctions
@ -183,7 +181,7 @@ drape_ptr<LayerRenderer> LayerCacher::RecacheWidgets(TWidgetsInitInfo const & in
{
auto cacheFunction = cacheFunctions.find(node.first);
if (cacheFunction != cacheFunctions.end())
sizeInfo[node.first] = cacheFunction->second(node.second, make_ref(renderer), textures);
cacheFunction->second(node.second, make_ref(renderer), textures);
}
// Flush gui geometry.

View file

@ -53,7 +53,6 @@ class LayerCacher
{
public:
drape_ptr<LayerRenderer> RecacheWidgets(TWidgetsInitInfo const & initInfo,
TWidgetsSizeInfo & sizeInfo,
ref_ptr<dp::TextureManager> textures);
drape_ptr<LayerRenderer> RecacheChoosePositionMark(ref_ptr<dp::TextureManager> textures);

View file

@ -273,26 +273,21 @@ private:
bool const m_needResetOldGui;
};
class GuiRecacheMessage : public BaseBlockingMessage
class GuiRecacheMessage : public Message
{
public:
GuiRecacheMessage(Blocker & blocker, gui::TWidgetsInitInfo const & initInfo, gui::TWidgetsSizeInfo & resultInfo,
bool needResetOldGui)
: BaseBlockingMessage(blocker)
, m_initInfo(initInfo)
, m_sizeInfo(resultInfo)
GuiRecacheMessage(gui::TWidgetsInitInfo const & initInfo, bool needResetOldGui)
: m_initInfo(initInfo)
, m_needResetOldGui(needResetOldGui)
{}
Type GetType() const override { return Message::GuiRecache;}
gui::TWidgetsInitInfo const & GetInitInfo() const { return m_initInfo; }
gui::TWidgetsSizeInfo & GetSizeInfoMap() const { return m_sizeInfo; }
bool NeedResetOldGui() const { return m_needResetOldGui; }
private:
gui::TWidgetsInitInfo m_initInfo;
gui::TWidgetsSizeInfo & m_sizeInfo;
bool const m_needResetOldGui;
};

View file

@ -44,7 +44,7 @@ void iosOGLContextFactory::setPresentAvailable(bool available)
if (!m_isInitialized && available)
{
m_isInitialized = true;
m_initializationCondition.notify_one();
m_initializationCondition.notify_all();
}
}
if (m_drawContext != nullptr)

View file

@ -1623,12 +1623,6 @@ void Framework::SetWidgetLayout(gui::TWidgetsLayoutInfo && layout)
m_drapeEngine->SetWidgetLayout(move(layout));
}
gui::TWidgetsSizeInfo const & Framework::GetWidgetSizes()
{
ASSERT(m_drapeEngine != nullptr, ());
return m_drapeEngine->GetWidgetSizes();
}
bool Framework::ShowMapForURL(string const & url)
{
m2::PointD point;

View file

@ -354,7 +354,6 @@ public:
void SetupMeasurementSystem();
void SetWidgetLayout(gui::TWidgetsLayoutInfo && layout);
const gui::TWidgetsSizeInfo & GetWidgetSizes();
void PrepareToShutdown();