diff options
Diffstat (limited to 'update_manager/variable.h')
-rw-r--r-- | update_manager/variable.h | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/update_manager/variable.h b/update_manager/variable.h index 6c7d3506..9ac7dae6 100644 --- a/update_manager/variable.h +++ b/update_manager/variable.h @@ -83,6 +83,10 @@ class BaseVariable { // variable. In other case, it returns 0. base::TimeDelta GetPollInterval() const { return poll_interval_; } + // Returns true, if the value for this variable is expected to be missing + // sometimes so we can avoid printing confusing error logs. + bool IsMissingOk() const { return missing_ok_; } + // Adds and removes observers for value changes on the variable. This only // works for kVariableAsync variables since the other modes don't track value // changes. Adding the same observer twice has no effect. @@ -115,6 +119,8 @@ class BaseVariable { poll_interval_ = poll_interval; } + void SetMissingOk() { missing_ok_ = true; } + // Calls ValueChanged on all the observers. void NotifyValueChanged() { // Fire all the observer methods from the main loop as single call. In order @@ -140,7 +146,8 @@ class BaseVariable { : name_(name), mode_(mode), poll_interval_(mode == kVariableModePoll ? poll_interval - : base::TimeDelta()) {} + : base::TimeDelta()), + missing_ok_(false) {} void OnValueChangedNotification() { // A ValueChanged() method can change the list of observers, for example @@ -174,6 +181,9 @@ class BaseVariable { // The list of value changes observers. std::list<BaseVariable::ObserverInterface*> observer_list_; + // Defines whether this variable is expected to have no value. + bool missing_ok_; + DISALLOW_COPY_AND_ASSIGN(BaseVariable); }; |