buffet: Replace CallbackList with vector<Callback>
We don't remove callback at runtime, so callbacks on WeakPtr
are enough there.
BUG=brillo:697
TEST=FEATURE=test emerge-gizmo buffet
Change-Id: I02573979b208d0e9df62e59f4bb3bbec92608b71
Reviewed-on: https://chromium-review.googlesource.com/270279
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Vitaly Buka <vitalybuka@chromium.org>
Tested-by: Vitaly Buka <vitalybuka@chromium.org>
diff --git a/buffet/commands/command_manager.cc b/buffet/commands/command_manager.cc
index dd90e7d..de2125b 100644
--- a/buffet/commands/command_manager.cc
+++ b/buffet/commands/command_manager.cc
@@ -53,7 +53,8 @@
chromeos::ErrorPtr* error) {
bool result =
dictionary_.LoadCommands(json, category, &base_dictionary_, error);
- on_command_changed_.Notify();
+ for (const auto& cb : on_command_changed_)
+ cb.Run();
return result;
}
@@ -128,10 +129,10 @@
// Now that we know that all the command names were valid,
// update the respective commands' visibility.
- for (CommandDefinition* def : definitions) {
+ for (CommandDefinition* def : definitions)
def->SetVisibility(visibility);
- }
- on_command_changed_.Notify();
+ for (const auto& cb : on_command_changed_)
+ cb.Run();
return true;
}