LibreOffice Module sd (master) 1
SlsRequestQueue.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 <osl/mutex.hxx>
25#include <svx/sdrpageuser.hxx>
26
27#include <memory>
28
30{
35{
36public:
37 explicit RequestQueue(SharedCacheContext pCacheContext);
38 virtual ~RequestQueue();
39
53 void AddRequest(CacheKey aKey, RequestPriorityClass eRequestClass);
54
60#if OSL_DEBUG_LEVEL >= 2
61 bool
62#else
63 void
64#endif
66
69 void ChangeClass(CacheKey aKey, RequestPriorityClass eNewRequestClass);
70
74
75 // For debugging.
77
80 void PopFront();
81
84 bool IsEmpty();
85
89 void Clear();
90
93 ::osl::Mutex& GetMutex() { return maMutex; }
94
98 virtual void PageInDestruction(const SdrPage& rPage) override;
99
100private:
101 ::osl::Mutex maMutex;
102 class Container;
103 std::unique_ptr<Container> mpRequestQueue;
105
118};
119
120} // end of namespace ::sd::slidesorter::cache
121
122/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
The request queue stores requests that are described by the Request sorted according to priority clas...
bool IsEmpty()
Returns <TRUE> when there is no element in the queue.
int mnMaximumPriority
An upper bound of the highest priority of all elements in the queues.
bool RemoveRequest(CacheKey aKey)
Remove the specified request from the queue.
::osl::Mutex & GetMutex()
Return the mutex that guards the access to the priority queue.
std::unique_ptr< Container > mpRequestQueue
void AddRequest(CacheKey aKey, RequestPriorityClass eRequestClass)
Insert a request with highest or lowest priority in its priority class.
RequestQueue(SharedCacheContext pCacheContext)
RequestPriorityClass GetFrontPriorityClass()
void PopFront()
Really a synonym for RemoveRequest(GetFront());.
virtual void PageInDestruction(const SdrPage &rPage) override
Ensure we don't hand out a page deleted before anyone got a chance to process it.
void Clear()
Remove all requests from the queue.
void ChangeClass(CacheKey aKey, RequestPriorityClass eNewRequestClass)
Change the priority class of the specified request.
int mnMinimumPriority
A lower bound of the lowest priority of all elements in the queues.
CacheKey GetFront()
Get the request with the highest priority int the highest priority class.
RequestPriorityClass
Each request for a preview creation has a priority.
std::shared_ptr< CacheContext > SharedCacheContext