[Libreoffice-commits] core.git: Branch 'feature/perfwork4' - 3 commits - include/svtools include/svx svtools/source svx/source sw/source

Zolnai Tamás tamas.zolnai at collabora.com
Mon Nov 3 22:41:16 PST 2014


 include/svtools/grfmgr.hxx                            |    2 -
 include/svx/svdundo.hxx                               |    3 -
 svtools/source/graphic/grfmgr.cxx                     |    2 -
 svtools/source/graphic/grfmgr2.cxx                    |    9 +++--
 svx/source/sdr/contact/viewobjectcontactofgraphic.cxx |   13 +-------
 svx/source/svdraw/svdundo.cxx                         |   28 ------------------
 sw/source/core/doc/notxtfrm.cxx                       |   10 ------
 sw/source/core/graphic/ndgrf.cxx                      |   10 ------
 8 files changed, 11 insertions(+), 66 deletions(-)

New commits:
commit ae90daefc08b0f24d4cb6c6d9e5916d1c3819a9f
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Mon Oct 27 15:55:38 2014 +0100

    Ignore the swapped in graphic, but use its size
    
    Change-Id: I75f17ab5e55119965fcede2b220979cefc1e26ab

diff --git a/svtools/source/graphic/grfmgr2.cxx b/svtools/source/graphic/grfmgr2.cxx
index 5c39c7a..e6955f1 100644
--- a/svtools/source/graphic/grfmgr2.cxx
+++ b/svtools/source/graphic/grfmgr2.cxx
@@ -205,12 +205,15 @@ void GraphicManager::ImplCheckSizeOfSwappedInGraphics(const GraphicObject* pGrap
     for (size_t i = 0, n = maObjList.size(); i < n; ++i)
     {
         pObj = maObjList[i];
-        if (pObj->meType == GRAPHIC_BITMAP && !pObj->IsSwappedOut() && pObj->GetSizeBytes() && pObj != pGraphicToIgnore)
+        if (pObj->meType == GRAPHIC_BITMAP && !pObj->IsSwappedOut() && pObj->GetSizeBytes())
         {
-            aCandidates.push_back(pObj);
             size_t const nSize = pObj->GetSizeBytes();
             nUsedSize += nSize;
-            sizes.insert(std::make_pair(pObj, nSize));
+            if( pObj != pGraphicToIgnore )
+            {
+                aCandidates.push_back(pObj);
+                sizes.insert(std::make_pair(pObj, nSize));
+            }
         }
     }
 
commit 64a5c7d34a2909c8c39a40d4d2f18fa8c7b2d486
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Mon Nov 3 16:37:26 2014 +0100

    Avoid an image loss situation of auto swapping
    
    Before an image data is used GraphicObject should be swapped in.
    When a GraphicObject is swapped in auto swapping mechanism
    is triggered which can swap out some of the images.
    We should avoid to swap out the same image on which the swap
    in method was called before because the caller code assumes that
    the image data is there.
    
    Change-Id: Ia4addc370742aea5fbf185cf87e3c062a5ebf5be

diff --git a/include/svtools/grfmgr.hxx b/include/svtools/grfmgr.hxx
index d452276..a8c391c 100644
--- a/include/svtools/grfmgr.hxx
+++ b/include/svtools/grfmgr.hxx
@@ -615,7 +615,7 @@ private:
     // For 32Bit systems this leads to situations where graphics will be missing. This method will actively swap out
     // the longest swapped in graphics until a maximum memory boundary (derived from user settings in tools/options/memory)
     // is no longer exceeded
-    void SVT_DLLPRIVATE ImplCheckSizeOfSwappedInGraphics();
+    void SVT_DLLPRIVATE ImplCheckSizeOfSwappedInGraphics(const GraphicObject* pGraphicToIgnore);
 public:
 
                         GraphicManager( sal_uLong nCacheSize = 10000000UL, sal_uLong nMaxObjCacheSize = 2400000UL );
diff --git a/svtools/source/graphic/grfmgr.cxx b/svtools/source/graphic/grfmgr.cxx
index 45367cd..a6de697 100644
--- a/svtools/source/graphic/grfmgr.cxx
+++ b/svtools/source/graphic/grfmgr.cxx
@@ -70,7 +70,7 @@ void GraphicObject::ImplAfterDataChange()
 
     // check memory footprint of all GraphicObjects managed and evtl. take action
     if (mpMgr)
-        mpMgr->ImplCheckSizeOfSwappedInGraphics();
+        mpMgr->ImplCheckSizeOfSwappedInGraphics(this);
 }
 
 GraphicObject::GraphicObject( const GraphicManager* pMgr ) :
diff --git a/svtools/source/graphic/grfmgr2.cxx b/svtools/source/graphic/grfmgr2.cxx
index 57a1620..5c39c7a 100644
--- a/svtools/source/graphic/grfmgr2.cxx
+++ b/svtools/source/graphic/grfmgr2.cxx
@@ -192,7 +192,7 @@ namespace
     };
 } // end of anonymous namespace
 
-void GraphicManager::ImplCheckSizeOfSwappedInGraphics()
+void GraphicManager::ImplCheckSizeOfSwappedInGraphics(const GraphicObject* pGraphicToIgnore)
 {
     // get the currently used memory footprint of all swapped in bitmap graphics
     // of this graphic manager. Remember candidates in a vector. The size in bytes is
@@ -205,7 +205,7 @@ void GraphicManager::ImplCheckSizeOfSwappedInGraphics()
     for (size_t i = 0, n = maObjList.size(); i < n; ++i)
     {
         pObj = maObjList[i];
-        if (pObj->meType == GRAPHIC_BITMAP && !pObj->IsSwappedOut() && pObj->GetSizeBytes())
+        if (pObj->meType == GRAPHIC_BITMAP && !pObj->IsSwappedOut() && pObj->GetSizeBytes() && pObj != pGraphicToIgnore)
         {
             aCandidates.push_back(pObj);
             size_t const nSize = pObj->GetSizeBytes();
commit 0ce4c047e9c763b654ac08a7bd0439aa7e055f35
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Mon Nov 3 18:26:19 2014 +0100

    Some more manual swap out removal for perf testing
    
    Cherry picked from image rework branch
    
    Change-Id: I5ef0510002fab1589e10e80e2369fc1f51c00970

diff --git a/include/svx/svdundo.hxx b/include/svx/svdundo.hxx
index 739244f..c3e4861 100644
--- a/include/svx/svdundo.hxx
+++ b/include/svx/svdundo.hxx
@@ -301,9 +301,6 @@ public:
 
 class SVX_DLLPUBLIC SdrUndoDelObj : public SdrUndoRemoveObj
 {
-private:
-    void TryToFlushGraphicContent();
-
 public:
     SdrUndoDelObj(SdrObject& rNewObj, bool bOrdNumDirect = false);
 
diff --git a/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx b/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx
index a445b75..c95b42d 100644
--- a/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx
@@ -245,8 +245,6 @@ namespace sdr
             // prepare primitive generation with evtl. loading the graphic when it's swapped out
             SdrGrafObj& rGrafObj = const_cast< ViewObjectContactOfGraphic* >(this)->getSdrGrafObj();
             bool bDoAsynchronGraphicLoading(rGrafObj.GetModel() && rGrafObj.GetModel()->IsSwapGraphics());
-            bool bSwapInDone(false);
-            bool bSwapInExclusive(false);
 
             if( bDoAsynchronGraphicLoading && rGrafObj.IsSwappedOut() )
             {
@@ -262,16 +260,15 @@ namespace sdr
                     || GetObjectContact().isOutputToPDFFile() )
                 {
                     bDoAsynchronGraphicLoading = false;
-                    bSwapInExclusive = true;
                 }
             }
             if( bDoAsynchronGraphicLoading )
             {
-                bSwapInDone = const_cast< ViewObjectContactOfGraphic* >(this)->impPrepareGraphicWithAsynchroniousLoading();
+                const_cast< ViewObjectContactOfGraphic* >(this)->impPrepareGraphicWithAsynchroniousLoading();
             }
             else
             {
-                bSwapInDone = const_cast< ViewObjectContactOfGraphic* >(this)->impPrepareGraphicWithSynchroniousLoading();
+                const_cast< ViewObjectContactOfGraphic* >(this)->impPrepareGraphicWithSynchroniousLoading();
             }
 
             // get return value by calling parent
@@ -294,12 +291,6 @@ namespace sdr
                 }
             }
 
-            // if swap in was forced only for printing metafile and pdf, swap out again
-            if( bSwapInDone && bSwapInExclusive )
-            {
-                rGrafObj.ForceSwapOut();
-            }
-
             return xRetval;
         }
 
diff --git a/svx/source/svdraw/svdundo.cxx b/svx/source/svdraw/svdundo.cxx
index e8a84e5..c88d2c3 100644
--- a/svx/source/svdraw/svdundo.cxx
+++ b/svx/source/svdraw/svdundo.cxx
@@ -889,34 +889,10 @@ void SdrUndoInsertObj::Redo()
     ImpShowPageOfThisObject();
 }
 
-
-
-void SdrUndoDelObj::TryToFlushGraphicContent()
-{
-    SdrGrafObj* pSdrGrafObj = dynamic_cast< SdrGrafObj* >(pObj);
-
-    if(pSdrGrafObj)
-    {
-        sdr::contact::ViewContactOfGraphic* pVC = dynamic_cast< sdr::contact::ViewContactOfGraphic* >(&pSdrGrafObj->GetViewContact());
-
-        if(pVC)
-        {
-            pVC->flushViewObjectContacts();
-            pVC->flushGraphicObjects();
-        }
-
-        pSdrGrafObj->ForceSwapOut();
-    }
-}
-
 SdrUndoDelObj::SdrUndoDelObj(SdrObject& rNewObj, bool bOrdNumDirect)
 :   SdrUndoRemoveObj(rNewObj,bOrdNumDirect)
 {
     SetOwner(true);
-
-    // #i122985# if graphic object is deleted (but goes to undo) flush it's graphic content
-    // since it is potentially no longer needed
-    TryToFlushGraphicContent();
 }
 
 void SdrUndoDelObj::Undo()
@@ -931,10 +907,6 @@ void SdrUndoDelObj::Redo()
     SdrUndoRemoveObj::Redo();
     DBG_ASSERT(!IsOwner(),"RedoDeleteObj: pObj already belongs to UndoAction");
     SetOwner(true);
-
-    // #i122985# if graphic object is deleted (but goes to undo) flush it's graphic content
-    // since it is potentially no longer needed
-    TryToFlushGraphicContent();
 }
 
 OUString SdrUndoDelObj::GetComment() const
diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx
index 83b8f8d..98cdcb6 100644
--- a/sw/source/core/doc/notxtfrm.cxx
+++ b/sw/source/core/doc/notxtfrm.cxx
@@ -878,7 +878,7 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons
             pOut->SetAntialiasing( nFormerAntialiasingAtOutput | ANTIALIASING_ENABLE_B2DDRAW );
         }
 
-        bool bForceSwap = false, bContinue = true;
+        bool bContinue = true;
         const GraphicObject& rGrfObj = pGrfNd->GetGrfObj();
 
         GraphicAttr aGrfAttr;
@@ -917,7 +917,6 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons
 
         if( bContinue )
         {
-            const bool bSwapped = rGrfObj.IsSwappedOut();
             const bool bSwappedIn = pGrfNd->SwapIn( bPrn );
             if( bSwappedIn && rGrfObj.GetGraphic().IsSupportedGraphic())
             {
@@ -976,15 +975,8 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons
 
                 ::lcl_PaintReplacement( aAlignedGrfArea, aText, *pShell, this, true );
             }
-
-            // When printing, we must not collect the graphics
-            if( bSwapped && bPrn )
-                bForceSwap = true;
         }
 
-        if( bForceSwap )
-            pGrfNd->SwapOut();
-
         if ( pShell->Imp()->GetDrawView()->IsAntiAliasing() )
             pOut->SetAntialiasing( nFormerAntialiasingAtOutput );
     }
diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx
index abf38d3..d0cdbf5 100644
--- a/sw/source/core/graphic/ndgrf.cxx
+++ b/sw/source/core/graphic/ndgrf.cxx
@@ -341,7 +341,6 @@ void SwGrfNode::onGraphicChanged()
 
     if(pFlyFmt)
     {
-        const bool bWasSwappedOut = GetGrfObj().IsSwappedOut();
         OUString aName;
         OUString aTitle;
         OUString aDesc;
@@ -382,11 +381,6 @@ void SwGrfNode::onGraphicChanged()
         {
             SetDescription(aDesc);
         }
-
-        if (bWasSwappedOut)
-        {
-            SwapOut();
-        }
     }
 }
 
@@ -660,10 +654,6 @@ bool SwGrfNode::SavePersistentData()
         return true;
     }
 
-    // swap in first if already in storage
-    if( HasEmbeddedStreamName() && !SwapIn() )
-        return false;
-
     // #i44367#
     // Do not delete graphic file in storage, because the graphic file could
     // be referenced by other graphic nodes.


More information about the Libreoffice-commits mailing list