buffet: Add state change queue

When device state properties are updated, compile the change
notifications in StateChangeQueue object so they can be pulled
by Cloud Server adaptor and batch-update the device state on
the server.

When StateManager receives property updates, it notifies the
StateChangeQueue object of the changes via StateChangeQueueInterface.
The changes are kept in the queue along with the their time stamps
until they are pulled by Cloud Server adaper (using StateChangeQueue
method). At this point, the adapter would notify the server of
recorded device state changes and the StateChangeQueue is cleared,
ready to record new state updates.

BUG=chromium:415364
TEST=FEATURES=test emerge-link buffet

Change-Id: Ie99e2ada39aaf0164e08699d65153abfc5235a2f
Reviewed-on: https://chromium-review.googlesource.com/226014
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
Reviewed-by: Christopher Wiley <wiley@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
diff --git a/buffet/manager.h b/buffet/manager.h
index 4fcf445..7ce33cc 100644
--- a/buffet/manager.h
+++ b/buffet/manager.h
@@ -28,6 +28,7 @@
 namespace buffet {
 
 class CommandManager;
+class StateChangeQueue;
 class StateManager;
 
 // The Manager is responsible for global state of Buffet.  It exposes
@@ -38,6 +39,8 @@
   explicit Manager(
       const base::WeakPtr<chromeos::dbus_utils::ExportedObjectManager>&
           object_manager);
+  ~Manager();
+
   void RegisterAsync(
       const chromeos::dbus_utils::AsyncEventSequencer::CompletionAction& cb);
 
@@ -66,6 +69,7 @@
   chromeos::dbus_utils::DBusObject dbus_object_;
 
   std::shared_ptr<CommandManager> command_manager_;
+  std::unique_ptr<StateChangeQueue> state_change_queue_;
   std::shared_ptr<StateManager> state_manager_;
   std::unique_ptr<DeviceRegistrationInfo> device_info_;