LibreOffice Module sd (master) 1
SlsQueueProcessor.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#pragma once
21
24#include "SlsBitmapFactory.hxx"
25
26#include <vcl/timer.hxx>
27#include <mutex>
28
29namespace sd::slidesorter::cache {
30
31class BitmapCache;
32class RequestQueue;
33
39class QueueProcessor final
40{
41public:
43 RequestQueue& rQueue,
44 std::shared_ptr<BitmapCache> pCache,
45 const Size& rPreviewSize,
46 const bool bDoSuperSampling,
47 SharedCacheContext pCacheContext);
49
59 void Start (int nPriorityClass);
60 void Stop();
61 void Pause();
62 void Resume();
63
64 void SetPreviewSize (
65 const Size& rSize,
66 const bool bDoSuperSampling);
67
72 void SetBitmapCache (const std::shared_ptr<BitmapCache>& rpCache);
73
74private:
78 std::mutex maMutex;
79
81 DECL_LINK(ProcessRequestHdl, Timer *, void);
86 std::shared_ptr<BitmapCache> mpCache;
89
90 void ProcessRequests();
92 CacheKey aKey,
93 const RequestPriorityClass ePriorityClass);
94};
95
96} // end of namespace ::sd::slidesorter::cache
97
98/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
This factory class creates preview bitmaps for page objects.
This queue processor is timer based, i.e.
void SetBitmapCache(const std::shared_ptr< BitmapCache > &rpCache)
Use this method when the page cache is (maybe) using a different BitmapCache.
std::mutex maMutex
This mutex is used to guard the queue processor.
void ProcessOneRequest(CacheKey aKey, const RequestPriorityClass ePriorityClass)
DECL_LINK(ProcessRequestHdl, Timer *, void)
std::shared_ptr< BitmapCache > mpCache
QueueProcessor(RequestQueue &rQueue, std::shared_ptr< BitmapCache > pCache, const Size &rPreviewSize, const bool bDoSuperSampling, SharedCacheContext pCacheContext)
void Start(int nPriorityClass)
Start the processor.
void SetPreviewSize(const Size &rSize, const bool bDoSuperSampling)
The request queue stores requests that are described by the Request sorted according to priority clas...
RequestPriorityClass
Each request for a preview creation has a priority.
std::shared_ptr< CacheContext > SharedCacheContext