buffet: Add ObjectManager interface to /org/chromium/Buffet

BUG=chromium:359190
TEST=`buffet_client GetManagedObjects` returns
message_type: MESSAGE_METHOD_RETURN
destination: :1.35
sender: :1.31
signature: a{oa{sa{sv}}}
serial: 10
reply_serial: 3

array [
  dict entry {
    object_path "/org/chromium/Buffet/Manager"
    array [
      dict entry {
        string "org.chromium.Buffet.Manager"
        array [
          dict entry {
            string "State"
            variant               string "{}"
          }
        ]
      }
    ]
  }
]

Done.

Change-Id: I2bbcc9a3f71c7ec6ab76cb4600dad7efe1a8bb0a
Reviewed-on: https://chromium-review.googlesource.com/198963
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Christopher Wiley <wiley@chromium.org>
Tested-by: Christopher Wiley <wiley@chromium.org>
Reviewed-by: Ilja Friedel <ihf@chromium.org>
diff --git a/buffet/async_event_sequencer.h b/buffet/async_event_sequencer.h
index ab5bc1a..96adad7 100644
--- a/buffet/async_event_sequencer.h
+++ b/buffet/async_event_sequencer.h
@@ -41,24 +41,32 @@
                                const std::string& method_name,
                                bool success)> ExportHandler;
   typedef base::Callback<void(bool all_succeeded)> CompletionAction;
+  typedef base::Callback<void(void)> CompletionTask;
 
   AsyncEventSequencer();
+
   // Get a Finished handler callback.  Each callback is "unique" in the sense
   // that subsequent calls to GetHandler() will create new handlers
   // which will need to be called before completion actions are run.
   Handler GetHandler(const std::string& descriptive_message,
                      bool failure_is_fatal);
+
   // Like GetHandler except with a signature tailored to
   // ExportedObject's ExportMethod callback requirements.  Will also assert
   // that the passed interface/method names from ExportedObject are correct.
   ExportHandler GetExportHandler(
       const std::string& interface_name, const std::string& method_name,
       const std::string& descriptive_message, bool failure_is_fatal);
+
   // Once all handlers obtained via GetHandler have run,
   // we'll run each CompletionAction, then discard our references.
   // No more handlers may be obtained after this call.
   void OnAllTasksCompletedCall(std::vector<CompletionAction> actions);
 
+  // Wrap a CompletionTask with a function that discards the result.
+  // This CompletionTask retains no references to the AsyncEventSequencer.
+  CompletionAction WrapCompletionTask(const CompletionTask& task);
+
  private:
   // We'll partially bind this function before giving it back via
   // GetHandler.  Note that the returned callbacks have