perfetto: Keep track of allowed target buffers for producers.

Doesn't yet enforce any policies based on the tracked state.

Bug: 73828976
Change-Id: Ie0b0c92cef99d8e2a7be413e87f5f73e4c29669c
diff --git a/src/tracing/core/tracing_service_impl.h b/src/tracing/core/tracing_service_impl.h
index d1a7e35..03d49ee 100644
--- a/src/tracing/core/tracing_service_impl.h
+++ b/src/tracing/core/tracing_service_impl.h
@@ -89,6 +89,7 @@
     void StartDataSource(DataSourceInstanceID, const DataSourceConfig&);
     void StopDataSource(DataSourceInstanceID);
     void Flush(FlushRequestID, const std::vector<DataSourceInstanceID>&);
+    void OnFreeBuffers(const std::vector<BufferID>& target_buffers);
 
    private:
     friend class TracingServiceImpl;
@@ -108,6 +109,10 @@
     size_t shmem_size_hint_bytes_ = 0;
     const std::string name_;
 
+    // Set of the global target_buffer IDs that the producer is configured to
+    // write into in any active tracing session.
+    std::set<BufferID> allowed_target_buffers_;
+
     // This is used only in in-process configurations (mostly tests).
     std::unique_ptr<SharedMemoryArbiterImpl> inproc_shmem_arbiter_;
     PERFETTO_THREAD_CHECKER(thread_checker_)