build fix: no comphelper/profilezone.hxx in this branch
[LibreOffice.git] / vcl / source / app / idle.cxx
blob10a7a495a92fed38dd5febf7e5ccda278eebe8c7
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <vcl/idle.hxx>
21 #include "saltimer.hxx"
23 void Idle::Invoke()
25 maIdleHdl.Call( this );
28 Idle& Idle::operator=( const Idle& rIdle )
30 Scheduler::operator=(rIdle);
31 maIdleHdl = rIdle.maIdleHdl;
32 return *this;
35 Idle::Idle( const sal_Char *pDebugName ) : Scheduler( pDebugName )
39 Idle::Idle( const Idle& rIdle ) : Scheduler(rIdle)
41 maIdleHdl = rIdle.maIdleHdl;
44 void Idle::Start()
46 Scheduler::Start();
48 sal_uInt64 nPeriod = Scheduler::ImmediateTimeoutMs;
49 if (Scheduler::GetDeterministicMode())
51 switch (mePriority)
53 case SchedulerPriority::LOW:
54 case SchedulerPriority::LOWER:
55 case SchedulerPriority::LOWEST:
56 nPeriod = Scheduler::InfiniteTimeoutMs;
57 break;
58 default:
59 break;
63 Scheduler::ImplStartTimer(nPeriod);
66 bool Idle::ReadyForSchedule( bool bTimerOnly, sal_uInt64 /* nTimeNow */ ) const
68 // always ready if not only looking for timers.
69 return !bTimerOnly;
72 bool Idle::IsIdle() const
74 return true;
77 sal_uInt64 Idle::UpdateMinPeriod( sal_uInt64 /* nMinPeriod */, sal_uInt64 /* nTime */ ) const
79 assert(false); // idles currently don't hit this.
80 return ImmediateTimeoutMs;
83 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */