optimization_target_model_observer.h 1.4 KB

1234567891011121314151617181920212223242526272829303132
  1. // Copyright 2020 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef COMPONENTS_OPTIMIZATION_GUIDE_CORE_OPTIMIZATION_TARGET_MODEL_OBSERVER_H_
  5. #define COMPONENTS_OPTIMIZATION_GUIDE_CORE_OPTIMIZATION_TARGET_MODEL_OBSERVER_H_
  6. #include "base/files/file_path.h"
  7. #include "base/observer_list_types.h"
  8. #include "components/optimization_guide/core/model_info.h"
  9. #include "components/optimization_guide/proto/models.pb.h"
  10. #include "third_party/abseil-cpp/absl/types/optional.h"
  11. namespace optimization_guide {
  12. // Observes |optimization_guide::OptimizationGuideDecider| for updates to models
  13. // for a particular optimization target.
  14. class OptimizationTargetModelObserver : public base::CheckedObserver {
  15. public:
  16. // Invoked when a model for |optimization_target| has been updated. It is
  17. // guaranteed that this method will only be invoked for targets that |this|
  18. // is added as an observer for.
  19. //
  20. // When this observer is first added, it will call this function with the
  21. // model it already has on device, if applicable.
  22. virtual void OnModelUpdated(proto::OptimizationTarget optimization_target,
  23. const ModelInfo& model_info) = 0;
  24. };
  25. } // namespace optimization_guide
  26. #endif // COMPONENTS_OPTIMIZATION_GUIDE_CORE_OPTIMIZATION_TARGET_MODEL_OBSERVER_H_