Set SHM config for multiple producers.

The name of the producer is passed through the Connect methods.
This name is matched to the name in the trace config so that producer specific configs can be set.

Bug:74098471
Change-Id: I2aa9a910191d395259178eff62a5c750b3ed81d7
diff --git a/src/tracing/core/service_impl.h b/src/tracing/core/service_impl.h
index ce76ac7..4f7428c 100644
--- a/src/tracing/core/service_impl.h
+++ b/src/tracing/core/service_impl.h
@@ -60,7 +60,8 @@
                          uid_t uid,
                          ServiceImpl*,
                          base::TaskRunner*,
-                         Producer*);
+                         Producer*,
+                         const std::string& producer_name);
     ~ProducerEndpointImpl() override;
 
     // Service::ProducerEndpoint implementation.
@@ -90,10 +91,10 @@
     SharedMemoryABI shmem_abi_;
     size_t shared_memory_size_hint_bytes_ = 0;
     DataSourceID last_data_source_id_ = 0;
+    const std::string name_;
 
     // This is used only in in-process configurations (mostly tests).
     std::unique_ptr<SharedMemoryArbiterImpl> inproc_shmem_arbiter_;
-
     PERFETTO_THREAD_CHECKER(thread_checker_)
   };
 
@@ -162,6 +163,7 @@
   std::unique_ptr<Service::ProducerEndpoint> ConnectProducer(
       Producer*,
       uid_t uid,
+      const std::string& producer_name,
       size_t shared_memory_size_hint_bytes = 0) override;
 
   std::unique_ptr<Service::ConsumerEndpoint> ConnectConsumer(
@@ -193,12 +195,6 @@
 
     size_t num_buffers() const { return buffers_index.size(); }
 
-    // Retrieves the page size from the trace config.
-    size_t GetDesiredPageSizeKb();
-
-    // Retrieves the SHM size from the trace config.
-    size_t GetDesiredShmSizeKb();
-
     int next_write_period_ms() const {
       PERFETTO_DCHECK(write_period_ms);
       // TODO(primiano): this will drift. Synchronize % period so it aligns.
@@ -243,6 +239,7 @@
   ServiceImpl& operator=(const ServiceImpl&) = delete;
 
   void CreateDataSourceInstance(const TraceConfig::DataSource&,
+                                const TraceConfig::ProducerConfig&,
                                 const RegisteredDataSource&,
                                 TracingSession*);