buffet: Support multiple proxies for a command.
This is necessary to support Cloud API updates on command
changes.
BUG=None
TEST=cros_workon_make buffet --test&&manual
Change-Id: I09149d02c0564aa89c74bd66356b63547c17724f
Reviewed-on: https://chromium-review.googlesource.com/226533
Tested-by: Anton Muhin <antonm@chromium.org>
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Anton Muhin <antonm@chromium.org>
diff --git a/buffet/commands/command_instance.cc b/buffet/commands/command_instance.cc
index 9e1211a..f403630 100644
--- a/buffet/commands/command_instance.cc
+++ b/buffet/commands/command_instance.cc
@@ -137,8 +137,9 @@
if (progress != progress_) {
progress_ = progress;
SetStatus(kStatusInProgress);
- if (proxy_)
- proxy_->OnProgressChanged(progress_);
+ for (auto& proxy : proxies_) {
+ proxy->OnProgressChanged(progress_);
+ }
}
return true;
}
@@ -165,8 +166,9 @@
void CommandInstance::SetStatus(const std::string& status) {
if (status != status_) {
status_ = status;
- if (proxy_)
- proxy_->OnStatusChanged(status_);
+ for (auto& proxy : proxies_) {
+ proxy->OnStatusChanged(status_);
+ }
}
}