buffet: Separate command IDs from DBus paths. As we're starting to support cloud and local cases, we need proper support for cloud command IDs. Therefore now we require each command instance to have some command id, but generate dbus path independently. BUG=None TEST=cros_workon_make buffet --test&&manual Change-Id: I83ae92872d920c8e0d6e15324ad11feebfd1f540 Reviewed-on: https://chromium-review.googlesource.com/226532 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_queue.h b/buffet/commands/command_queue.h index 6d81b34..6d6547d 100644 --- a/buffet/commands/command_queue.h +++ b/buffet/commands/command_queue.h
@@ -35,11 +35,9 @@ size_t GetCount() const { return map_.size(); } // Adds a new command to the queue. Each command in the queue has a unique - // ID that identifies that command instance in this queue. This identifier - // has no relation to any GCD command identifiers or anything else. Just a - // unique key in this queue class. - // The ID string of the added command is returned by this method. - std::string Add(std::unique_ptr<CommandInstance> instance); + // ID that identifies that command instance in this queue. + // One shouldn't attempt to add a command with the same ID. + void Add(std::unique_ptr<CommandInstance> instance); // Removes a command identified by |id| from the queue. Returns a unique // pointer to the command instance if removed successfully, or an empty @@ -54,8 +52,6 @@ private: // ID-to-CommandInstance map. std::map<std::string, std::unique_ptr<CommandInstance>> map_; - // Counter for generating unique command IDs. - int next_id_ = 0; // Callback interface for command dispatch, if provided. CommandDispachInterface* dispatch_interface_ = nullptr;