[flutter] Add Session::Present flow begin event

Test: CQ, take a trace
Change-Id: If50557d194bbb0c0d3c2a4173107ce7ec8eb8dbd
diff --git a/runtime/flutter_runner/session_connection.cc b/runtime/flutter_runner/session_connection.cc
index 51ae1e2..8a93655 100644
--- a/runtime/flutter_runner/session_connection.cc
+++ b/runtime/flutter_runner/session_connection.cc
@@ -89,6 +89,10 @@
 }
 
 void SessionConnection::PresentSession() {
+  TRACE_DURATION("gfx", "SessionConnection::PresentSession");
+  TRACE_FLOW_BEGIN("gfx", "Session::Present", next_present_trace_id_);
+  next_present_trace_id_++;
+
   ToggleSignal(vsync_event_handle_, false);
   session_wrapper_.Present(
       0,  // presentation_time. (placeholder).
diff --git a/runtime/flutter_runner/session_connection.h b/runtime/flutter_runner/session_connection.h
index 22afbc3..df0c5b6 100644
--- a/runtime/flutter_runner/session_connection.h
+++ b/runtime/flutter_runner/session_connection.h
@@ -6,6 +6,7 @@
 #define TOPAZ_RUNTIME_FLUTTER_RUNNER_SESSION_CONNECTION_H_
 
 #include <lib/fit/function.h>
+#include <trace/event.h>
 #include <zx/eventpair.h>
 
 #include "flutter/flow/compositor_context.h"
@@ -84,6 +85,12 @@
   flow::SceneUpdateContext scene_update_context_;
   zx_handle_t vsync_event_handle_;
 
+  // A flow event trace id for following |Session::Present| calls into
+  // Scenic.  This will be incremented each |Session::Present| call.  By
+  // convention, the Scenic side will also contain its own trace id that
+  // begins at 0, and is incremented each |Session::Present| call.
+  uint64_t next_present_trace_id_ = 0;
+
   void EnqueueClearOps();
 
   void PresentSession();