summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorAshod Nakashian <ashodnakashian@yahoo.com>2015-07-05 12:05:26 -0400
committerAdolfo Jayme Barrientos <fitojb@ubuntu.com>2015-07-16 06:46:54 -0500
commit2113ee5491fa823b14b6c25b6d9a4f170452f9d3 (patch)
treee1f4d92aab4edd54c7bef767316ee05cd77fb9d8 /sw
parentbaea35b431e03819406199ed6001d3cbbe650b9c (diff)
tdf#38837 Reduce power consumption by minimizing idle timers
Both the document statistics- and state-manager have their own modified flags. There is a cyclic dependency between the the two in that updating the document's statistics also marks the document as modified. Of course when a document is edited the statistics modified flag is set to trigger an update. To avoid a perpetual cycle, the statistics manager resets the document's modified state to that before setting the new statistics. However, this doesn't reset the statistics modified flag, which was set when the document was modified by setting the new statistics. Hence, the statistics thinks there are modifications in the document when there isn't. This patch is to make DocumentStateManager::ResetModified() symmetrical to DocumentStateManager::SetModified() by reseting the modified flag of the statistics manager. The idle CPU drops to nil on unmodified documents after this. However, for modified documents the statistics is recalculated perpetually until the document is saved. This will need a different patch to fix. Change-Id: Ib5936bc1acbda34fcac6a00ec46eaa31e4363885 Reviewed-on: https://gerrit.libreoffice.org/16774 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit b0fde7a912ff3aa370496802f20895b1158b072c) Signed-off-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/doc/DocumentStateManager.cxx1
-rw-r--r--sw/source/uibase/app/docsh.cxx2
2 files changed, 2 insertions, 1 deletions
diff --git a/sw/source/core/doc/DocumentStateManager.cxx b/sw/source/core/doc/DocumentStateManager.cxx
index 601525073574..ede8ef96e834 100644
--- a/sw/source/core/doc/DocumentStateManager.cxx
+++ b/sw/source/core/doc/DocumentStateManager.cxx
@@ -65,6 +65,7 @@ void DocumentStateManager::ResetModified()
// Bit 1: -> new state
sal_IntPtr nCall = mbModified ? 1 : 0;
mbModified = false;
+ m_rDoc.GetDocumentStatisticsManager().GetDocStat().bModified = false;
m_rDoc.GetIDocumentUndoRedo().SetUndoNoModifiedPosition();
if( nCall && m_rDoc.GetOle2Link().IsSet() )
{
diff --git a/sw/source/uibase/app/docsh.cxx b/sw/source/uibase/app/docsh.cxx
index 0b66f3127569..6655f045539e 100644
--- a/sw/source/uibase/app/docsh.cxx
+++ b/sw/source/uibase/app/docsh.cxx
@@ -458,7 +458,7 @@ bool SwDocShell::SaveAs( SfxMedium& rMedium )
// Remember and preserve Modified-Flag without calling the Link
// (for OLE; after Statement from MM)
- bool bIsModified = m_pDoc->getIDocumentState().IsModified();
+ const bool bIsModified = m_pDoc->getIDocumentState().IsModified();
m_pDoc->GetIDocumentUndoRedo().LockUndoNoModifiedPosition();
Link<> aOldOLELnk( m_pDoc->GetOle2Link() );
m_pDoc->SetOle2Link( Link<>() );