bump product version to 6.4.0.3
[LibreOffice.git] / vcl / inc / opengl / watchdog.hxx
bloba675894c4ff3e794c1941095e7f40d252485c1c8
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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 */
10 #ifndef INCLUDED_VCL_INC_OPENGL_WATCHDOG_H
11 #define INCLUDED_VCL_INC_OPENGL_WATCHDOG_H
13 #include <sal/config.h>
14 #include <salhelper/thread.hxx>
15 #include <atomic>
16 #include <vector>
18 struct WatchdogTimingsValues
20 /// delays to take various actions in 1/4 of a second increments.
21 int mnDisableEntries;
22 int const mnAbortAfter;
25 enum class WatchdogTimingMode
27 NORMAL,
28 SHADER_COMPILE
31 class WatchdogTimings
33 private:
34 std::vector<WatchdogTimingsValues> maTimingValues;
35 std::atomic<bool> mbRelaxed;
37 public:
38 WatchdogTimings();
40 void setRelax(bool bRelaxed)
42 mbRelaxed = bRelaxed;
45 WatchdogTimingsValues const & getWatchdogTimingsValues(WatchdogTimingMode eMode)
47 size_t index = (eMode == WatchdogTimingMode::SHADER_COMPILE) ? 1 : 0;
48 index = mbRelaxed ? index + 2 : index;
50 return maTimingValues[index];
54 class OpenGLWatchdogThread : private salhelper::Thread
56 OpenGLWatchdogThread();
57 virtual void execute() override;
58 public:
59 using salhelper::Thread::acquire;
60 using salhelper::Thread::release;
61 static void start();
62 static void stop();
65 #endif // INCLUDED_VCL_INC_OPENGL_WATCHDOG_H
67 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */