Skip to content

Commit

Permalink
[PVR] Guide window: Optimize re-opening of the window (re-use item li…
Browse files Browse the repository at this point in the history
…st if no changes came in while window was not active).
  • Loading branch information
ksooo committed Mar 21, 2017
1 parent fd9ba42 commit 30764f5
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions xbmc/pvr/windows/GUIWindowPVRGuide.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ CGUIWindowPVRGuide::CGUIWindowPVRGuide(bool bRadio) :
CGUIWindowPVRGuide::~CGUIWindowPVRGuide(void)
{
g_EpgContainer.UnregisterObserver(this);

m_bRefreshTimelineItems = false;
StopRefreshTimelineItemsThread();
}

Expand All @@ -74,7 +76,6 @@ void CGUIWindowPVRGuide::Init()
}

StartRefreshTimelineItemsThread();
m_bRefreshTimelineItems = true; // force data update on window open/re-open
}

void CGUIWindowPVRGuide::ClearData()
Expand Down Expand Up @@ -103,7 +104,16 @@ void CGUIWindowPVRGuide::OnDeinitWindow(int nextWindowID)
{
StopRefreshTimelineItemsThread();

m_bChannelSelectionRestored = false;
{
CSingleLock lock(m_critSection);
m_bChannelSelectionRestored = false;
if (m_vecItems && !m_newTimeline)
{
// speedup: save a copy of current items for reuse when re-opening the window
m_newTimeline.reset(new CFileItemList);
m_newTimeline->Copy(*m_vecItems);
}
}

CGUIWindowPVRBase::OnDeinitWindow(nextWindowID);
}
Expand All @@ -118,19 +128,15 @@ void CGUIWindowPVRGuide::StartRefreshTimelineItemsThread()
void CGUIWindowPVRGuide::StopRefreshTimelineItemsThread()
{
if (m_refreshTimelineItemsThread)
{
m_bRefreshTimelineItems = false;
m_refreshTimelineItemsThread->Stop();
}
}

void CGUIWindowPVRGuide::Notify(const Observable &obs, const ObservableMessage msg)
{
if (IsActive() &&
(msg == ObservableMessageEpg ||
msg == ObservableMessageEpgContainer ||
msg == ObservableMessageChannelGroupReset ||
msg == ObservableMessageChannelGroup))
if (msg == ObservableMessageEpg ||
msg == ObservableMessageEpgContainer ||
msg == ObservableMessageChannelGroupReset ||
msg == ObservableMessageChannelGroup)
{
CSingleLock lock(m_critSection);
m_bRefreshTimelineItems = true;
Expand Down

0 comments on commit 30764f5

Please sign in to comment.