evaluation_context.h revision 83ffddaa3b09ceb4361e5c01ba300d57ab697a7e
123949d4e086ca984ca2ce07efb6d4ae2bc5daf42Alex Deymo// Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
223949d4e086ca984ca2ce07efb6d4ae2bc5daf42Alex Deymo// Use of this source code is governed by a BSD-style license that can be
323949d4e086ca984ca2ce07efb6d4ae2bc5daf42Alex Deymo// found in the LICENSE file.
423949d4e086ca984ca2ce07efb6d4ae2bc5daf42Alex Deymo
548415f1f6c6c356bfa9ac85b76d8ebcf053f7157Gilad Arnold#ifndef UPDATE_ENGINE_UPDATE_MANAGER_EVALUATION_CONTEXT_H_
648415f1f6c6c356bfa9ac85b76d8ebcf053f7157Gilad Arnold#define UPDATE_ENGINE_UPDATE_MANAGER_EVALUATION_CONTEXT_H_
723949d4e086ca984ca2ce07efb6d4ae2bc5daf42Alex Deymo
823949d4e086ca984ca2ce07efb6d4ae2bc5daf42Alex Deymo#include <map>
948415f1f6c6c356bfa9ac85b76d8ebcf053f7157Gilad Arnold#include <string>
1023949d4e086ca984ca2ce07efb6d4ae2bc5daf42Alex Deymo
1183ffddaa3b09ceb4361e5c01ba300d57ab697a7eGilad Arnold#include <base/bind.h>
1253556eccd206bacd5c9c8bb6605bcceb1bcb6190Alex Deymo#include <base/callback.h>
137b948f060281eb1f9ab198bce67da5aadf03df60Alex Deymo#include <base/memory/ref_counted.h>
141f01291c91ba75102868a76c826a6318f55fb098Alex Deymo#include <base/memory/scoped_ptr.h>
15db799534a8f6ae061ed6d6a46ed800f55d50325bAlex Deymo#include <base/memory/weak_ptr.h>
1675039d7397f03dff77bdf4e26398049ff88edc4cAlex Vakulenko#include <base/time/time.h>
177b948f060281eb1f9ab198bce67da5aadf03df60Alex Deymo
1841a75a7ca3f0252f2c9f991dd465aa332e7ce4d1Alex Deymo#include "update_engine/clock_interface.h"
1963784a578dd26880454d70797519358a2326291bAlex Deymo#include "update_engine/update_manager/boxed_value.h"
2063784a578dd26880454d70797519358a2326291bAlex Deymo#include "update_engine/update_manager/event_loop.h"
2163784a578dd26880454d70797519358a2326291bAlex Deymo#include "update_engine/update_manager/variable.h"
2223949d4e086ca984ca2ce07efb6d4ae2bc5daf42Alex Deymo
2363784a578dd26880454d70797519358a2326291bAlex Deymonamespace chromeos_update_manager {
2423949d4e086ca984ca2ce07efb6d4ae2bc5daf42Alex Deymo
2523949d4e086ca984ca2ce07efb6d4ae2bc5daf42Alex Deymo// The EvaluationContext class is the interface between a policy implementation
2623949d4e086ca984ca2ce07efb6d4ae2bc5daf42Alex Deymo// and the state. The EvaluationContext tracks the variables used by a policy
2723949d4e086ca984ca2ce07efb6d4ae2bc5daf42Alex Deymo// request and caches the returned values, owning those cached values.
2841a75a7ca3f0252f2c9f991dd465aa332e7ce4d1Alex Deymo// The same EvaluationContext should be re-used for all the evaluations of the
2941a75a7ca3f0252f2c9f991dd465aa332e7ce4d1Alex Deymo// same policy request (an AsyncPolicyRequest might involve several
3041a75a7ca3f0252f2c9f991dd465aa332e7ce4d1Alex Deymo// re-evaluations). Each evaluation of the EvaluationContext is run at a given
3141a75a7ca3f0252f2c9f991dd465aa332e7ce4d1Alex Deymo// point in time, which is used as a reference for the evaluation timeout and
32a65fced5f4c2b551616b26ee90a800b44090735fGilad Arnold// the time based queries of the policy, such as
33a65fced5f4c2b551616b26ee90a800b44090735fGilad Arnold// Is{Wallclock,Monotonic}TimeGreaterThan().
3441a75a7ca3f0252f2c9f991dd465aa332e7ce4d1Alex Deymo//
3541a75a7ca3f0252f2c9f991dd465aa332e7ce4d1Alex Deymo// Example:
3641a75a7ca3f0252f2c9f991dd465aa332e7ce4d1Alex Deymo//
37f9f85d6680164064648ce3ed1d31589e1f1b7a29Gilad Arnold//   scoped_refptr<EvaluationContext> ec = new EvaluationContext(...);
3841a75a7ca3f0252f2c9f991dd465aa332e7ce4d1Alex Deymo//
3941a75a7ca3f0252f2c9f991dd465aa332e7ce4d1Alex Deymo//   ...
4041a75a7ca3f0252f2c9f991dd465aa332e7ce4d1Alex Deymo//   // The following call to ResetEvaluation() is optional. Use it to reset the
4141a75a7ca3f0252f2c9f991dd465aa332e7ce4d1Alex Deymo//   // evaluation time if the EvaluationContext isn't used right after its
4241a75a7ca3f0252f2c9f991dd465aa332e7ce4d1Alex Deymo//   // construction.
4341a75a7ca3f0252f2c9f991dd465aa332e7ce4d1Alex Deymo//   ec->ResetEvaluation();
4441a75a7ca3f0252f2c9f991dd465aa332e7ce4d1Alex Deymo//   EvalStatus status = policy->SomeMethod(ec, state, &result, args...);
4541a75a7ca3f0252f2c9f991dd465aa332e7ce4d1Alex Deymo//
4641a75a7ca3f0252f2c9f991dd465aa332e7ce4d1Alex Deymo//   ...
4741a75a7ca3f0252f2c9f991dd465aa332e7ce4d1Alex Deymo//   // Run a closure when any of the used async variables changes its value or
48072359ca138504065e1e0c1189eb38c09576d324Alex Vakulenko//   // the timeout for re-query the values happens again.
4941a75a7ca3f0252f2c9f991dd465aa332e7ce4d1Alex Deymo//   ec->RunOnValueChangeOrTimeout(closure);
5041a75a7ca3f0252f2c9f991dd465aa332e7ce4d1Alex Deymo//   // If the provided |closure| wants to re-evaluate the policy, it should
5141a75a7ca3f0252f2c9f991dd465aa332e7ce4d1Alex Deymo//   // call ec->ResetEvaluation() to start a new evaluation.
5241a75a7ca3f0252f2c9f991dd465aa332e7ce4d1Alex Deymo//
5348415f1f6c6c356bfa9ac85b76d8ebcf053f7157Gilad Arnoldclass EvaluationContext : public base::RefCounted<EvaluationContext>,
5448415f1f6c6c356bfa9ac85b76d8ebcf053f7157Gilad Arnold                          private BaseVariable::ObserverInterface {
5523949d4e086ca984ca2ce07efb6d4ae2bc5daf42Alex Deymo public:
5683ffddaa3b09ceb4361e5c01ba300d57ab697a7eGilad Arnold  EvaluationContext(
5783ffddaa3b09ceb4361e5c01ba300d57ab697a7eGilad Arnold      chromeos_update_engine::ClockInterface* clock,
5883ffddaa3b09ceb4361e5c01ba300d57ab697a7eGilad Arnold      base::TimeDelta evaluation_timeout,
5983ffddaa3b09ceb4361e5c01ba300d57ab697a7eGilad Arnold      base::TimeDelta expiration_timeout,
6083ffddaa3b09ceb4361e5c01ba300d57ab697a7eGilad Arnold      scoped_ptr<base::Callback<void(EvaluationContext*)>> unregister_cb);
61f9f85d6680164064648ce3ed1d31589e1f1b7a29Gilad Arnold  EvaluationContext(chromeos_update_engine::ClockInterface* clock,
62f9f85d6680164064648ce3ed1d31589e1f1b7a29Gilad Arnold                    base::TimeDelta evaluation_timeout)
6383ffddaa3b09ceb4361e5c01ba300d57ab697a7eGilad Arnold      : EvaluationContext(
6483ffddaa3b09ceb4361e5c01ba300d57ab697a7eGilad Arnold          clock, evaluation_timeout, base::TimeDelta::Max(),
6583ffddaa3b09ceb4361e5c01ba300d57ab697a7eGilad Arnold          scoped_ptr<base::Callback<void(EvaluationContext*)>>()) {}
6653556eccd206bacd5c9c8bb6605bcceb1bcb6190Alex Deymo  ~EvaluationContext();
6723949d4e086ca984ca2ce07efb6d4ae2bc5daf42Alex Deymo
6823949d4e086ca984ca2ce07efb6d4ae2bc5daf42Alex Deymo  // Returns a pointer to the value returned by the passed variable |var|. The
6923949d4e086ca984ca2ce07efb6d4ae2bc5daf42Alex Deymo  // EvaluationContext instance keeps the ownership of the returned object. The
7041a75a7ca3f0252f2c9f991dd465aa332e7ce4d1Alex Deymo  // returned object is valid during the life of the evaluation, even if the
7141a75a7ca3f0252f2c9f991dd465aa332e7ce4d1Alex Deymo  // passed Variable changes it.
7223949d4e086ca984ca2ce07efb6d4ae2bc5daf42Alex Deymo  //
7323949d4e086ca984ca2ce07efb6d4ae2bc5daf42Alex Deymo  // In case of error, a NULL value is returned.
7423949d4e086ca984ca2ce07efb6d4ae2bc5daf42Alex Deymo  template<typename T>
7523949d4e086ca984ca2ce07efb6d4ae2bc5daf42Alex Deymo  const T* GetValue(Variable<T>* var);
7623949d4e086ca984ca2ce07efb6d4ae2bc5daf42Alex Deymo
77a65fced5f4c2b551616b26ee90a800b44090735fGilad Arnold  // Returns whether the evaluation time has surpassed |timestamp|, on either
78a65fced5f4c2b551616b26ee90a800b44090735fGilad Arnold  // the ClockInterface::GetWallclockTime() or
79a65fced5f4c2b551616b26ee90a800b44090735fGilad Arnold  // ClockInterface::GetMonotonicTime() scales, respectively.
80a65fced5f4c2b551616b26ee90a800b44090735fGilad Arnold  bool IsWallclockTimeGreaterThan(base::Time timestamp);
81a65fced5f4c2b551616b26ee90a800b44090735fGilad Arnold  bool IsMonotonicTimeGreaterThan(base::Time timestamp);
8241a75a7ca3f0252f2c9f991dd465aa332e7ce4d1Alex Deymo
83f9f85d6680164064648ce3ed1d31589e1f1b7a29Gilad Arnold  // Returns whether the evaluation context has expired.
84f9f85d6680164064648ce3ed1d31589e1f1b7a29Gilad Arnold  bool is_expired() const { return is_expired_; }
85f9f85d6680164064648ce3ed1d31589e1f1b7a29Gilad Arnold
8641a75a7ca3f0252f2c9f991dd465aa332e7ce4d1Alex Deymo  // TODO(deymo): Move the following methods to an interface only visible by the
8763784a578dd26880454d70797519358a2326291bAlex Deymo  // UpdateManager class and not the policy implementations.
8841a75a7ca3f0252f2c9f991dd465aa332e7ce4d1Alex Deymo
8941a75a7ca3f0252f2c9f991dd465aa332e7ce4d1Alex Deymo  // Resets the EvaluationContext to its initial state removing all the
9041a75a7ca3f0252f2c9f991dd465aa332e7ce4d1Alex Deymo  // non-const cached variables and re-setting the evaluation time. This should
9141a75a7ca3f0252f2c9f991dd465aa332e7ce4d1Alex Deymo  // be called right before any new evaluation starts.
9241a75a7ca3f0252f2c9f991dd465aa332e7ce4d1Alex Deymo  void ResetEvaluation();
9341a75a7ca3f0252f2c9f991dd465aa332e7ce4d1Alex Deymo
94fd45a731d9f9176ce134b34e2a84acc0cf403d1dGilad Arnold  // Clears the expiration status of the EvaluationContext and resets its
95fd45a731d9f9176ce134b34e2a84acc0cf403d1dGilad Arnold  // expiration timeout based on |expiration_timeout_|. This should be called if
96fd45a731d9f9176ce134b34e2a84acc0cf403d1dGilad Arnold  // expiration occurred, prior to re-evaluating the policy.
97fd45a731d9f9176ce134b34e2a84acc0cf403d1dGilad Arnold  void ResetExpiration();
98fd45a731d9f9176ce134b34e2a84acc0cf403d1dGilad Arnold
9953556eccd206bacd5c9c8bb6605bcceb1bcb6190Alex Deymo  // Schedules the passed |callback| closure to be called when a cached
100f9f85d6680164064648ce3ed1d31589e1f1b7a29Gilad Arnold  // variable changes its value, a polling interval passes, or the context
101f9f85d6680164064648ce3ed1d31589e1f1b7a29Gilad Arnold  // expiration occurs. If none of these events can happen, for example if
102f9f85d6680164064648ce3ed1d31589e1f1b7a29Gilad Arnold  // there's no cached variable, this method returns false.
10353556eccd206bacd5c9c8bb6605bcceb1bcb6190Alex Deymo  //
10453556eccd206bacd5c9c8bb6605bcceb1bcb6190Alex Deymo  // Right before the passed closure is called the EvaluationContext is
10553556eccd206bacd5c9c8bb6605bcceb1bcb6190Alex Deymo  // reseted, removing all the non-const cached values.
10653556eccd206bacd5c9c8bb6605bcceb1bcb6190Alex Deymo  bool RunOnValueChangeOrTimeout(base::Closure callback);
10753556eccd206bacd5c9c8bb6605bcceb1bcb6190Alex Deymo
108c14902888be0b8d41759e6ff0a7100af4097fd09David Zeuthen  // Returns a textual representation of the evaluation context,
109c14902888be0b8d41759e6ff0a7100af4097fd09David Zeuthen  // including the variables and their values. This is intended only
110c14902888be0b8d41759e6ff0a7100af4097fd09David Zeuthen  // to help with debugging and the format may change in the future.
111c14902888be0b8d41759e6ff0a7100af4097fd09David Zeuthen  std::string DumpContext() const;
112c14902888be0b8d41759e6ff0a7100af4097fd09David Zeuthen
11383ffddaa3b09ceb4361e5c01ba300d57ab697a7eGilad Arnold  // Removes all the Observers callbacks and timeout events scheduled by
11483ffddaa3b09ceb4361e5c01ba300d57ab697a7eGilad Arnold  // RunOnValueChangeOrTimeout(). Also releases and returns the closure
11583ffddaa3b09ceb4361e5c01ba300d57ab697a7eGilad Arnold  // associated with these events. This method is idempotent.
11683ffddaa3b09ceb4361e5c01ba300d57ab697a7eGilad Arnold  scoped_ptr<base::Closure> RemoveObserversAndTimeout();
11783ffddaa3b09ceb4361e5c01ba300d57ab697a7eGilad Arnold
11823949d4e086ca984ca2ce07efb6d4ae2bc5daf42Alex Deymo private:
119fb794f4b7274576e10b0df291655ad6c88a97df4Gilad Arnold  friend class UmEvaluationContextTest;
120fb794f4b7274576e10b0df291655ad6c88a97df4Gilad Arnold
12153556eccd206bacd5c9c8bb6605bcceb1bcb6190Alex Deymo  // BaseVariable::ObserverInterface override.
12253556eccd206bacd5c9c8bb6605bcceb1bcb6190Alex Deymo  void ValueChanged(BaseVariable* var);
12353556eccd206bacd5c9c8bb6605bcceb1bcb6190Alex Deymo
124f9f85d6680164064648ce3ed1d31589e1f1b7a29Gilad Arnold  // Called from the main loop when a scheduled timeout has passed.
125f9f85d6680164064648ce3ed1d31589e1f1b7a29Gilad Arnold  void OnTimeout();
126f9f85d6680164064648ce3ed1d31589e1f1b7a29Gilad Arnold
127f9f85d6680164064648ce3ed1d31589e1f1b7a29Gilad Arnold  // Removes the observers from the used Variables and cancels the timeout,
128f9f85d6680164064648ce3ed1d31589e1f1b7a29Gilad Arnold  // then executes the scheduled callback.
129f9f85d6680164064648ce3ed1d31589e1f1b7a29Gilad Arnold  void OnValueChangedOrTimeout();
13053556eccd206bacd5c9c8bb6605bcceb1bcb6190Alex Deymo
131f9f85d6680164064648ce3ed1d31589e1f1b7a29Gilad Arnold  // If |monotonic_deadline| is not Time::Max(), returns the remaining time
132f9f85d6680164064648ce3ed1d31589e1f1b7a29Gilad Arnold  // until it is reached, or zero if it has passed. Otherwise, returns
133f9f85d6680164064648ce3ed1d31589e1f1b7a29Gilad Arnold  // TimeDelta::Max().
134f9f85d6680164064648ce3ed1d31589e1f1b7a29Gilad Arnold  base::TimeDelta RemainingTime(base::Time monotonic_deadline) const;
13553556eccd206bacd5c9c8bb6605bcceb1bcb6190Alex Deymo
136f9f85d6680164064648ce3ed1d31589e1f1b7a29Gilad Arnold  // Returns a monotonic clock timestamp at which |timeout| will have elapsed
137f9f85d6680164064648ce3ed1d31589e1f1b7a29Gilad Arnold  // since the current time.
138f9f85d6680164064648ce3ed1d31589e1f1b7a29Gilad Arnold  base::Time MonotonicDeadline(base::TimeDelta timeout);
13923949d4e086ca984ca2ce07efb6d4ae2bc5daf42Alex Deymo
14023949d4e086ca984ca2ce07efb6d4ae2bc5daf42Alex Deymo  // A map to hold the cached values for every variable.
14123949d4e086ca984ca2ce07efb6d4ae2bc5daf42Alex Deymo  typedef std::map<BaseVariable*, BoxedValue> ValueCacheMap;
14223949d4e086ca984ca2ce07efb6d4ae2bc5daf42Alex Deymo
14323949d4e086ca984ca2ce07efb6d4ae2bc5daf42Alex Deymo  // The cached values of the called Variables.
14423949d4e086ca984ca2ce07efb6d4ae2bc5daf42Alex Deymo  ValueCacheMap value_cache_;
14523949d4e086ca984ca2ce07efb6d4ae2bc5daf42Alex Deymo
146f9f85d6680164064648ce3ed1d31589e1f1b7a29Gilad Arnold  // A callback used for triggering re-evaluation upon a value change or poll
147f9f85d6680164064648ce3ed1d31589e1f1b7a29Gilad Arnold  // timeout, or notifying about the evaluation context expiration. It is up to
148072359ca138504065e1e0c1189eb38c09576d324Alex Vakulenko  // the caller to determine whether or not expiration occurred via
149072359ca138504065e1e0c1189eb38c09576d324Alex Vakulenko  // is_expired().
150f9f85d6680164064648ce3ed1d31589e1f1b7a29Gilad Arnold  scoped_ptr<base::Closure> callback_;
15153556eccd206bacd5c9c8bb6605bcceb1bcb6190Alex Deymo
15253556eccd206bacd5c9c8bb6605bcceb1bcb6190Alex Deymo  // The EventId returned by the event loop identifying the timeout callback.
153f9f85d6680164064648ce3ed1d31589e1f1b7a29Gilad Arnold  // Used for canceling the timeout callback.
154f9f85d6680164064648ce3ed1d31589e1f1b7a29Gilad Arnold  EventId timeout_event_ = kEventIdNull;
155f9f85d6680164064648ce3ed1d31589e1f1b7a29Gilad Arnold
156f9f85d6680164064648ce3ed1d31589e1f1b7a29Gilad Arnold  // Whether a timeout event firing marks the expiration of the evaluation
157f9f85d6680164064648ce3ed1d31589e1f1b7a29Gilad Arnold  // context.
158f9f85d6680164064648ce3ed1d31589e1f1b7a29Gilad Arnold  bool timeout_marks_expiration_;
159f9f85d6680164064648ce3ed1d31589e1f1b7a29Gilad Arnold
160f9f85d6680164064648ce3ed1d31589e1f1b7a29Gilad Arnold  // Whether the evaluation context has indeed expired.
161f9f85d6680164064648ce3ed1d31589e1f1b7a29Gilad Arnold  bool is_expired_ = false;
16253556eccd206bacd5c9c8bb6605bcceb1bcb6190Alex Deymo
16341a75a7ca3f0252f2c9f991dd465aa332e7ce4d1Alex Deymo  // Pointer to the mockable clock interface;
164f9f85d6680164064648ce3ed1d31589e1f1b7a29Gilad Arnold  chromeos_update_engine::ClockInterface* const clock_;
16541a75a7ca3f0252f2c9f991dd465aa332e7ce4d1Alex Deymo
166a65fced5f4c2b551616b26ee90a800b44090735fGilad Arnold  // The timestamps when the evaluation of this EvaluationContext started,
167a65fced5f4c2b551616b26ee90a800b44090735fGilad Arnold  // corresponding to ClockInterface::GetWallclockTime() and
168a65fced5f4c2b551616b26ee90a800b44090735fGilad Arnold  // ClockInterface::GetMonotonicTime(), respectively. These values are reset
169a65fced5f4c2b551616b26ee90a800b44090735fGilad Arnold  // every time ResetEvaluation() is called.
170a65fced5f4c2b551616b26ee90a800b44090735fGilad Arnold  base::Time evaluation_start_wallclock_;
171a65fced5f4c2b551616b26ee90a800b44090735fGilad Arnold  base::Time evaluation_start_monotonic_;
172a65fced5f4c2b551616b26ee90a800b44090735fGilad Arnold
173a65fced5f4c2b551616b26ee90a800b44090735fGilad Arnold  // The timestamps when a reevaluation should be triggered due to various
174a65fced5f4c2b551616b26ee90a800b44090735fGilad Arnold  // expected value changes, corresponding to ClockInterface::GetWallclockTime()
175a65fced5f4c2b551616b26ee90a800b44090735fGilad Arnold  // and ClockInterface::GetMonotonicTIme(), respectively. These timestamps are
176a65fced5f4c2b551616b26ee90a800b44090735fGilad Arnold  // greater or equal to corresponding |evaluation_start_{wallclock,monotonic}_|
177a65fced5f4c2b551616b26ee90a800b44090735fGilad Arnold  // counterparts since they are in the future; however, they may be smaller
178a65fced5f4c2b551616b26ee90a800b44090735fGilad Arnold  // than the current corresponding times during the course of evaluation.
179a65fced5f4c2b551616b26ee90a800b44090735fGilad Arnold  base::Time reevaluation_time_wallclock_;
180a65fced5f4c2b551616b26ee90a800b44090735fGilad Arnold  base::Time reevaluation_time_monotonic_;
18141a75a7ca3f0252f2c9f991dd465aa332e7ce4d1Alex Deymo
182f9f85d6680164064648ce3ed1d31589e1f1b7a29Gilad Arnold  // The timeout of an evaluation.
183b227199133f2d694414293697c67599a761f23beGilad Arnold  const base::TimeDelta evaluation_timeout_;
18441a75a7ca3f0252f2c9f991dd465aa332e7ce4d1Alex Deymo
18541a75a7ca3f0252f2c9f991dd465aa332e7ce4d1Alex Deymo  // The timestamp in the ClockInterface::GetMonotonicTime() scale at which the
186f9f85d6680164064648ce3ed1d31589e1f1b7a29Gilad Arnold  // current evaluation should finish.
18741a75a7ca3f0252f2c9f991dd465aa332e7ce4d1Alex Deymo  base::Time evaluation_monotonic_deadline_;
18841a75a7ca3f0252f2c9f991dd465aa332e7ce4d1Alex Deymo
189fd45a731d9f9176ce134b34e2a84acc0cf403d1dGilad Arnold  // The expiration timeout of the evaluation context.
190fd45a731d9f9176ce134b34e2a84acc0cf403d1dGilad Arnold  const base::TimeDelta expiration_timeout_;
191fd45a731d9f9176ce134b34e2a84acc0cf403d1dGilad Arnold
192fd45a731d9f9176ce134b34e2a84acc0cf403d1dGilad Arnold  // The monotonic clock deadline at which expiration occurs.
193fd45a731d9f9176ce134b34e2a84acc0cf403d1dGilad Arnold  base::Time expiration_monotonic_deadline_;
194f9f85d6680164064648ce3ed1d31589e1f1b7a29Gilad Arnold
19583ffddaa3b09ceb4361e5c01ba300d57ab697a7eGilad Arnold  // A callback for unregistering the context upon destruction.
19683ffddaa3b09ceb4361e5c01ba300d57ab697a7eGilad Arnold  scoped_ptr<base::Callback<void(EvaluationContext*)>> unregister_cb_;
19783ffddaa3b09ceb4361e5c01ba300d57ab697a7eGilad Arnold
198db799534a8f6ae061ed6d6a46ed800f55d50325bAlex Deymo  base::WeakPtrFactory<EvaluationContext> weak_ptr_factory_;
199db799534a8f6ae061ed6d6a46ed800f55d50325bAlex Deymo
20023949d4e086ca984ca2ce07efb6d4ae2bc5daf42Alex Deymo  DISALLOW_COPY_AND_ASSIGN(EvaluationContext);
20123949d4e086ca984ca2ce07efb6d4ae2bc5daf42Alex Deymo};
20223949d4e086ca984ca2ce07efb6d4ae2bc5daf42Alex Deymo
20363784a578dd26880454d70797519358a2326291bAlex Deymo}  // namespace chromeos_update_manager
20423949d4e086ca984ca2ce07efb6d4ae2bc5daf42Alex Deymo
20523949d4e086ca984ca2ce07efb6d4ae2bc5daf42Alex Deymo// Include the implementation of the template methods.
20663784a578dd26880454d70797519358a2326291bAlex Deymo#include "update_engine/update_manager/evaluation_context-inl.h"
20723949d4e086ca984ca2ce07efb6d4ae2bc5daf42Alex Deymo
20848415f1f6c6c356bfa9ac85b76d8ebcf053f7157Gilad Arnold#endif  // UPDATE_ENGINE_UPDATE_MANAGER_EVALUATION_CONTEXT_H_
209