Page Speed Optimization Libraries
1.13.35.1
|
#include "mock_scheduler.h"
Public Member Functions | |
MockScheduler (ThreadSystem *thread_system, MockTimer *timer) | |
virtual void | RegisterWorker (QueuedWorkerPool::Sequence *w) LOCKS_EXCLUDED(mutex()) |
virtual void | UnregisterWorker (QueuedWorkerPool::Sequence *w) LOCKS_EXCLUDED(mutex()) |
void | AwaitQuiescence () LOCKS_EXCLUDED(mutex()) |
Blocks until all work in registered workers is done. | |
void | AdvanceTimeMs (int64 timeout_ms) LOCKS_EXCLUDED(mutex()) |
Similar to BlockingTimedWaitUs but takes the lock for convenience. | |
void | AdvanceTimeUs (int64 timeout_us) LOCKS_EXCLUDED(mutex()) |
void | SetTimeUs (int64 time_us) LOCKS_EXCLUDED(mutex()) |
Sets the current absolute time using absolute numbers. | |
Public Member Functions inherited from net_instaweb::Scheduler | |
Scheduler (ThreadSystem *thread_system, Timer *timer) | |
ThreadSystem::CondvarCapableMutex * | mutex () LOCK_RETURNED(mutex_) |
void | DCheckLocked () EXCLUSIVE_LOCKS_REQUIRED(mutex()) |
Optionally check that mutex is locked for debugging purposes. | |
void | BlockingTimedWaitMs (int64 timeout_ms) EXCLUSIVE_LOCKS_REQUIRED(mutex()) |
Wait at most timeout_ms, or until Signal() is called. More... | |
void | BlockingTimedWaitUs (int64 timeout_us) EXCLUSIVE_LOCKS_REQUIRED(mutex()) |
void | TimedWaitMs (int64 timeout_ms, Function *callback) EXCLUSIVE_LOCKS_REQUIRED(mutex()) |
void | Signal () EXCLUSIVE_LOCKS_REQUIRED(mutex()) |
Alarm * | AddAlarmAtUs (int64 wakeup_time_us, Function *callback) LOCKS_EXCLUDED(mutex()) |
Alarm * | AddAlarmAtUsMutexHeld (int64 wakeup_time_us, Function *callback) EXCLUSIVE_LOCKS_REQUIRED(mutex()) |
bool | CancelAlarm (Alarm *alarm) EXCLUSIVE_LOCKS_REQUIRED(mutex()) |
bool | ProcessAlarmsOrWaitUs (int64 timeout_us) EXCLUSIVE_LOCKS_REQUIRED(mutex()) |
Timer * | timer () |
ThreadSystem * | thread_system () |
Obtain the thread system used by the scheduler. | |
void | Wakeup () |
int64 | RunAlarms (bool *ran_alarms) EXCLUSIVE_LOCKS_REQUIRED(mutex()) |
Sequence * | NewSequence () |
Creates a new sequence, controlled by the scheduler. | |
Protected Member Functions | |
virtual void | AwaitWakeupUntilUs (int64 wakeup_time_us) EXCLUSIVE_LOCKS_REQUIRED(mutex()) |
Protected Member Functions inherited from net_instaweb::Scheduler | |
bool | running_waiting_alarms () const |
Implements a Scheduler where time is virtualized, and TimedWait blocks the thread until mock-time is advanced.
The TimedWait implemention employs the worker's idle_callback to signal the underlying condition variable when the requested time has passed.
|
protectedvirtual |
Internal method to await a wakeup event. Block until wakeup_time_us (an absolute time since the epoch), or until something interesting (such as a call to Signal) occurs. This is virtual to permit us to mock it out (the mock simply advances time). This maybe called with 0 in case where there are no timers currently active.
Reimplemented from net_instaweb::Scheduler.
|
virtual |
These methods notify the scheduler of work sequences that may run work on it. They are only used for time simulations in MockScheduler and are no-ops during normal usage.
Reimplemented from net_instaweb::Scheduler.