Go to the documentation of this file.
13 #include <boost/enable_shared_from_this.hpp>
14 #include <boost/shared_ptr.hpp>
15 #include <boost/thread.hpp>
26 std::map<CompressedTile::Ptr, std::pair<int, int>>
sourceTiles;
33 using Ptr = boost::shared_ptr<LayerCoordinator>;
BOOST_AUTO_TEST_CASE(basic_jobcounting)
Definition: threadpool-queue-tests.cc:39
std::map< ViewInterface::WeakPtr, boost::weak_ptr< TileViewState > > viewStates
Definition: tiledbitmaplayer.hh:127
static Ptr create(Semaphore *s)
Definition: threadpool-tests.cc:49
TileState getState()
Definition: compressedtile.cc:176
boost::shared_ptr< TileLoadingObserver > Ptr
Definition: tiledbitmaplayer.hh:83
ThreadPool::Ptr threadPool
Definition: layer.cc:51
BOOST_AUTO_TEST_CASE(work_gets_done)
Definition: threadpool-tests.cc:137
Definition: layercoordinator.hh:19
BOOST_AUTO_TEST_CASE(destroy_threadpool_with_nonempty_queue)
Definition: threadpool-destruction-tests.cc:36
boost::shared_ptr< TileInitialisationObserver > Ptr
Definition: tiledbitmaplayer.hh:52
virtual void tileFinished(const boost::shared_ptr< CompressedTile > &tile)
TileInitialisationObserver.
Definition: compressedtile.cc:289
#define UNUSED(x)
Definition: unused.hh:10
const int x
Definition: tiledbitmaplayer.hh:112
int getHorTileCount() const
Definition: layer.cc:124
TileStateInternal
Definition: tiledbitmaplayer.hh:34
boost::shared_ptr< PageProvider > Ptr
Definition: memoryblobs.hh:41
boost::shared_ptr< ThreadPool > Ptr
Definition: threadpool.hh:169
@ TILE_UNLOADED
Definition: tiledbitmapinterface.hh:35
std::list< Stuff > StuffList
Definition: stuff.hh:20
boost::shared_ptr< Queue > Ptr
Definition: threadpool.hh:82
const millisec long_timeout(2000)
void close(ViewInterface::WeakPtr vi) override
Definition: compressedtile.cc:284
int width
Definition: tiledbitmaplayer.hh:251
Definition: assertions.hh:14
const millisec short_timeout(250)
Tile::WeakPtr tile
Definition: tiledbitmaplayer.hh:118
Definition: layeroperations.hh:33
boost::shared_ptr< Layer > Ptr
Definition: tiledbitmaplayer.hh:247
int horTileCount
Definition: layer.cc:47
CompressedTileGrid tiles
Definition: tiledbitmaplayer.hh:255
Scroom::Utils::StuffList registrations
Definition: layercoordinator.hh:27
void addSourceTile(int x, int y, const CompressedTile::Ptr &tile)
Definition: layercoordinator.cc:37
boost::function< void()> clear(Semaphore *s)
Definition: helpers.cc:29
DataFetcher(Layer::Ptr layer, int height, int horTileCount, int verTileCount, SourcePresentation::Ptr sp, ThreadPool::WeakQueue::Ptr queue, std::function< void()> on_finished)
DataFetcher.
Definition: layer.cc:192
int verTileCount
Definition: tiledbitmaplayer.hh:254
R operator()()
Definition: threadpool-tests.cc:68
void close(ViewInterface::WeakPtr vi) override
Definition: layer.cc:173
Tile::Ptr targetTileData
Definition: layercoordinator.hh:25
static Ptr create()
Definition: cmyklayeroperations.cc:123
boost::shared_ptr< WeakQueue > Ptr
Definition: threadpool.hh:137
static Scroom::MemoryBlobs::PageProvider::Ptr createProvider(double width, double height, int bpp)
Definition: layer.cc:25
ConstTile::WeakPtr constTile
Definition: tiledbitmaplayer.hh:119
void cleanupState()
Definition: compressedtile.cc:261
static Ptr create(int depth, int x, int y, int bpp, const Scroom::MemoryBlobs::PageProvider::Ptr &provider, TileStateInternal state=TSI_UNINITIALIZED)
Definition: compressedtile.cc:32
bool has_exactly_n_threads(ThreadPool *pool, int count)
Definition: threadpool-tests.cc:126
int unfinishedSourceTiles
Definition: layercoordinator.hh:30
void reduce(Tile::Ptr target, ConstTile::Ptr source, int x, int y) override
Definition: cmyklayeroperations.cc:72
OperationsCMYK8()
Definition: cmyklayeroperations.cc:218
Definition: assertions.hh:14
Definition: threadpool.hh:46
Tile::Ptr getTileSync()
Definition: compressedtile.cc:55
void fetchData(SourcePresentation::Ptr sp, const ThreadPool::WeakQueue::Ptr &queue, std::function< void()> on_finished)
Definition: layer.cc:148
boost::shared_ptr< uint8_t > Ptr
Definition: blockallocator.hh:23
Definition: async-deleter.hh:21
const millisec short_timeout(250)
BOOST_CHECK_EQUAL(sample.expectedColors, originalColormap->colors.size())
ConstTile::Ptr getConstTileAsync()
Definition: compressedtile.cc:84
boost::shared_ptr< ConstTile > Ptr
Definition: tile.hh:47
int height
Definition: tiledbitmaplayer.hh:252
ConstTile::Ptr getConstTileSync()
Definition: compressedtile.cc:44
ThreadPool::Ptr Sequentially()
Definition: threadpoolimpl.cc:459
boost::shared_ptr< SourcePresentation > Ptr
Definition: tiledbitmapinterface.hh:198
CompressedTile::Ptr outOfBounds
Definition: tiledbitmaplayer.hh:256
LayerCoordinator(const LayerCoordinator &)=delete
boost::function< void()> destroy(boost::shared_ptr< void > p)
Definition: helpers.cc:31
BOOST_AUTO_TEST_CASE(try_P)
Definition: semaphore-tests.cc:37
bool try_P()
Definition: semaphore.hh:48
CompressedTileLine & getTileLine(int j)
Definition: layer.cc:138
static Ptr create(size_t blockCount, size_t blockSize)
Definition: memoryblobs.cc:37
@ TSI_LOADING_SYNCHRONOUSLY
Definition: tiledbitmaplayer.hh:39
ConstTile::Ptr do_load()
Definition: compressedtile.cc:130
Scroom::Utils::Stuff cache(const ConstTile::Ptr &tile) override
Definition: cmyklayeroperations.cc:228
#define require(expr)
Definition: assertions.hh:28
static Ptr create()
QueueJumper.
Definition: threadpoolimpl.cc:419
boost::shared_ptr< TileViewState > Ptr
Definition: tileviewstate.hh:27
void open(ViewInterface::WeakPtr vi) override
Definition: compressedtile.cc:279
void P()
Definition: semaphore.hh:38
BOOST_AUTO_TEST_CASE(queueimpl_jobs_get_executed)
Definition: threadpool-queueimpl-tests.cc:35
CompressedTileLine lineOutOfBounds
Definition: tiledbitmaplayer.hh:257
static Ptr create(int width, int height, cairo_format_t format)
Definition: bitmap-helpers.cc:13
Scroom::MemoryBlobs::PageProvider::Ptr pageProvider
Definition: tiledbitmaplayer.hh:258
Scroom::Utils::Stuff cache(const ConstTile::Ptr &tile) override
Definition: cmyklayeroperations.cc:135
boost::shared_ptr< PipetteCommonOperationsCMYK > Ptr
Definition: layeroperations.hh:41
int verTileCount
Definition: layer.cc:48
A(Semaphore *s_)
Definition: threadpool-tests.cc:42
Layer::Ptr layer
Definition: layer.cc:45
OperationsCMYK16()
Definition: cmyklayeroperations.cc:125
@ TILE_LOADED
Definition: tiledbitmapinterface.hh:36
std::map< CompressedTile::Ptr, std::pair< int, int > > sourceTiles
Definition: layercoordinator.hh:26
int horTileCount
Definition: tiledbitmaplayer.hh:253
int depth
Definition: tiledbitmaplayer.hh:250
static Ptr create()
ThreadPool::Queue.
Definition: threadpoolimpl.cc:377
static unsigned int current
Definition: measure-framerate-callbacks.cc:17
int getBpp() override
Definition: cmyklayeroperations.cc:130
static Ptr create(Semaphore *s, R result)
Definition: threadpool-tests.cc:74
static Ptr create()
Definition: cmyklayeroperations.cc:306
Point< T > ceil(Point< T > p)
Definition: point.hh:228
void reduce(Tile::Ptr target, ConstTile::Ptr source, int x, int y) override
Definition: cmyklayeroperations.cc:370
boost::mutex stateData
Definition: tiledbitmaplayer.hh:122
boost::shared_ptr< QueueJumper > Ptr
Definition: threadpool.hh:537
boost::mutex mut
Definition: layercoordinator.hh:29
const int depth
Definition: tiledbitmaplayer.hh:111
const millisec long_timeout(2000)
TileState
Definition: tiledbitmapinterface.hh:32
const millisec short_timeout(250)
CompressedTile::Ptr getTile(int i, int j)
Definition: layer.cc:128
Scroom::MemoryBlobs::PageProvider::Ptr provider
Definition: tiledbitmaplayer.hh:120
void operator()()
Definition: threadpool-tests.cc:47
@ TILE_OUT_OF_BOUNDS
Definition: tiledbitmapinterface.hh:37
const millisec long_timeout(2000)
boost::shared_ptr< B< R > > Ptr
Definition: threadpool-tests.cc:60
boost::shared_ptr< A > Ptr
Definition: boost-bind.cc:27
int getBpp() override
Definition: cmyklayeroperations.cc:37
ThreadPool::Ptr CpuBound()
Definition: threadpoolimpl.cc:452
Scroom::Bookkeeping::Token registerObserver(const TileInitialisationObserver::Ptr &observer)
Definition: layer.cc:110
Definition: semaphore.hh:15
const millisec long_timeout(2000)
boost::weak_ptr< ViewInterface > WeakPtr
Definition: viewinterface.hh:194
boost::shared_ptr< unsigned char > shared_malloc(size_t size)
Definition: cmyklayeroperations.cc:24
void reduce(Tile::Ptr target, ConstTile::Ptr source, int x, int y) override
Definition: cmyklayeroperations.cc:165
CompressedTile(int depth, int x, int y, int bpp, const Scroom::MemoryBlobs::PageProvider::Ptr &provider, TileStateInternal state)
CompressedTile.
Definition: compressedtile.cc:21
static Ptr create(CompressedTile::Ptr targetTile, LayerOperations::Ptr lo)
Definition: layercoordinator.cc:19
~LayerCoordinator() override
Definition: layercoordinator.cc:31
R result
Definition: threadpool-tests.cc:57
static ThreadPool::Ptr create(bool completeAllJobsBeforeDestruction=false)
Definition: threadpoolimpl.cc:228
static Ptr create()
Definition: cmyklayeroperations.cc:30
void notifyObservers(const ConstTile::Ptr &tile)
Definition: compressedtile.cc:271
SourcePresentation::Ptr sp
Definition: layer.cc:50
R no_op(Semaphore *s, R result)
Definition: threadpool-tests.cc:78
@ TSI_UNINITIALIZED
Definition: tiledbitmaplayer.hh:36
boost::shared_ptr< QueueImpl > Ptr
Definition: queue.hh:25
@ PRIO_HIGH
Definition: threadpool.hh:28
Definition: utilities.hh:30
void test_count_equals(Semaphore *s, int i)
Definition: semaphore-tests.cc:24
BOOST_REQUIRE(originalColormap)
TileStateInternal state
Definition: tiledbitmaplayer.hh:117
boost::shared_ptr< Tile > Ptr
Definition: tile.hh:21
Scroom::Utils::Stuff cache(const ConstTile::Ptr &tile) override
Definition: cmyklayeroperations.cc:42
int getBpp() override
Definition: cmyklayeroperations.cc:223
LayerCoordinator operator=(const LayerCoordinator &)=delete
boost::function< void()> pass(Semaphore *s)
Definition: helpers.cc:27
const int bpp
Definition: tiledbitmaplayer.hh:114
void tileFinished(const CompressedTile::Ptr &tile) override
TileInitialisationObserver.
Definition: layercoordinator.cc:49
void observerAdded(TileInitialisationObserver::Ptr const &observer, Scroom::Bookkeeping::Token const &token) override
Definition: compressedtile.cc:208
boost::shared_ptr< void > Stuff
Definition: stuff.hh:18
Scroom::Utils::Stuff cache(const ConstTile::Ptr &tile) override
Definition: cmyklayeroperations.cc:322
OperationsCMYK32()
Definition: cmyklayeroperations.cc:32
Definition: observable.hh:24
static Ptr create(int &i)
Definition: boost-bind.cc:38
Definition: memoryblobs.hh:23
void open(ViewInterface::WeakPtr vi) override
Definition: layer.cc:157
int getVerTileCount() const
Definition: layer.cc:126
int currentRow
Definition: layer.cc:49
virtual void tileCreated(const boost::shared_ptr< CompressedTile > &tile)
Definition: compressedtile.cc:291
@ TSI_OUT_OF_BOUNDS
Definition: tiledbitmaplayer.hh:38
@ TILE_UNINITIALIZED
Definition: tiledbitmapinterface.hh:34
boost::shared_ptr< LayerCoordinator > Ptr
Definition: layercoordinator.hh:33
Scroom::MemoryBlobs::Blob::Ptr data
Definition: tiledbitmaplayer.hh:121
OperationsCMYK4()
Definition: cmyklayeroperations.cc:308
Definition: boost-bind.cc:21
std::function< void()> on_finished
Definition: layer.cc:53
static void b(const B::Ptr &)
Definition: gtkhelper-tests.cc:32
LayerOperations::Ptr lo
Definition: layercoordinator.hh:28
boost::shared_ptr< CompressedTile > Ptr
Definition: tiledbitmaplayer.hh:108
#define TILESIZE
Definition: tiledbitmaplayer.hh:28
static Ptr create(const boost::shared_ptr< CompressedTile > &parent)
Definition: tileviewstate.cc:27
void operator()()
Definition: layer.cc:210
boost::shared_ptr< LayerOperations > Ptr
Definition: tiledbitmapinterface.hh:53
CompressedTile::Ptr targetTile
Definition: layercoordinator.hh:24
Definition: memoryblobs.hh:75
static Ptr create(int depth, int layerWidth, int layerHeight, int bpp, Scroom::MemoryBlobs::PageProvider::Ptr provider)
Definition: layer.cc:98
ThreadPtr add()
Definition: threadpoolimpl.cc:238
Semaphore * s
Definition: threadpool-tests.cc:37
void reduce(Tile::Ptr target, ConstTile::Ptr source, int x, int y) override
Definition: cmyklayeroperations.cc:259
boost::mutex tileData
Definition: tiledbitmaplayer.hh:123
std::vector< CompressedTile::Ptr > CompressedTileLine
Definition: tiledbitmaplayer.hh:237
@ TSI_LOADING_ASYNCHRONOUSLY
Definition: tiledbitmaplayer.hh:40
const millisec short_timeout(250)
boost::weak_ptr< Queue > WeakPtr
Definition: threadpool.hh:83
#define DATAFETCH_PRIO
Definition: local.hh:11
void V()
Definition: semaphore.hh:77
@ PRIO_NORMAL
Definition: threadpool.hh:29
int getBpp() override
Definition: cmyklayeroperations.cc:313
void schedule(boost::function< void()> const &fn, int priority=defaultPriority, const Queue::Ptr &queue=defaultQueue())
Definition: threadpoolimpl.cc:342
const int y
Definition: tiledbitmaplayer.hh:113
Definition: bookkeeping.hh:37
bool has_at_least_n_threads(ThreadPool *pool, int count_)
Definition: threadpool-tests.cc:86
Definition: tiledbitmaplayer.hh:49
boost::shared_ptr< TileViewState > getViewState(const ViewInterface::WeakPtr &vi)
Definition: compressedtile.cc:163
@ TSI_NORMAL
Definition: tiledbitmaplayer.hh:37
B(Semaphore *s_, R result_)
Definition: threadpool-tests.cc:62
int height
Definition: layer.cc:46
#define LOAD_PRIO
Definition: local.hh:10
void reportFinished()
Definition: compressedtile.cc:116
void add(const Stuff &s) const
Definition: bookkeepingimpl.hh:191
ThreadPool::Queue::WeakPtr queue
Definition: tiledbitmaplayer.hh:125
Semaphore * s
Definition: threadpool-tests.cc:56
#define REDUCE_PRIO
Definition: local.hh:12
ThreadPool::WeakQueue::Ptr queue
Definition: layer.cc:52
Tile::Ptr initialize()
Definition: compressedtile.cc:90
void create(NewPresentationInterface *interface)
Definition: loader.cc:175
static Ptr create()
Definition: cmyklayeroperations.cc:216
Layer(int depth, int layerWidth, int layerHeight, int bpp, Scroom::MemoryBlobs::PageProvider::Ptr provider)
Layer.
Definition: layer.cc:70
void reduceSourceTile(const CompressedTile::Ptr &tile, ConstTile::Ptr const &tileData)
Helpers.
Definition: layercoordinator.cc:61
Definition: threadpool-tests.cc:53