mirror of
https://github.com/esphome/esphome.git
synced 2026-09-11 23:37:34 +00:00
Make set_loop_component_start_time_ protected with Scheduler friend
This commit is contained in:
@@ -103,12 +103,6 @@ class Application {
|
||||
void set_current_component(Component *component) { this->current_component_ = component; }
|
||||
Component *get_current_component() { return this->current_component_; }
|
||||
|
||||
/// Update the cached loop component start time. Used by the scheduler before
|
||||
/// dispatching a queued callback so callers reading
|
||||
/// get_loop_component_start_time() inside the callback observe a fresh value
|
||||
/// instead of one inherited from the prior loop iteration's last component.
|
||||
void set_loop_component_start_time(uint32_t now) { this->loop_component_start_time_ = now; }
|
||||
|
||||
// Entity register methods (generated from entity_types.h).
|
||||
// Each entity type gets two overloads:
|
||||
// - register_<entity>(obj) — bare push_back
|
||||
@@ -383,12 +377,19 @@ class Application {
|
||||
|
||||
protected:
|
||||
friend Component;
|
||||
friend class Scheduler;
|
||||
#ifdef USE_RUNTIME_STATS
|
||||
friend class runtime_stats::RuntimeStatsCollector;
|
||||
#endif
|
||||
friend void ::setup();
|
||||
friend void ::original_setup();
|
||||
|
||||
/// Update the cached loop component start time. Used by the scheduler before
|
||||
/// dispatching a queued callback so callers reading
|
||||
/// get_loop_component_start_time() inside the callback observe a fresh value
|
||||
/// instead of one inherited from the prior loop iteration's last component.
|
||||
void set_loop_component_start_time_(uint32_t now) { this->loop_component_start_time_ = now; }
|
||||
|
||||
/// Walk all registered components looking for any whose component_state_
|
||||
/// has the given flag set. Used by Component::status_clear_*_slow_path_()
|
||||
/// (which is a friend) to decide whether to clear the corresponding bit on
|
||||
|
||||
@@ -776,7 +776,7 @@ uint32_t HOT Scheduler::execute_item_(SchedulerItem *item, uint32_t now) {
|
||||
// App.get_loop_component_start_time() observe the dispatch time of this
|
||||
// item rather than a stale value from the prior loop iteration's last
|
||||
// component phase.
|
||||
App.set_loop_component_start_time(now);
|
||||
App.set_loop_component_start_time_(now);
|
||||
WarnIfComponentBlockingGuard guard{item->component, now};
|
||||
item->callback();
|
||||
uint32_t end = guard.finish();
|
||||
|
||||
Reference in New Issue
Block a user