File indexing completed on 2024-09-22 04:03:34

0001 /*
0002  *  SPDX-FileCopyrightText: 2010 Dmitry Kazakov <dimula73@gmail.com>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 #ifndef KIS_TILE_DATA_SWAPPER_H_
0007 #define KIS_TILE_DATA_SWAPPER_H_
0008 
0009 #include <QObject>
0010 #include <QThread>
0011 
0012 #include "kritaimage_export.h"
0013 
0014 
0015 class KisTileDataStore;
0016 class KisTileData;
0017 
0018 class KRITAIMAGE_EXPORT KisTileDataSwapper : public QThread
0019 {
0020     Q_OBJECT
0021 
0022 public:
0023 
0024     KisTileDataSwapper(KisTileDataStore *store);
0025     ~KisTileDataSwapper() override;
0026 
0027     void kick();
0028     void terminateSwapper();
0029     void checkFreeMemory();
0030 
0031     void testingRereadConfig();
0032 
0033 private:
0034     void waitForWork();
0035     void run() override;
0036 
0037     void doJob();
0038     template<class strategy> qint64 pass(qint64 needToFreeMetric);
0039 
0040 private:
0041     static const qint32 TIMEOUT;
0042     static const qint32 DELAY;
0043 
0044 private:
0045     struct Private;
0046     Private * const m_d;
0047 };
0048 
0049 
0050 
0051 #endif /* KIS_TILE_DATA_SWAPPER_H_ */
0052