Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Friends | List of all members
dart::IdleTimeHandler Class Reference

#include <isolate.h>

Inheritance diagram for dart::IdleTimeHandler:
dart::ValueObject

Public Member Functions

 IdleTimeHandler ()
 
void InitializeWithHeap (Heap *heap)
 
bool ShouldCheckForIdle ()
 
void UpdateStartIdleTime ()
 
bool ShouldNotifyIdle (int64_t *expiry)
 
void NotifyIdle (int64_t deadline)
 
void NotifyIdleUsingDefaultDeadline ()
 
- Public Member Functions inherited from dart::ValueObject
 ValueObject ()
 
 ~ValueObject ()
 

Friends

class DisableIdleTimerScope
 

Detailed Description

Definition at line 208 of file isolate.h.

Constructor & Destructor Documentation

◆ IdleTimeHandler()

dart::IdleTimeHandler::IdleTimeHandler ( )
inline

Definition at line 210 of file isolate.h.

210{}

Member Function Documentation

◆ InitializeWithHeap()

void dart::IdleTimeHandler::InitializeWithHeap ( Heap heap)

Definition at line 190 of file isolate.cc.

190 {
191 MutexLocker ml(&mutex_);
192 ASSERT(heap_ == nullptr && heap != nullptr);
193 heap_ = heap;
194}
#define ASSERT(E)

◆ NotifyIdle()

void dart::IdleTimeHandler::NotifyIdle ( int64_t  deadline)

Definition at line 225 of file isolate.cc.

225 {
226 {
227 MutexLocker ml(&mutex_);
228 disabled_counter_++;
229 }
230 if (heap_ != nullptr) {
231 heap_->NotifyIdle(deadline);
232 }
233 {
234 MutexLocker ml(&mutex_);
235 disabled_counter_--;
236 idle_start_time_ = 0;
237 }
238}
void NotifyIdle(int64_t deadline)
Definition heap.cc:374

◆ NotifyIdleUsingDefaultDeadline()

void dart::IdleTimeHandler::NotifyIdleUsingDefaultDeadline ( )

Definition at line 240 of file isolate.cc.

240 {
241 const int64_t now = OS::GetCurrentMonotonicMicros();
242 NotifyIdle(now + FLAG_idle_duration_micros);
243}
void NotifyIdle(int64_t deadline)
Definition isolate.cc:225
static int64_t GetCurrentMonotonicMicros()

◆ ShouldCheckForIdle()

bool dart::IdleTimeHandler::ShouldCheckForIdle ( )

Definition at line 196 of file isolate.cc.

196 {
197 MutexLocker ml(&mutex_);
198 return idle_start_time_ > 0 && FLAG_idle_timeout_micros != 0 &&
199 disabled_counter_ == 0;
200}

◆ ShouldNotifyIdle()

bool dart::IdleTimeHandler::ShouldNotifyIdle ( int64_t *  expiry)

Definition at line 209 of file isolate.cc.

209 {
210 const int64_t now = OS::GetCurrentMonotonicMicros();
211
212 MutexLocker ml(&mutex_);
213 if (idle_start_time_ > 0 && disabled_counter_ == 0) {
214 const int64_t expiry_time = idle_start_time_ + FLAG_idle_timeout_micros;
215 if (expiry_time < now) {
216 idle_start_time_ = 0;
217 return true;
218 }
219 }
220
221 *expiry = now + FLAG_idle_timeout_micros;
222 return false;
223}

◆ UpdateStartIdleTime()

void dart::IdleTimeHandler::UpdateStartIdleTime ( )

Definition at line 202 of file isolate.cc.

202 {
203 MutexLocker ml(&mutex_);
204 if (disabled_counter_ == 0) {
205 idle_start_time_ = OS::GetCurrentMonotonicMicros();
206 }
207}

Friends And Related Symbol Documentation

◆ DisableIdleTimerScope

friend class DisableIdleTimerScope
friend

Definition at line 233 of file isolate.h.


The documentation for this class was generated from the following files: