diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2018-04-04 17:51:26 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2018-04-12 14:35:14 +0200 |
commit | a2b53fece14f745853bcfe1a300c3dceb580e148 (patch) | |
tree | c4d287f97140363fe9cec7740b5189032e8f114e /vcl/inc/impgraph.hxx | |
parent | 92ac45b1920fcce8259c1eab94357415e8f50d82 (diff) |
vcl: Add a internal (memory) manager for Graphic objects
This adds vcl::graphic::Manager which is a manager singleton that
tracks all the creation fo graphic objects and swaps them out on
a time and allocation basis.
Time based - every number of seconds it looks for Graphics that
weren't used for a time.
Allocation based - when creating a new Graphic and the total of
Graphic uses more than the total amount of memory for Graphics
defined in configuration, it tries to release the Graphics that
weren't used for a time.
Change-Id: I5dbf74db4a6455d32c4abcbad7be21c7f0534642
Reviewed-on: https://gerrit.libreoffice.org/52396
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'vcl/inc/impgraph.hxx')
-rw-r--r-- | vcl/inc/impgraph.hxx | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/vcl/inc/impgraph.hxx b/vcl/inc/impgraph.hxx index a60296fde556..a24f786a5b86 100644 --- a/vcl/inc/impgraph.hxx +++ b/vcl/inc/impgraph.hxx @@ -21,6 +21,7 @@ #define INCLUDED_VCL_INC_IMPGRAPH_HXX #include <vcl/GraphicExternalLink.hxx> +#include "graphic/Manager.hxx" struct ImpSwapInfo { @@ -32,6 +33,7 @@ class OutputDevice; class GfxLink; struct ImpSwapFile; class GraphicConversionParameters; +class ImpGraphic; class GraphicID { @@ -62,6 +64,7 @@ class ImpGraphic final { friend class Graphic; friend class GraphicID; + friend class vcl::graphic::Manager; private: @@ -81,18 +84,20 @@ private: std::unique_ptr<GraphicID> mpGraphicID; GraphicExternalLink maGraphicExternalLink; -private: + std::chrono::high_resolution_clock::time_point maLastUsed; - ImpGraphic(); - ImpGraphic( const ImpGraphic& rImpGraphic ); - ImpGraphic( ImpGraphic&& rImpGraphic ); - ImpGraphic( const Bitmap& rBmp ); - ImpGraphic( const BitmapEx& rBmpEx ); - ImpGraphic(const VectorGraphicDataPtr& rVectorGraphicDataPtr); - ImpGraphic( const Animation& rAnimation ); - ImpGraphic( const GDIMetaFile& rMtf ); public: - ~ImpGraphic(); + ImpGraphic(); + ImpGraphic( const ImpGraphic& rImpGraphic ); + ImpGraphic( ImpGraphic&& rImpGraphic ); + ImpGraphic( const GraphicExternalLink& rExternalLink); + ImpGraphic( const Bitmap& rBmp ); + ImpGraphic( const BitmapEx& rBmpEx ); + ImpGraphic(const VectorGraphicDataPtr& rVectorGraphicDataPtr); + ImpGraphic( const Animation& rAnimation ); + ImpGraphic( const GDIMetaFile& rMtf ); + ~ImpGraphic(); + private: ImpGraphic& operator=( const ImpGraphic& rImpGraphic ); @@ -196,6 +201,8 @@ private: const css::uno::Sequence<sal_Int8>& getPdfData() const; void setPdfData(const css::uno::Sequence<sal_Int8>& rPdfData); + + bool ensureAvailable () const; }; #endif // INCLUDED_VCL_INC_IMPGRAPH_HXX |