Rename Service to TracingService.

Bug: 74331089
Change-Id: Icdfa59d23ed661f0f103733488513d7a4e817b23
diff --git a/Android.bp b/Android.bp
index 69838e8..10f63b1 100644
--- a/Android.bp
+++ b/Android.bp
@@ -85,7 +85,6 @@
     "src/tracing/core/null_trace_writer.cc",
     "src/tracing/core/packet_stream_validator.cc",
     "src/tracing/core/process_stats_config.cc",
-    "src/tracing/core/service_impl.cc",
     "src/tracing/core/shared_memory_abi.cc",
     "src/tracing/core/shared_memory_arbiter_impl.cc",
     "src/tracing/core/sliced_protobuf_input_stream.cc",
@@ -94,6 +93,7 @@
     "src/tracing/core/trace_config.cc",
     "src/tracing/core/trace_packet.cc",
     "src/tracing/core/trace_writer_impl.cc",
+    "src/tracing/core/tracing_service_impl.cc",
     "src/tracing/core/virtual_destructors.cc",
   ],
   shared_libs: [
@@ -182,7 +182,6 @@
     "src/tracing/core/null_trace_writer.cc",
     "src/tracing/core/packet_stream_validator.cc",
     "src/tracing/core/process_stats_config.cc",
-    "src/tracing/core/service_impl.cc",
     "src/tracing/core/shared_memory_abi.cc",
     "src/tracing/core/shared_memory_arbiter_impl.cc",
     "src/tracing/core/sliced_protobuf_input_stream.cc",
@@ -191,6 +190,7 @@
     "src/tracing/core/trace_config.cc",
     "src/tracing/core/trace_packet.cc",
     "src/tracing/core/trace_writer_impl.cc",
+    "src/tracing/core/tracing_service_impl.cc",
     "src/tracing/core/virtual_destructors.cc",
     "src/tracing/ipc/consumer/consumer_ipc_client_impl.cc",
     "src/tracing/ipc/default_socket.cc",
@@ -338,7 +338,6 @@
     "src/tracing/core/null_trace_writer.cc",
     "src/tracing/core/packet_stream_validator.cc",
     "src/tracing/core/process_stats_config.cc",
-    "src/tracing/core/service_impl.cc",
     "src/tracing/core/shared_memory_abi.cc",
     "src/tracing/core/shared_memory_arbiter_impl.cc",
     "src/tracing/core/sliced_protobuf_input_stream.cc",
@@ -347,6 +346,7 @@
     "src/tracing/core/trace_config.cc",
     "src/tracing/core/trace_packet.cc",
     "src/tracing/core/trace_writer_impl.cc",
+    "src/tracing/core/tracing_service_impl.cc",
     "src/tracing/core/virtual_destructors.cc",
     "test/end_to_end_integrationtest.cc",
     "test/fake_producer.cc",
@@ -3498,7 +3498,6 @@
     "src/tracing/core/null_trace_writer.cc",
     "src/tracing/core/packet_stream_validator.cc",
     "src/tracing/core/process_stats_config.cc",
-    "src/tracing/core/service_impl.cc",
     "src/tracing/core/shared_memory_abi.cc",
     "src/tracing/core/shared_memory_arbiter_impl.cc",
     "src/tracing/core/sliced_protobuf_input_stream.cc",
@@ -3507,6 +3506,7 @@
     "src/tracing/core/trace_config.cc",
     "src/tracing/core/trace_packet.cc",
     "src/tracing/core/trace_writer_impl.cc",
+    "src/tracing/core/tracing_service_impl.cc",
     "src/tracing/core/virtual_destructors.cc",
     "src/tracing/ipc/consumer/consumer_ipc_client_impl.cc",
     "src/tracing/ipc/default_socket.cc",
@@ -3742,7 +3742,6 @@
     "src/tracing/core/packet_stream_validator_unittest.cc",
     "src/tracing/core/patch_list_unittest.cc",
     "src/tracing/core/process_stats_config.cc",
-    "src/tracing/core/service_impl.cc",
     "src/tracing/core/service_impl_unittest.cc",
     "src/tracing/core/shared_memory_abi.cc",
     "src/tracing/core/shared_memory_abi_unittest.cc",
@@ -3759,6 +3758,7 @@
     "src/tracing/core/trace_writer_for_testing.cc",
     "src/tracing/core/trace_writer_impl.cc",
     "src/tracing/core/trace_writer_impl_unittest.cc",
+    "src/tracing/core/tracing_service_impl.cc",
     "src/tracing/core/virtual_destructors.cc",
     "src/tracing/ipc/consumer/consumer_ipc_client_impl.cc",
     "src/tracing/ipc/default_socket.cc",
diff --git a/include/perfetto/tracing/core/BUILD.gn b/include/perfetto/tracing/core/BUILD.gn
index 1a962b0..1320683 100644
--- a/include/perfetto/tracing/core/BUILD.gn
+++ b/include/perfetto/tracing/core/BUILD.gn
@@ -23,7 +23,6 @@
     "data_source_config.h",
     "data_source_descriptor.h",
     "producer.h",
-    "service.h",
     "shared_memory.h",
     "shared_memory_abi.h",
     "shared_memory_arbiter.h",
@@ -31,5 +30,6 @@
     "trace_config.h",
     "trace_packet.h",
     "trace_writer.h",
+    "tracing_service.h",
   ]
 }
diff --git a/include/perfetto/tracing/core/consumer.h b/include/perfetto/tracing/core/consumer.h
index 08d5066..98e917d 100644
--- a/include/perfetto/tracing/core/consumer.h
+++ b/include/perfetto/tracing/core/consumer.h
@@ -51,9 +51,10 @@
   virtual void OnTracingDisabled() = 0;
 
   // Called back by the Service (or transport layer) after invoking
-  // Service::ConsumerEndpoint::ReadBuffers(). This function can be called more
-  // than once. Each invocation can carry one or more TracePacket(s).
-  // Upon the last call, |has_more| is set to true (i.e. |has_more| is a !EOF).
+  // TracingService::ConsumerEndpoint::ReadBuffers(). This function can be
+  // called more than once. Each invocation can carry one or more
+  // TracePacket(s). Upon the last call, |has_more| is set to true (i.e.
+  // |has_more| is a !EOF).
   virtual void OnTraceData(std::vector<TracePacket>, bool has_more) = 0;
 };
 
diff --git a/include/perfetto/tracing/core/producer.h b/include/perfetto/tracing/core/producer.h
index 7990064..9b00ce3 100644
--- a/include/perfetto/tracing/core/producer.h
+++ b/include/perfetto/tracing/core/producer.h
@@ -32,7 +32,7 @@
 //    (e.g., the ability to get kernel ftraces, to list process stats).
 // 2. The service acknowledges the connection and sends over the SharedMemory
 //    region that will be used to exchange data (together with the signalling
-//    API Service::ProducerEndpoint::OnPageAcquired()/OnPageReleased()).
+//    API TracingService::ProducerEndpoint::OnPageAcquired()/OnPageReleased()).
 // 3. At some point later on, the Service asks the Producer to on turn some of
 //    the previously registered data sources, together with some configuration
 //    parameters. This happens via the CreateDataSourceInstance() callback.
@@ -64,7 +64,7 @@
   // in the next CLs.
 
   // Called by the Service to turn on one of the data source previously
-  // registered through Service::ProducerEndpoint::RegisterDataSource().
+  // registered through TracingService::ProducerEndpoint::RegisterDataSource().
   // Args:
   // - DataSourceInstanceID is an identifier chosen by the Service that should
   //   be assigned to the newly created data source instance. It is used to
diff --git a/include/perfetto/tracing/core/shared_memory_abi.h b/include/perfetto/tracing/core/shared_memory_abi.h
index 319f07a..cc556e7 100644
--- a/include/perfetto/tracing/core/shared_memory_abi.h
+++ b/include/perfetto/tracing/core/shared_memory_abi.h
@@ -51,7 +51,7 @@
 // The SMB is *not* the ultimate logging buffer seen by the Consumer. That one
 // is larger (~MBs) and not shared with Producers.
 // Each SMB is small, typically few KB. Its size is configurable by the producer
-// within a max limit of ~MB (see kMaxShmSize in service_impl.cc).
+// within a max limit of ~MB (see kMaxShmSize in tracing_service_impl.cc).
 // The SMB is partitioned into fixed-size Page(s). The size of the Pages are
 // determined by each Producer at connection time and cannot be changed.
 // Hence, different producers can have SMB(s) that have a different Page size
diff --git a/include/perfetto/tracing/core/shared_memory_arbiter.h b/include/perfetto/tracing/core/shared_memory_arbiter.h
index 7bcb5f1..839e9db 100644
--- a/include/perfetto/tracing/core/shared_memory_arbiter.h
+++ b/include/perfetto/tracing/core/shared_memory_arbiter.h
@@ -25,7 +25,7 @@
 
 #include "perfetto/base/export.h"
 #include "perfetto/tracing/core/basic_types.h"
-#include "perfetto/tracing/core/service.h"
+#include "perfetto/tracing/core/tracing_service.h"
 
 namespace perfetto {
 
@@ -58,7 +58,7 @@
   static std::unique_ptr<SharedMemoryArbiter> CreateInstance(
       SharedMemory*,
       size_t page_size,
-      Service::ProducerEndpoint*,
+      TracingService::ProducerEndpoint*,
       base::TaskRunner*);
 };
 
diff --git a/include/perfetto/tracing/core/service.h b/include/perfetto/tracing/core/tracing_service.h
similarity index 91%
rename from include/perfetto/tracing/core/service.h
rename to include/perfetto/tracing/core/tracing_service.h
index e91cba0..d028d40 100644
--- a/include/perfetto/tracing/core/service.h
+++ b/include/perfetto/tracing/core/tracing_service.h
@@ -14,8 +14,8 @@
  * limitations under the License.
  */
 
-#ifndef INCLUDE_PERFETTO_TRACING_CORE_SERVICE_H_
-#define INCLUDE_PERFETTO_TRACING_CORE_SERVICE_H_
+#ifndef INCLUDE_PERFETTO_TRACING_CORE_TRACING_SERVICE_H_
+#define INCLUDE_PERFETTO_TRACING_CORE_TRACING_SERVICE_H_
 
 #include <stdint.h>
 
@@ -53,12 +53,13 @@
 // 2. Tests.
 //
 // Subclassed by:
-//   The service business logic in src/core/service_impl.cc.
-class PERFETTO_EXPORT Service {
+//   The service business logic in src/core/tracing_service_impl.cc.
+class PERFETTO_EXPORT TracingService {
  public:
   // The API for the Producer port of the Service.
   // Subclassed by:
-  // 1. The service_impl.cc business logic when returning it in response to
+  // 1. The tracing_service_impl.cc business logic when returning it in response
+  // to
   //    the ConnectProducer() method.
   // 2. The transport layer (e.g., src/ipc) when the producer and
   //    the service don't talk locally but via some IPC mechanism.
@@ -103,7 +104,8 @@
 
   // The API for the Consumer port of the Service.
   // Subclassed by:
-  // 1. The service_impl.cc business logic when returning it in response to
+  // 1. The tracing_service_impl.cc business logic when returning it in response
+  // to
   //    the ConnectConsumer() method.
   // 2. The transport layer (e.g., src/ipc) when the consumer and
   //    the service don't talk locally but via some IPC mechanism.
@@ -130,12 +132,12 @@
     virtual void FreeBuffers() = 0;
   };  // class ConsumerEndpoint.
 
-  // Implemented in src/core/service_impl.cc .
-  static std::unique_ptr<Service> CreateInstance(
+  // Implemented in src/core/tracing_service_impl.cc .
+  static std::unique_ptr<TracingService> CreateInstance(
       std::unique_ptr<SharedMemory::Factory>,
       base::TaskRunner*);
 
-  virtual ~Service();
+  virtual ~TracingService();
 
   // Connects a Producer instance and obtains a ProducerEndpoint, which is
   // essentially a 1:1 channel between one Producer and the Service.
@@ -167,4 +169,4 @@
 
 }  // namespace perfetto
 
-#endif  // INCLUDE_PERFETTO_TRACING_CORE_SERVICE_H_
+#endif  // INCLUDE_PERFETTO_TRACING_CORE_TRACING_SERVICE_H_
diff --git a/include/perfetto/tracing/ipc/consumer_ipc_client.h b/include/perfetto/tracing/ipc/consumer_ipc_client.h
index 2cbb968..85ca354 100644
--- a/include/perfetto/tracing/ipc/consumer_ipc_client.h
+++ b/include/perfetto/tracing/ipc/consumer_ipc_client.h
@@ -20,7 +20,7 @@
 #include <memory>
 #include <string>
 
-#include "perfetto/tracing/core/service.h"
+#include "perfetto/tracing/core/tracing_service.h"
 
 namespace perfetto {
 
@@ -41,7 +41,7 @@
   // callbacks invoked on the Consumer interface: no more Consumer callbacks are
   // invoked immediately after its destruction and any pending callback will be
   // dropped.
-  static std::unique_ptr<Service::ConsumerEndpoint>
+  static std::unique_ptr<TracingService::ConsumerEndpoint>
   Connect(const char* service_sock_name, Consumer*, base::TaskRunner*);
 
  protected:
diff --git a/include/perfetto/tracing/ipc/producer_ipc_client.h b/include/perfetto/tracing/ipc/producer_ipc_client.h
index fb66c71..d77143d 100644
--- a/include/perfetto/tracing/ipc/producer_ipc_client.h
+++ b/include/perfetto/tracing/ipc/producer_ipc_client.h
@@ -20,7 +20,7 @@
 #include <memory>
 #include <string>
 
-#include "perfetto/tracing/core/service.h"
+#include "perfetto/tracing/core/tracing_service.h"
 
 namespace perfetto {
 
@@ -41,7 +41,7 @@
   // callbacks invoked on the Producer interface: no more Producer callbacks are
   // invoked immediately after its destruction and any pending callback will be
   // dropped.
-  static std::unique_ptr<Service::ProducerEndpoint> Connect(
+  static std::unique_ptr<TracingService::ProducerEndpoint> Connect(
       const char* service_sock_name,
       Producer*,
       const std::string& producer_name,
diff --git a/include/perfetto/tracing/ipc/service_ipc_host.h b/include/perfetto/tracing/ipc/service_ipc_host.h
index 8cd8ead..ccdc89b 100644
--- a/include/perfetto/tracing/ipc/service_ipc_host.h
+++ b/include/perfetto/tracing/ipc/service_ipc_host.h
@@ -27,7 +27,7 @@
 class TaskRunner;
 }  // namespace base.
 
-class Service;
+class TracingService;
 
 // Creates an instance of the service (business logic + UNIX socket transport).
 // Exposed to:
diff --git a/src/perfetto_cmd/perfetto_cmd.h b/src/perfetto_cmd/perfetto_cmd.h
index f179d8f..acd0309 100644
--- a/src/perfetto_cmd/perfetto_cmd.h
+++ b/src/perfetto_cmd/perfetto_cmd.h
@@ -69,7 +69,8 @@
   void OnTimeout();
 
   PlatformTaskRunner task_runner_;
-  std::unique_ptr<perfetto::Service::ConsumerEndpoint> consumer_endpoint_;
+  std::unique_ptr<perfetto::TracingService::ConsumerEndpoint>
+      consumer_endpoint_;
   std::unique_ptr<TraceConfig> trace_config_;
   base::ScopedFstream trace_out_stream_;
   std::string trace_out_path_;
diff --git a/src/traced/probes/probes_producer.h b/src/traced/probes/probes_producer.h
index 1d23f77..210aece 100644
--- a/src/traced/probes/probes_producer.h
+++ b/src/traced/probes/probes_producer.h
@@ -24,8 +24,8 @@
 #include "perfetto/base/task_runner.h"
 #include "perfetto/base/watchdog.h"
 #include "perfetto/tracing/core/producer.h"
-#include "perfetto/tracing/core/service.h"
 #include "perfetto/tracing/core/trace_writer.h"
+#include "perfetto/tracing/core/tracing_service.h"
 #include "src/traced/probes/filesystem/inode_file_data_source.h"
 #include "src/traced/probes/ftrace/ftrace_controller.h"
 #include "src/traced/probes/process_stats_data_source.h"
@@ -146,7 +146,7 @@
 
   State state_ = kNotStarted;
   base::TaskRunner* task_runner_ = nullptr;
-  std::unique_ptr<Service::ProducerEndpoint> endpoint_ = nullptr;
+  std::unique_ptr<TracingService::ProducerEndpoint> endpoint_ = nullptr;
   std::unique_ptr<FtraceController> ftrace_ = nullptr;
   bool ftrace_creation_failed_ = false;
   uint32_t connection_backoff_ms_ = 0;
diff --git a/src/tracing/BUILD.gn b/src/tracing/BUILD.gn
index 598de07..2e8831f 100644
--- a/src/tracing/BUILD.gn
+++ b/src/tracing/BUILD.gn
@@ -46,8 +46,6 @@
     "core/packet_stream_validator.h",
     "core/patch_list.h",
     "core/process_stats_config.cc",
-    "core/service_impl.cc",
-    "core/service_impl.h",
     "core/shared_memory_abi.cc",
     "core/shared_memory_arbiter_impl.cc",
     "core/shared_memory_arbiter_impl.h",
@@ -60,6 +58,8 @@
     "core/trace_packet.cc",
     "core/trace_writer_impl.cc",
     "core/trace_writer_impl.h",
+    "core/tracing_service_impl.cc",
+    "core/tracing_service_impl.h",
     "core/virtual_destructors.cc",
   ]
 }
diff --git a/src/tracing/README.md b/src/tracing/README.md
index e0d67ee..33134c0 100644
--- a/src/tracing/README.md
+++ b/src/tracing/README.md
@@ -8,7 +8,8 @@
 tracing instances coming from different libraries within the same process
 (concrete example v8, skia and webrtc in Chrome).
 In this configuration, the client is expected to at least:
-- Create an Service instance via Service::CreateInstance (see `core/service.h`)
+- Create a TracingService instance via TracingService::CreateInstance
+  (see `core/tracing_service.h`)
 - Subclass Producer (`core/producer.h`) and connect it to the service.
 - Provide a TaskRunner implementation (see `test/test_task_runner.h`)
 - Provide a trivial SharedMemory implementation (`core/shared_memory.h`) which
diff --git a/src/tracing/core/service_impl_unittest.cc b/src/tracing/core/service_impl_unittest.cc
index 59e42ac..34628e4 100644
--- a/src/tracing/core/service_impl_unittest.cc
+++ b/src/tracing/core/service_impl_unittest.cc
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#include "src/tracing/core/service_impl.h"
+#include "src/tracing/core/tracing_service_impl.h"
 
 #include <string.h>
 
@@ -54,17 +54,17 @@
 namespace perfetto {
 
 namespace {
-constexpr size_t kDefaultShmSizeKb = ServiceImpl::kDefaultShmSize / 1024;
-constexpr size_t kMaxShmSizeKb = ServiceImpl::kMaxShmSize / 1024;
+constexpr size_t kDefaultShmSizeKb = TracingServiceImpl::kDefaultShmSize / 1024;
+constexpr size_t kMaxShmSizeKb = TracingServiceImpl::kMaxShmSize / 1024;
 }  // namespace
 
-class ServiceImplTest : public testing::Test {
+class TracingServiceImplTest : public testing::Test {
  public:
-  ServiceImplTest() {
+  TracingServiceImplTest() {
     auto shm_factory =
         std::unique_ptr<SharedMemory::Factory>(new TestSharedMemory::Factory());
-    svc.reset(static_cast<ServiceImpl*>(
-        Service::CreateInstance(std::move(shm_factory), &task_runner)
+    svc.reset(static_cast<TracingServiceImpl*>(
+        TracingService::CreateInstance(std::move(shm_factory), &task_runner)
             .release()));
   }
 
@@ -85,17 +85,17 @@
   }
 
   size_t GetNumPendingFlushes() {
-    ServiceImpl::TracingSession* tracing_session =
+    TracingServiceImpl::TracingSession* tracing_session =
         svc->GetTracingSession(svc->last_tracing_session_id_);
     EXPECT_NE(nullptr, tracing_session);
     return tracing_session->pending_flushes.size();
   }
 
   base::TestTaskRunner task_runner;
-  std::unique_ptr<ServiceImpl> svc;
+  std::unique_ptr<TracingServiceImpl> svc;
 };
 
-TEST_F(ServiceImplTest, RegisterAndUnregister) {
+TEST_F(TracingServiceImplTest, RegisterAndUnregister) {
   std::unique_ptr<MockProducer> mock_producer_1 = CreateMockProducer();
   std::unique_ptr<MockProducer> mock_producer_2 = CreateMockProducer();
 
@@ -124,7 +124,7 @@
   ASSERT_EQ(0u, svc->num_producers());
 }
 
-TEST_F(ServiceImplTest, EnableAndDisableTracing) {
+TEST_F(TracingServiceImplTest, EnableAndDisableTracing) {
   std::unique_ptr<MockConsumer> consumer = CreateMockConsumer();
   consumer->Connect(svc.get());
 
@@ -146,7 +146,7 @@
   consumer->WaitForTracingDisabled();
 }
 
-TEST_F(ServiceImplTest, LockdownMode) {
+TEST_F(TracingServiceImplTest, LockdownMode) {
   std::unique_ptr<MockConsumer> consumer = CreateMockConsumer();
   consumer->Connect(svc.get());
 
@@ -190,7 +190,7 @@
   consumer->WaitForTracingDisabled();
 }
 
-TEST_F(ServiceImplTest, DisconnectConsumerWhileTracing) {
+TEST_F(TracingServiceImplTest, DisconnectConsumerWhileTracing) {
   std::unique_ptr<MockConsumer> consumer = CreateMockConsumer();
   consumer->Connect(svc.get());
 
@@ -213,7 +213,7 @@
   producer->WaitForDataSourceStop("data_source");
 }
 
-TEST_F(ServiceImplTest, ReconnectProducerWhileTracing) {
+TEST_F(TracingServiceImplTest, ReconnectProducerWhileTracing) {
   std::unique_ptr<MockConsumer> consumer = CreateMockConsumer();
   consumer->Connect(svc.get());
 
@@ -240,7 +240,7 @@
   producer->WaitForDataSourceStart("data_source");
 }
 
-TEST_F(ServiceImplTest, ProducerIDWrapping) {
+TEST_F(TracingServiceImplTest, ProducerIDWrapping) {
   std::vector<std::unique_ptr<MockProducer>> producers;
   producers.push_back(nullptr);
 
@@ -267,7 +267,7 @@
   ASSERT_EQ(6u, connect_producer_and_get_id("6"));
 }
 
-TEST_F(ServiceImplTest, WriteIntoFileAndStopOnMaxSize) {
+TEST_F(TracingServiceImplTest, WriteIntoFileAndStopOnMaxSize) {
   std::unique_ptr<MockConsumer> consumer = CreateMockConsumer();
   consumer->Connect(svc.get());
 
@@ -336,7 +336,7 @@
 // Test the logic that allows the trace config to set the shm total size and
 // page size from the trace config. Also check that, if the config doesn't
 // specify a value we fall back on the hint provided by the producer.
-TEST_F(ServiceImplTest, ProducerShmAndPageSizeOverriddenByTraceConfig) {
+TEST_F(TracingServiceImplTest, ProducerShmAndPageSizeOverriddenByTraceConfig) {
   std::unique_ptr<MockConsumer> consumer = CreateMockConsumer();
   consumer->Connect(svc.get());
   const size_t kConfigPageSizesKb[] = /****/ {16, 16, 4, 0, 16, 8, 3, 4096, 4};
@@ -392,7 +392,7 @@
   ASSERT_THAT(actual_shm_sizes_kb, ElementsAreArray(kExpectedSizesKb));
 }
 
-TEST_F(ServiceImplTest, ExplicitFlush) {
+TEST_F(TracingServiceImplTest, ExplicitFlush) {
   std::unique_ptr<MockConsumer> consumer = CreateMockConsumer();
   consumer->Connect(svc.get());
 
@@ -429,7 +429,7 @@
                         Property(&protos::TestEvent::str, Eq("payload")))));
 }
 
-TEST_F(ServiceImplTest, ImplicitFlushOnTimedTraces) {
+TEST_F(TracingServiceImplTest, ImplicitFlushOnTimedTraces) {
   std::unique_ptr<MockConsumer> consumer = CreateMockConsumer();
   consumer->Connect(svc.get());
 
@@ -468,7 +468,7 @@
 // Tests the monotonic semantic of flush request IDs, i.e., once a producer
 // acks flush request N, all flush requests <= N are considered successful and
 // acked to the consumer.
-TEST_F(ServiceImplTest, BatchFlushes) {
+TEST_F(TracingServiceImplTest, BatchFlushes) {
   std::unique_ptr<MockConsumer> consumer = CreateMockConsumer();
   consumer->Connect(svc.get());
 
diff --git a/src/tracing/core/shared_memory_arbiter_impl.cc b/src/tracing/core/shared_memory_arbiter_impl.cc
index 1618b41..5422e50 100644
--- a/src/tracing/core/shared_memory_arbiter_impl.cc
+++ b/src/tracing/core/shared_memory_arbiter_impl.cc
@@ -39,7 +39,7 @@
 std::unique_ptr<SharedMemoryArbiter> SharedMemoryArbiter::CreateInstance(
     SharedMemory* shared_memory,
     size_t page_size,
-    Service::ProducerEndpoint* producer_endpoint,
+    TracingService::ProducerEndpoint* producer_endpoint,
     base::TaskRunner* task_runner) {
   return std::unique_ptr<SharedMemoryArbiterImpl>(
       new SharedMemoryArbiterImpl(shared_memory->start(), shared_memory->size(),
@@ -50,7 +50,7 @@
     void* start,
     size_t size,
     size_t page_size,
-    Service::ProducerEndpoint* producer_endpoint,
+    TracingService::ProducerEndpoint* producer_endpoint,
     base::TaskRunner* task_runner)
     : task_runner_(task_runner),
       producer_endpoint_(producer_endpoint),
diff --git a/src/tracing/core/shared_memory_arbiter_impl.h b/src/tracing/core/shared_memory_arbiter_impl.h
index beefef6..0ba1c14 100644
--- a/src/tracing/core/shared_memory_arbiter_impl.h
+++ b/src/tracing/core/shared_memory_arbiter_impl.h
@@ -59,7 +59,7 @@
   SharedMemoryArbiterImpl(void* start,
                           size_t size,
                           size_t page_size,
-                          Service::ProducerEndpoint*,
+                          TracingService::ProducerEndpoint*,
                           base::TaskRunner*);
 
   // Returns a new Chunk to write tracing data. The call always returns a valid
@@ -110,7 +110,7 @@
   void ReleaseWriterID(WriterID);
 
   base::TaskRunner* const task_runner_;
-  Service::ProducerEndpoint* const producer_endpoint_;
+  TracingService::ProducerEndpoint* const producer_endpoint_;
   PERFETTO_THREAD_CHECKER(thread_checker_)
 
   // --- Begin lock-protected members ---
diff --git a/src/tracing/core/shared_memory_arbiter_impl_unittest.cc b/src/tracing/core/shared_memory_arbiter_impl_unittest.cc
index a7414ec..e29f9fc 100644
--- a/src/tracing/core/shared_memory_arbiter_impl_unittest.cc
+++ b/src/tracing/core/shared_memory_arbiter_impl_unittest.cc
@@ -33,7 +33,7 @@
 using testing::Invoke;
 using testing::_;
 
-class MockProducerEndpoint : public Service::ProducerEndpoint {
+class MockProducerEndpoint : public TracingService::ProducerEndpoint {
  public:
   void RegisterDataSource(const DataSourceDescriptor&) override {}
   void UnregisterDataSource(const std::string&) override {}
diff --git a/src/tracing/core/trace_writer_impl_unittest.cc b/src/tracing/core/trace_writer_impl_unittest.cc
index 7a1a8eb..55e94b4 100644
--- a/src/tracing/core/trace_writer_impl_unittest.cc
+++ b/src/tracing/core/trace_writer_impl_unittest.cc
@@ -19,8 +19,8 @@
 #include "gtest/gtest.h"
 #include "perfetto/base/utils.h"
 #include "perfetto/tracing/core/commit_data_request.h"
-#include "perfetto/tracing/core/service.h"
 #include "perfetto/tracing/core/trace_writer.h"
+#include "perfetto/tracing/core/tracing_service.h"
 #include "src/base/test/test_task_runner.h"
 #include "src/tracing/core/shared_memory_arbiter_impl.h"
 #include "src/tracing/test/aligned_buffer_test.h"
@@ -31,7 +31,7 @@
 namespace perfetto {
 namespace {
 
-class FakeProducerEndpoint : public Service::ProducerEndpoint {
+class FakeProducerEndpoint : public TracingService::ProducerEndpoint {
   void RegisterDataSource(const DataSourceDescriptor&) override {}
   void UnregisterDataSource(const std::string&) override {}
   void CommitData(const CommitDataRequest&, CommitDataCallback) override {}
diff --git a/src/tracing/core/service_impl.cc b/src/tracing/core/tracing_service_impl.cc
similarity index 89%
rename from src/tracing/core/service_impl.cc
rename to src/tracing/core/tracing_service_impl.cc
index b67eb56..32f7fc8 100644
--- a/src/tracing/core/service_impl.cc
+++ b/src/tracing/core/tracing_service_impl.cc
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#include "src/tracing/core/service_impl.h"
+#include "src/tracing/core/tracing_service_impl.h"
 
 #include "perfetto/base/build_config.h"
 
@@ -72,14 +72,14 @@
 
 #if PERFETTO_BUILDFLAG(PERFETTO_OS_WIN)
 struct iovec {
-  void  *iov_base; // Address
+  void* iov_base;  // Address
   size_t iov_len;  // Block size
 };
 
 // Simple implementation of writev. Note that this does not give the atomicity
 // guarantees of a real writev, but we don't depend on these (we aren't writing
 // to the same file from another thread).
-ssize_t writev(int fd, const struct iovec *iov, int iovcnt) {
+ssize_t writev(int fd, const struct iovec* iov, int iovcnt) {
   ssize_t total_size = 0;
   for (int i = 0; i < iovcnt; ++i) {
     ssize_t current_size = write(fd, iov[i].iov_base, iov[i].iov_len);
@@ -93,25 +93,30 @@
 #define IOV_MAX 1024  // Linux compatible limit.
 
 // uid checking is a NOP on Windows.
-uid_t getuid() { return 0; }
-uid_t geteuid() { return 0; }
+uid_t getuid() {
+  return 0;
+}
+uid_t geteuid() {
+  return 0;
+}
 #endif  // PERFETTO_BUILDFLAG(PERFETTO_OS_WIN)
 }  // namespace
 
 // These constants instead are defined in the header because are used by tests.
-constexpr size_t ServiceImpl::kDefaultShmSize;
-constexpr size_t ServiceImpl::kMaxShmSize;
+constexpr size_t TracingServiceImpl::kDefaultShmSize;
+constexpr size_t TracingServiceImpl::kMaxShmSize;
 
 // static
-std::unique_ptr<Service> Service::CreateInstance(
+std::unique_ptr<TracingService> TracingService::CreateInstance(
     std::unique_ptr<SharedMemory::Factory> shm_factory,
     base::TaskRunner* task_runner) {
-  return std::unique_ptr<Service>(
-      new ServiceImpl(std::move(shm_factory), task_runner));
+  return std::unique_ptr<TracingService>(
+      new TracingServiceImpl(std::move(shm_factory), task_runner));
 }
 
-ServiceImpl::ServiceImpl(std::unique_ptr<SharedMemory::Factory> shm_factory,
-                         base::TaskRunner* task_runner)
+TracingServiceImpl::TracingServiceImpl(
+    std::unique_ptr<SharedMemory::Factory> shm_factory,
+    base::TaskRunner* task_runner)
     : task_runner_(task_runner),
       shm_factory_(std::move(shm_factory)),
       uid_(getuid()),
@@ -120,15 +125,15 @@
   PERFETTO_DCHECK(task_runner_);
 }
 
-ServiceImpl::~ServiceImpl() {
+TracingServiceImpl::~TracingServiceImpl() {
   // TODO(fmayer): handle teardown of all Producer.
 }
 
-std::unique_ptr<Service::ProducerEndpoint> ServiceImpl::ConnectProducer(
-    Producer* producer,
-    uid_t uid,
-    const std::string& producer_name,
-    size_t shared_memory_size_hint_bytes) {
+std::unique_ptr<TracingService::ProducerEndpoint>
+TracingServiceImpl::ConnectProducer(Producer* producer,
+                                    uid_t uid,
+                                    const std::string& producer_name,
+                                    size_t shared_memory_size_hint_bytes) {
   PERFETTO_DCHECK_THREAD(thread_checker_);
 
   if (lockdown_mode_ && uid != geteuid()) {
@@ -154,7 +159,7 @@
   return std::move(endpoint);
 }
 
-void ServiceImpl::DisconnectProducer(ProducerID id) {
+void TracingServiceImpl::DisconnectProducer(ProducerID id) {
   PERFETTO_DCHECK_THREAD(thread_checker_);
   PERFETTO_DLOG("Producer %" PRIu16 " disconnected", id);
   PERFETTO_DCHECK(producers_.count(id));
@@ -171,7 +176,7 @@
   UpdateMemoryGuardrail();
 }
 
-ServiceImpl::ProducerEndpointImpl* ServiceImpl::GetProducer(
+TracingServiceImpl::ProducerEndpointImpl* TracingServiceImpl::GetProducer(
     ProducerID id) const {
   PERFETTO_DCHECK_THREAD(thread_checker_);
   auto it = producers_.find(id);
@@ -180,8 +185,8 @@
   return it->second;
 }
 
-std::unique_ptr<Service::ConsumerEndpoint> ServiceImpl::ConnectConsumer(
-    Consumer* consumer) {
+std::unique_ptr<TracingService::ConsumerEndpoint>
+TracingServiceImpl::ConnectConsumer(Consumer* consumer) {
   PERFETTO_DCHECK_THREAD(thread_checker_);
   PERFETTO_DLOG("Consumer %p connected", reinterpret_cast<void*>(consumer));
   std::unique_ptr<ConsumerEndpointImpl> endpoint(
@@ -192,7 +197,7 @@
   return std::move(endpoint);
 }
 
-void ServiceImpl::DisconnectConsumer(ConsumerEndpointImpl* consumer) {
+void TracingServiceImpl::DisconnectConsumer(ConsumerEndpointImpl* consumer) {
   PERFETTO_DCHECK_THREAD(thread_checker_);
   PERFETTO_DLOG("Consumer %p disconnected", reinterpret_cast<void*>(consumer));
   PERFETTO_DCHECK(consumers_.count(consumer));
@@ -213,9 +218,9 @@
 #endif
 }
 
-bool ServiceImpl::EnableTracing(ConsumerEndpointImpl* consumer,
-                                const TraceConfig& cfg,
-                                base::ScopedFile fd) {
+bool TracingServiceImpl::EnableTracing(ConsumerEndpointImpl* consumer,
+                                       const TraceConfig& cfg,
+                                       base::ScopedFile fd) {
   PERFETTO_DCHECK_THREAD(thread_checker_);
   PERFETTO_DLOG("Enabling tracing for consumer %p",
                 reinterpret_cast<void*>(consumer));
@@ -389,7 +394,7 @@
 // This is to allow the consumer to freeze the buffers (by stopping the trace)
 // and then drain the buffers. The actual teardown of the TracingSession happens
 // in FreeBuffers().
-void ServiceImpl::DisableTracing(TracingSessionID tsid) {
+void TracingServiceImpl::DisableTracing(TracingSessionID tsid) {
   PERFETTO_DCHECK_THREAD(thread_checker_);
   TracingSession* tracing_session = GetTracingSession(tsid);
   if (!tracing_session) {
@@ -423,9 +428,9 @@
   // needed to call ReadBuffers(). FreeBuffers() will erase() the session.
 }
 
-void ServiceImpl::Flush(TracingSessionID tsid,
-                        uint32_t timeout_ms,
-                        ConsumerEndpoint::FlushCallback callback) {
+void TracingServiceImpl::Flush(TracingSessionID tsid,
+                               uint32_t timeout_ms,
+                               ConsumerEndpoint::FlushCallback callback) {
   PERFETTO_DCHECK_THREAD(thread_checker_);
   TracingSession* tracing_session = GetTracingSession(tsid);
   if (!tracing_session) {
@@ -474,8 +479,9 @@
       timeout_ms);
 }
 
-void ServiceImpl::NotifyFlushDoneForProducer(ProducerID producer_id,
-                                             FlushRequestID flush_request_id) {
+void TracingServiceImpl::NotifyFlushDoneForProducer(
+    ProducerID producer_id,
+    FlushRequestID flush_request_id) {
   for (auto& kv : tracing_sessions_) {
     // Remove all pending flushes <= |flush_request_id| for |producer_id|.
     auto& pending_flushes = kv.second.pending_flushes;
@@ -494,8 +500,8 @@
   }    // for (tracing_session)
 }
 
-void ServiceImpl::OnFlushTimeout(TracingSessionID tsid,
-                                 FlushRequestID flush_request_id) {
+void TracingServiceImpl::OnFlushTimeout(TracingSessionID tsid,
+                                        FlushRequestID flush_request_id) {
   TracingSession* tracing_session = GetTracingSession(tsid);
   if (!tracing_session)
     return;
@@ -507,7 +513,7 @@
   callback(/*success=*/false);
 }
 
-void ServiceImpl::FlushAndDisableTracing(TracingSessionID tsid) {
+void TracingServiceImpl::FlushAndDisableTracing(TracingSessionID tsid) {
   PERFETTO_DCHECK_THREAD(thread_checker_);
   auto weak_this = weak_ptr_factory_.GetWeakPtr();
   Flush(tsid, kFlushTimeoutMs, [weak_this, tsid](bool success) {
@@ -521,8 +527,8 @@
 // Note: when this is called to write into a file passed when starting tracing
 // |consumer| will be == nullptr (as opposite to the case of a consumer asking
 // to send the trace data back over IPC).
-void ServiceImpl::ReadBuffers(TracingSessionID tsid,
-                              ConsumerEndpointImpl* consumer) {
+void TracingServiceImpl::ReadBuffers(TracingSessionID tsid,
+                                     ConsumerEndpointImpl* consumer) {
   PERFETTO_DCHECK_THREAD(thread_checker_);
   TracingSession* tracing_session = GetTracingSession(tsid);
   if (!tracing_session) {
@@ -723,7 +729,7 @@
   consumer->consumer_->OnTraceData(std::move(packets), has_more);
 }
 
-void ServiceImpl::FreeBuffers(TracingSessionID tsid) {
+void TracingServiceImpl::FreeBuffers(TracingSessionID tsid) {
   PERFETTO_DCHECK_THREAD(thread_checker_);
   PERFETTO_DLOG("Freeing buffers for session %" PRIu64, tsid);
   TracingSession* tracing_session = GetTracingSession(tsid);
@@ -745,8 +751,8 @@
                tracing_sessions_.size());
 }
 
-void ServiceImpl::RegisterDataSource(ProducerID producer_id,
-                                     const DataSourceDescriptor& desc) {
+void TracingServiceImpl::RegisterDataSource(ProducerID producer_id,
+                                            const DataSourceDescriptor& desc) {
   PERFETTO_DCHECK_THREAD(thread_checker_);
   PERFETTO_DLOG("Producer %" PRIu16 " registered data source \"%s\"",
                 producer_id, desc.name().c_str());
@@ -784,8 +790,8 @@
   }
 }
 
-void ServiceImpl::UnregisterDataSource(ProducerID producer_id,
-                                       const std::string& name) {
+void TracingServiceImpl::UnregisterDataSource(ProducerID producer_id,
+                                              const std::string& name) {
   PERFETTO_DCHECK_THREAD(thread_checker_);
   PERFETTO_CHECK(producer_id);
   ProducerEndpointImpl* producer = GetProducer(producer_id);
@@ -818,7 +824,7 @@
   PERFETTO_DCHECK(false);
 }
 
-void ServiceImpl::CreateDataSourceInstance(
+void TracingServiceImpl::CreateDataSourceInstance(
     const TraceConfig::DataSource& cfg_data_source,
     const TraceConfig::ProducerConfig& producer_config,
     const RegisteredDataSource& data_source,
@@ -907,15 +913,16 @@
 // Note: all the fields % *_trusted ones are untrusted, as in, the Producer
 // might be lying / returning garbage contents. |src| and |size| can be trusted
 // in terms of being a valid pointer, but not the contents.
-void ServiceImpl::CopyProducerPageIntoLogBuffer(ProducerID producer_id_trusted,
-                                                uid_t producer_uid_trusted,
-                                                WriterID writer_id,
-                                                ChunkID chunk_id,
-                                                BufferID buffer_id,
-                                                uint16_t num_fragments,
-                                                uint8_t chunk_flags,
-                                                const uint8_t* src,
-                                                size_t size) {
+void TracingServiceImpl::CopyProducerPageIntoLogBuffer(
+    ProducerID producer_id_trusted,
+    uid_t producer_uid_trusted,
+    WriterID writer_id,
+    ChunkID chunk_id,
+    BufferID buffer_id,
+    uint16_t num_fragments,
+    uint8_t chunk_flags,
+    const uint8_t* src,
+    size_t size) {
   PERFETTO_DCHECK_THREAD(thread_checker_);
   TraceBuffer* buf = GetBufferByID(buffer_id);
   if (!buf) {
@@ -935,7 +942,7 @@
                           chunk_id, num_fragments, chunk_flags, src, size);
 }
 
-void ServiceImpl::ApplyChunkPatches(
+void TracingServiceImpl::ApplyChunkPatches(
     ProducerID producer_id_trusted,
     const std::vector<CommitDataRequest::ChunkToPatch>& chunks_to_patch) {
   PERFETTO_DCHECK_THREAD(thread_checker_);
@@ -982,7 +989,7 @@
   }
 }
 
-ServiceImpl::TracingSession* ServiceImpl::GetTracingSession(
+TracingServiceImpl::TracingSession* TracingServiceImpl::GetTracingSession(
     TracingSessionID tsid) {
   PERFETTO_DCHECK_THREAD(thread_checker_);
   auto it = tsid ? tracing_sessions_.find(tsid) : tracing_sessions_.end();
@@ -991,7 +998,7 @@
   return &it->second;
 }
 
-ProducerID ServiceImpl::GetNextProducerID() {
+ProducerID TracingServiceImpl::GetNextProducerID() {
   PERFETTO_DCHECK_THREAD(thread_checker_);
   PERFETTO_CHECK(producers_.size() < kMaxProducerID);
   do {
@@ -1001,14 +1008,14 @@
   return last_producer_id_;
 }
 
-TraceBuffer* ServiceImpl::GetBufferByID(BufferID buffer_id) {
+TraceBuffer* TracingServiceImpl::GetBufferByID(BufferID buffer_id) {
   auto buf_iter = buffers_.find(buffer_id);
   if (buf_iter == buffers_.end())
     return nullptr;
   return &*buf_iter->second;
 }
 
-void ServiceImpl::UpdateMemoryGuardrail() {
+void TracingServiceImpl::UpdateMemoryGuardrail() {
 #if !PERFETTO_BUILDFLAG(PERFETTO_CHROMIUM_BUILD) && \
     !PERFETTO_BUILDFLAG(PERFETTO_OS_MACOSX)
   uint64_t total_buffer_bytes = 0;
@@ -1031,8 +1038,9 @@
 #endif
 }
 
-void ServiceImpl::MaybeSnapshotClocks(TracingSession* tracing_session,
-                                      std::vector<TracePacket>* packets) {
+void TracingServiceImpl::MaybeSnapshotClocks(
+    TracingSession* tracing_session,
+    std::vector<TracePacket>* packets) {
   base::TimeMillis now = base::GetWallTimeMs();
   if (now < tracing_session->last_clock_snapshot + kClockSnapshotInterval)
     return;
@@ -1041,7 +1049,8 @@
   protos::TrustedPacket packet;
   protos::ClockSnapshot* clock_snapshot = packet.mutable_clock_snapshot();
 
-#if !PERFETTO_BUILDFLAG(PERFETTO_OS_MACOSX) && !PERFETTO_BUILDFLAG(PERFETTO_OS_WIN)
+#if !PERFETTO_BUILDFLAG(PERFETTO_OS_MACOSX) && \
+    !PERFETTO_BUILDFLAG(PERFETTO_OS_WIN)
   struct {
     clockid_t id;
     protos::ClockSnapshot::Clock::Type type;
@@ -1090,8 +1099,8 @@
   packets->back().AddSlice(std::move(slice));
 }
 
-void ServiceImpl::MaybeSnapshotStats(TracingSession* tracing_session,
-                                     std::vector<TracePacket>* packets) {
+void TracingServiceImpl::MaybeSnapshotStats(TracingSession* tracing_session,
+                                            std::vector<TracePacket>* packets) {
   base::TimeMillis now = base::GetWallTimeMs();
   if (now < tracing_session->last_stats_snapshot + kStatsSnapshotInterval)
     return;
@@ -1135,8 +1144,9 @@
   packets->back().AddSlice(std::move(slice));
 }
 
-void ServiceImpl::MaybeEmitTraceConfig(TracingSession* tracing_session,
-                                       std::vector<TracePacket>* packets) {
+void TracingServiceImpl::MaybeEmitTraceConfig(
+    TracingSession* tracing_session,
+    std::vector<TracePacket>* packets) {
   if (tracing_session->did_emit_config)
     return;
   tracing_session->did_emit_config = true;
@@ -1150,11 +1160,11 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-// ServiceImpl::ConsumerEndpointImpl implementation
+// TracingServiceImpl::ConsumerEndpointImpl implementation
 ////////////////////////////////////////////////////////////////////////////////
 
-ServiceImpl::ConsumerEndpointImpl::ConsumerEndpointImpl(
-    ServiceImpl* service,
+TracingServiceImpl::ConsumerEndpointImpl::ConsumerEndpointImpl(
+    TracingServiceImpl* service,
     base::TaskRunner* task_runner,
     Consumer* consumer)
     : task_runner_(task_runner),
@@ -1162,12 +1172,12 @@
       consumer_(consumer),
       weak_ptr_factory_(this) {}
 
-ServiceImpl::ConsumerEndpointImpl::~ConsumerEndpointImpl() {
+TracingServiceImpl::ConsumerEndpointImpl::~ConsumerEndpointImpl() {
   service_->DisconnectConsumer(this);
   consumer_->OnDisconnect();
 }
 
-void ServiceImpl::ConsumerEndpointImpl::NotifyOnTracingDisabled() {
+void TracingServiceImpl::ConsumerEndpointImpl::NotifyOnTracingDisabled() {
   PERFETTO_DCHECK_THREAD(thread_checker_);
   auto weak_this = GetWeakPtr();
   task_runner_->PostTask([weak_this] {
@@ -1176,14 +1186,15 @@
   });
 }
 
-void ServiceImpl::ConsumerEndpointImpl::EnableTracing(const TraceConfig& cfg,
-                                                      base::ScopedFile fd) {
+void TracingServiceImpl::ConsumerEndpointImpl::EnableTracing(
+    const TraceConfig& cfg,
+    base::ScopedFile fd) {
   PERFETTO_DCHECK_THREAD(thread_checker_);
   if (!service_->EnableTracing(this, cfg, std::move(fd)))
     NotifyOnTracingDisabled();
 }
 
-void ServiceImpl::ConsumerEndpointImpl::DisableTracing() {
+void TracingServiceImpl::ConsumerEndpointImpl::DisableTracing() {
   PERFETTO_DCHECK_THREAD(thread_checker_);
   if (!tracing_session_id_) {
     PERFETTO_LOG("Consumer called DisableTracing() but tracing was not active");
@@ -1192,7 +1203,7 @@
   service_->DisableTracing(tracing_session_id_);
 }
 
-void ServiceImpl::ConsumerEndpointImpl::ReadBuffers() {
+void TracingServiceImpl::ConsumerEndpointImpl::ReadBuffers() {
   PERFETTO_DCHECK_THREAD(thread_checker_);
   if (!tracing_session_id_) {
     PERFETTO_LOG("Consumer called ReadBuffers() but tracing was not active");
@@ -1201,7 +1212,7 @@
   service_->ReadBuffers(tracing_session_id_, this);
 }
 
-void ServiceImpl::ConsumerEndpointImpl::FreeBuffers() {
+void TracingServiceImpl::ConsumerEndpointImpl::FreeBuffers() {
   PERFETTO_DCHECK_THREAD(thread_checker_);
   if (!tracing_session_id_) {
     PERFETTO_LOG("Consumer called FreeBuffers() but tracing was not active");
@@ -1211,8 +1222,8 @@
   tracing_session_id_ = 0;
 }
 
-void ServiceImpl::ConsumerEndpointImpl::Flush(uint32_t timeout_ms,
-                                              FlushCallback callback) {
+void TracingServiceImpl::ConsumerEndpointImpl::Flush(uint32_t timeout_ms,
+                                                     FlushCallback callback) {
   PERFETTO_DCHECK_THREAD(thread_checker_);
   if (!tracing_session_id_) {
     PERFETTO_LOG("Consumer called Flush() but tracing was not active");
@@ -1221,20 +1232,20 @@
   service_->Flush(tracing_session_id_, timeout_ms, callback);
 }
 
-base::WeakPtr<ServiceImpl::ConsumerEndpointImpl>
-ServiceImpl::ConsumerEndpointImpl::GetWeakPtr() {
+base::WeakPtr<TracingServiceImpl::ConsumerEndpointImpl>
+TracingServiceImpl::ConsumerEndpointImpl::GetWeakPtr() {
   PERFETTO_DCHECK_THREAD(thread_checker_);
   return weak_ptr_factory_.GetWeakPtr();
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-// ServiceImpl::ProducerEndpointImpl implementation
+// TracingServiceImpl::ProducerEndpointImpl implementation
 ////////////////////////////////////////////////////////////////////////////////
 
-ServiceImpl::ProducerEndpointImpl::ProducerEndpointImpl(
+TracingServiceImpl::ProducerEndpointImpl::ProducerEndpointImpl(
     ProducerID id,
     uid_t uid,
-    ServiceImpl* service,
+    TracingServiceImpl* service,
     base::TaskRunner* task_runner,
     Producer* producer,
     const std::string& producer_name)
@@ -1246,12 +1257,12 @@
       name_(producer_name),
       weak_ptr_factory_(this) {}
 
-ServiceImpl::ProducerEndpointImpl::~ProducerEndpointImpl() {
+TracingServiceImpl::ProducerEndpointImpl::~ProducerEndpointImpl() {
   service_->DisconnectProducer(id_);
   producer_->OnDisconnect();
 }
 
-void ServiceImpl::ProducerEndpointImpl::RegisterDataSource(
+void TracingServiceImpl::ProducerEndpointImpl::RegisterDataSource(
     const DataSourceDescriptor& desc) {
   PERFETTO_DCHECK_THREAD(thread_checker_);
   if (desc.name().empty()) {
@@ -1262,13 +1273,13 @@
   service_->RegisterDataSource(id_, desc);
 }
 
-void ServiceImpl::ProducerEndpointImpl::UnregisterDataSource(
+void TracingServiceImpl::ProducerEndpointImpl::UnregisterDataSource(
     const std::string& name) {
   PERFETTO_DCHECK_THREAD(thread_checker_);
   service_->UnregisterDataSource(id_, name);
 }
 
-void ServiceImpl::ProducerEndpointImpl::CommitData(
+void TracingServiceImpl::ProducerEndpointImpl::CommitData(
     const CommitDataRequest& req_untrusted,
     CommitDataCallback callback) {
   PERFETTO_DCHECK_THREAD(thread_checker_);
@@ -1326,7 +1337,7 @@
     callback();
 }
 
-void ServiceImpl::ProducerEndpointImpl::SetSharedMemory(
+void TracingServiceImpl::ProducerEndpointImpl::SetSharedMemory(
     std::unique_ptr<SharedMemory> shared_memory) {
   PERFETTO_DCHECK(!shared_memory_ && !shmem_abi_.is_valid());
   shared_memory_ = std::move(shared_memory);
@@ -1335,16 +1346,17 @@
                         shared_buffer_page_size_kb() * 1024);
 }
 
-SharedMemory* ServiceImpl::ProducerEndpointImpl::shared_memory() const {
+SharedMemory* TracingServiceImpl::ProducerEndpointImpl::shared_memory() const {
   PERFETTO_DCHECK_THREAD(thread_checker_);
   return shared_memory_.get();
 }
 
-size_t ServiceImpl::ProducerEndpointImpl::shared_buffer_page_size_kb() const {
+size_t TracingServiceImpl::ProducerEndpointImpl::shared_buffer_page_size_kb()
+    const {
   return shared_buffer_page_size_kb_;
 }
 
-void ServiceImpl::ProducerEndpointImpl::TearDownDataSource(
+void TracingServiceImpl::ProducerEndpointImpl::TearDownDataSource(
     DataSourceInstanceID ds_inst_id) {
   // TODO(primiano): When we'll support tearing down the SMB, at this point we
   // should send the Producer a TearDownTracing if all its data sources have
@@ -1358,7 +1370,7 @@
 }
 
 SharedMemoryArbiterImpl*
-ServiceImpl::ProducerEndpointImpl::GetOrCreateShmemArbiter() {
+TracingServiceImpl::ProducerEndpointImpl::GetOrCreateShmemArbiter() {
   PERFETTO_DCHECK_THREAD(thread_checker_);
   if (!inproc_shmem_arbiter_) {
     inproc_shmem_arbiter_.reset(new SharedMemoryArbiterImpl(
@@ -1369,12 +1381,12 @@
 }
 
 std::unique_ptr<TraceWriter>
-ServiceImpl::ProducerEndpointImpl::CreateTraceWriter(BufferID buf_id) {
+TracingServiceImpl::ProducerEndpointImpl::CreateTraceWriter(BufferID buf_id) {
   PERFETTO_DCHECK_THREAD(thread_checker_);
   return GetOrCreateShmemArbiter()->CreateTraceWriter(buf_id);
 }
 
-void ServiceImpl::ProducerEndpointImpl::OnTracingSetup() {
+void TracingServiceImpl::ProducerEndpointImpl::OnTracingSetup() {
   auto weak_this = weak_ptr_factory_.GetWeakPtr();
   task_runner_->PostTask([weak_this] {
     if (weak_this)
@@ -1382,7 +1394,7 @@
   });
 }
 
-void ServiceImpl::ProducerEndpointImpl::Flush(
+void TracingServiceImpl::ProducerEndpointImpl::Flush(
     FlushRequestID flush_request_id,
     const std::vector<DataSourceInstanceID>& data_sources) {
   PERFETTO_DCHECK_THREAD(thread_checker_);
@@ -1395,7 +1407,7 @@
   });
 }
 
-void ServiceImpl::ProducerEndpointImpl::CreateDataSourceInstance(
+void TracingServiceImpl::ProducerEndpointImpl::CreateDataSourceInstance(
     DataSourceInstanceID ds_id,
     const DataSourceConfig& config) {
   PERFETTO_DCHECK_THREAD(thread_checker_);
@@ -1406,17 +1418,19 @@
   });
 }
 
-void ServiceImpl::ProducerEndpointImpl::NotifyFlushComplete(FlushRequestID id) {
+void TracingServiceImpl::ProducerEndpointImpl::NotifyFlushComplete(
+    FlushRequestID id) {
   PERFETTO_DCHECK_THREAD(thread_checker_);
   return GetOrCreateShmemArbiter()->NotifyFlushComplete(id);
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-// ServiceImpl::TracingSession implementation
+// TracingServiceImpl::TracingSession implementation
 ////////////////////////////////////////////////////////////////////////////////
 
-ServiceImpl::TracingSession::TracingSession(ConsumerEndpointImpl* consumer_ptr,
-                                            const TraceConfig& new_config)
+TracingServiceImpl::TracingSession::TracingSession(
+    ConsumerEndpointImpl* consumer_ptr,
+    const TraceConfig& new_config)
     : consumer(consumer_ptr), config(new_config) {}
 
 }  // namespace perfetto
diff --git a/src/tracing/core/service_impl.h b/src/tracing/core/tracing_service_impl.h
similarity index 88%
rename from src/tracing/core/service_impl.h
rename to src/tracing/core/tracing_service_impl.h
index b657a4a..9cc8ca5 100644
--- a/src/tracing/core/service_impl.h
+++ b/src/tracing/core/tracing_service_impl.h
@@ -14,8 +14,8 @@
  * limitations under the License.
  */
 
-#ifndef SRC_TRACING_CORE_SERVICE_IMPL_H_
-#define SRC_TRACING_CORE_SERVICE_IMPL_H_
+#ifndef SRC_TRACING_CORE_TRACING_SERVICE_IMPL_H_
+#define SRC_TRACING_CORE_TRACING_SERVICE_IMPL_H_
 
 #include <functional>
 #include <map>
@@ -30,9 +30,9 @@
 #include "perfetto/tracing/core/basic_types.h"
 #include "perfetto/tracing/core/commit_data_request.h"
 #include "perfetto/tracing/core/data_source_descriptor.h"
-#include "perfetto/tracing/core/service.h"
 #include "perfetto/tracing/core/shared_memory_abi.h"
 #include "perfetto/tracing/core/trace_config.h"
+#include "perfetto/tracing/core/tracing_service.h"
 #include "src/tracing/core/id_allocator.h"
 
 namespace perfetto {
@@ -51,23 +51,23 @@
 class TracePacket;
 
 // The tracing service business logic.
-class ServiceImpl : public Service {
+class TracingServiceImpl : public TracingService {
  public:
   static constexpr size_t kDefaultShmSize = 256 * 1024ul;
   static constexpr size_t kMaxShmSize = 32 * 1024 * 1024ul;
 
   // The implementation behind the service endpoint exposed to each producer.
-  class ProducerEndpointImpl : public Service::ProducerEndpoint {
+  class ProducerEndpointImpl : public TracingService::ProducerEndpoint {
    public:
     ProducerEndpointImpl(ProducerID,
                          uid_t uid,
-                         ServiceImpl*,
+                         TracingServiceImpl*,
                          base::TaskRunner*,
                          Producer*,
                          const std::string& producer_name);
     ~ProducerEndpointImpl() override;
 
-    // Service::ProducerEndpoint implementation.
+    // TracingService::ProducerEndpoint implementation.
     void RegisterDataSource(const DataSourceDescriptor&) override;
     void UnregisterDataSource(const std::string& name) override;
     void CommitData(const CommitDataRequest&, CommitDataCallback) override;
@@ -84,15 +84,15 @@
     size_t shared_buffer_page_size_kb() const override;
 
    private:
-    friend class ServiceImpl;
-    friend class ServiceImplTest;
+    friend class TracingServiceImpl;
+    friend class TracingServiceImplTest;
     ProducerEndpointImpl(const ProducerEndpointImpl&) = delete;
     ProducerEndpointImpl& operator=(const ProducerEndpointImpl&) = delete;
     SharedMemoryArbiterImpl* GetOrCreateShmemArbiter();
 
     ProducerID const id_;
     const uid_t uid_;
-    ServiceImpl* const service_;
+    TracingServiceImpl* const service_;
     base::TaskRunner* const task_runner_;
     Producer* producer_;
     std::unique_ptr<SharedMemory> shared_memory_;
@@ -108,15 +108,15 @@
   };
 
   // The implementation behind the service endpoint exposed to each consumer.
-  class ConsumerEndpointImpl : public Service::ConsumerEndpoint {
+  class ConsumerEndpointImpl : public TracingService::ConsumerEndpoint {
    public:
-    ConsumerEndpointImpl(ServiceImpl*, base::TaskRunner*, Consumer*);
+    ConsumerEndpointImpl(TracingServiceImpl*, base::TaskRunner*, Consumer*);
     ~ConsumerEndpointImpl() override;
 
     void NotifyOnTracingDisabled();
     base::WeakPtr<ConsumerEndpointImpl> GetWeakPtr();
 
-    // Service::ConsumerEndpoint implementation.
+    // TracingService::ConsumerEndpoint implementation.
     void EnableTracing(const TraceConfig&, base::ScopedFile) override;
     void DisableTracing() override;
     void ReadBuffers() override;
@@ -124,21 +124,21 @@
     void Flush(uint32_t timeout_ms, FlushCallback) override;
 
    private:
-    friend class ServiceImpl;
+    friend class TracingServiceImpl;
     ConsumerEndpointImpl(const ConsumerEndpointImpl&) = delete;
     ConsumerEndpointImpl& operator=(const ConsumerEndpointImpl&) = delete;
 
     base::TaskRunner* const task_runner_;
-    ServiceImpl* const service_;
+    TracingServiceImpl* const service_;
     Consumer* const consumer_;
     TracingSessionID tracing_session_id_ = 0;
     PERFETTO_THREAD_CHECKER(thread_checker_)
     base::WeakPtrFactory<ConsumerEndpointImpl> weak_ptr_factory_;  // Keep last.
   };
 
-  explicit ServiceImpl(std::unique_ptr<SharedMemory::Factory>,
-                       base::TaskRunner*);
-  ~ServiceImpl() override;
+  explicit TracingServiceImpl(std::unique_ptr<SharedMemory::Factory>,
+                              base::TaskRunner*);
+  ~TracingServiceImpl() override;
 
   // Called by ProducerEndpointImpl.
   void DisconnectProducer(ProducerID);
@@ -171,13 +171,13 @@
   void FreeBuffers(TracingSessionID);
 
   // Service implementation.
-  std::unique_ptr<Service::ProducerEndpoint> ConnectProducer(
+  std::unique_ptr<TracingService::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(
+  std::unique_ptr<TracingService::ConsumerEndpoint> ConnectConsumer(
       Consumer*) override;
 
   // Exposed mainly for testing.
@@ -185,7 +185,7 @@
   ProducerEndpointImpl* GetProducer(ProducerID) const;
 
  private:
-  friend class ServiceImplTest;
+  friend class TracingServiceImplTest;
 
   struct RegisteredDataSource {
     ProducerID producer_id;
@@ -258,8 +258,8 @@
     uint64_t bytes_written_into_file = 0;
   };
 
-  ServiceImpl(const ServiceImpl&) = delete;
-  ServiceImpl& operator=(const ServiceImpl&) = delete;
+  TracingServiceImpl(const TracingServiceImpl&) = delete;
+  TracingServiceImpl& operator=(const TracingServiceImpl&) = delete;
 
   void CreateDataSourceInstance(const TraceConfig::DataSource&,
                                 const TraceConfig::ProducerConfig&,
@@ -305,9 +305,10 @@
 
   PERFETTO_THREAD_CHECKER(thread_checker_)
 
-  base::WeakPtrFactory<ServiceImpl> weak_ptr_factory_;  // Keep at the end.
+  base::WeakPtrFactory<TracingServiceImpl>
+      weak_ptr_factory_;  // Keep at the end.
 };
 
 }  // namespace perfetto
 
-#endif  // SRC_TRACING_CORE_SERVICE_IMPL_H_
+#endif  // SRC_TRACING_CORE_TRACING_SERVICE_IMPL_H_
diff --git a/src/tracing/core/virtual_destructors.cc b/src/tracing/core/virtual_destructors.cc
index 24c7c7c..aa73453 100644
--- a/src/tracing/core/virtual_destructors.cc
+++ b/src/tracing/core/virtual_destructors.cc
@@ -16,9 +16,9 @@
 
 #include "perfetto/tracing/core/consumer.h"
 #include "perfetto/tracing/core/producer.h"
-#include "perfetto/tracing/core/service.h"
 #include "perfetto/tracing/core/shared_memory.h"
 #include "perfetto/tracing/core/shared_memory_arbiter.h"
+#include "perfetto/tracing/core/tracing_service.h"
 
 // This translation unit contains the definitions for the destructor of pure
 // virtual interfaces for the current build target. The alternative would be
@@ -29,9 +29,9 @@
 
 Consumer::~Consumer() = default;
 Producer::~Producer() = default;
-Service::~Service() = default;
-Service::ConsumerEndpoint::~ConsumerEndpoint() = default;
-Service::ProducerEndpoint::~ProducerEndpoint() = default;
+TracingService::~TracingService() = default;
+TracingService::ConsumerEndpoint::~ConsumerEndpoint() = default;
+TracingService::ProducerEndpoint::~ProducerEndpoint() = default;
 SharedMemory::~SharedMemory() = default;
 SharedMemory::Factory::~Factory() = default;
 SharedMemoryArbiter::~SharedMemoryArbiter() = default;
diff --git a/src/tracing/ipc/consumer/consumer_ipc_client_impl.cc b/src/tracing/ipc/consumer/consumer_ipc_client_impl.cc
index 34f135f..05d67fa 100644
--- a/src/tracing/ipc/consumer/consumer_ipc_client_impl.cc
+++ b/src/tracing/ipc/consumer/consumer_ipc_client_impl.cc
@@ -31,11 +31,11 @@
 namespace perfetto {
 
 // static. (Declared in include/tracing/ipc/consumer_ipc_client.h).
-std::unique_ptr<Service::ConsumerEndpoint> ConsumerIPCClient::Connect(
+std::unique_ptr<TracingService::ConsumerEndpoint> ConsumerIPCClient::Connect(
     const char* service_sock_name,
     Consumer* consumer,
     base::TaskRunner* task_runner) {
-  return std::unique_ptr<Service::ConsumerEndpoint>(
+  return std::unique_ptr<TracingService::ConsumerEndpoint>(
       new ConsumerIPCClientImpl(service_sock_name, consumer, task_runner));
 }
 
diff --git a/src/tracing/ipc/consumer/consumer_ipc_client_impl.h b/src/tracing/ipc/consumer/consumer_ipc_client_impl.h
index e7c5cce..4257a54 100644
--- a/src/tracing/ipc/consumer/consumer_ipc_client_impl.h
+++ b/src/tracing/ipc/consumer/consumer_ipc_client_impl.h
@@ -25,8 +25,8 @@
 #include "perfetto/base/weak_ptr.h"
 #include "perfetto/ipc/service_proxy.h"
 #include "perfetto/tracing/core/basic_types.h"
-#include "perfetto/tracing/core/service.h"
 #include "perfetto/tracing/core/trace_packet.h"
+#include "perfetto/tracing/core/tracing_service.h"
 #include "perfetto/tracing/ipc/consumer_ipc_client.h"
 
 #include "perfetto/ipc/consumer_port.ipc.h"
@@ -48,7 +48,7 @@
 // IPC channel to the remote Service. This class is the glue layer between the
 // generic Service interface exposed to the clients of the library and the
 // actual IPC transport.
-class ConsumerIPCClientImpl : public Service::ConsumerEndpoint,
+class ConsumerIPCClientImpl : public TracingService::ConsumerEndpoint,
                               public ipc::ServiceProxy::EventListener {
  public:
   ConsumerIPCClientImpl(const char* service_sock_name,
@@ -56,7 +56,7 @@
                         base::TaskRunner*);
   ~ConsumerIPCClientImpl() override;
 
-  // Service::ConsumerEndpoint implementation.
+  // TracingService::ConsumerEndpoint implementation.
   // These methods are invoked by the actual Consumer(s) code by clients of the
   // tracing library, which know nothing about the IPC transport.
   void EnableTracing(const TraceConfig&, base::ScopedFile) override;
diff --git a/src/tracing/ipc/producer/producer_ipc_client_impl.cc b/src/tracing/ipc/producer/producer_ipc_client_impl.cc
index fb8b557..d0ad831 100644
--- a/src/tracing/ipc/producer/producer_ipc_client_impl.cc
+++ b/src/tracing/ipc/producer/producer_ipc_client_impl.cc
@@ -37,13 +37,14 @@
 namespace perfetto {
 
 // static. (Declared in include/tracing/ipc/producer_ipc_client.h).
-std::unique_ptr<Service::ProducerEndpoint> ProducerIPCClient::Connect(
+std::unique_ptr<TracingService::ProducerEndpoint> ProducerIPCClient::Connect(
     const char* service_sock_name,
     Producer* producer,
     const std::string& producer_name,
     base::TaskRunner* task_runner) {
-  return std::unique_ptr<Service::ProducerEndpoint>(new ProducerIPCClientImpl(
-      service_sock_name, producer, producer_name, task_runner));
+  return std::unique_ptr<TracingService::ProducerEndpoint>(
+      new ProducerIPCClientImpl(service_sock_name, producer, producer_name,
+                                task_runner));
 }
 
 ProducerIPCClientImpl::ProducerIPCClientImpl(const char* service_sock_name,
diff --git a/src/tracing/ipc/producer/producer_ipc_client_impl.h b/src/tracing/ipc/producer/producer_ipc_client_impl.h
index 01f35c1..7a8bfda 100644
--- a/src/tracing/ipc/producer/producer_ipc_client_impl.h
+++ b/src/tracing/ipc/producer/producer_ipc_client_impl.h
@@ -24,8 +24,8 @@
 #include "perfetto/base/thread_checker.h"
 #include "perfetto/ipc/service_proxy.h"
 #include "perfetto/tracing/core/basic_types.h"
-#include "perfetto/tracing/core/service.h"
 #include "perfetto/tracing/core/shared_memory.h"
+#include "perfetto/tracing/core/tracing_service.h"
 #include "perfetto/tracing/ipc/producer_ipc_client.h"
 
 #include "perfetto/ipc/producer_port.ipc.h"
@@ -48,7 +48,7 @@
 // IPC channel to the remote Service. This class is the glue layer between the
 // generic Service interface exposed to the clients of the library and the
 // actual IPC transport.
-class ProducerIPCClientImpl : public Service::ProducerEndpoint,
+class ProducerIPCClientImpl : public TracingService::ProducerEndpoint,
                               public ipc::ServiceProxy::EventListener {
  public:
   ProducerIPCClientImpl(const char* service_sock_name,
@@ -57,7 +57,7 @@
                         base::TaskRunner*);
   ~ProducerIPCClientImpl() override;
 
-  // Service::ProducerEndpoint implementation.
+  // TracingService::ProducerEndpoint implementation.
   // These methods are invoked by the actual Producer(s) code by clients of the
   // tracing library, which know nothing about the IPC transport.
   void RegisterDataSource(const DataSourceDescriptor&) override;
diff --git a/src/tracing/ipc/service/consumer_ipc_service.cc b/src/tracing/ipc/service/consumer_ipc_service.cc
index ddfc89c..d378c67 100644
--- a/src/tracing/ipc/service/consumer_ipc_service.cc
+++ b/src/tracing/ipc/service/consumer_ipc_service.cc
@@ -23,15 +23,15 @@
 #include "perfetto/base/task_runner.h"
 #include "perfetto/ipc/basic_types.h"
 #include "perfetto/ipc/host.h"
-#include "perfetto/tracing/core/service.h"
 #include "perfetto/tracing/core/shared_memory_abi.h"
 #include "perfetto/tracing/core/slice.h"
 #include "perfetto/tracing/core/trace_config.h"
 #include "perfetto/tracing/core/trace_packet.h"
+#include "perfetto/tracing/core/tracing_service.h"
 
 namespace perfetto {
 
-ConsumerIPCService::ConsumerIPCService(Service* core_service)
+ConsumerIPCService::ConsumerIPCService(TracingService* core_service)
     : core_service_(core_service), weak_ptr_factory_(this) {}
 
 ConsumerIPCService::~ConsumerIPCService() = default;
diff --git a/src/tracing/ipc/service/consumer_ipc_service.h b/src/tracing/ipc/service/consumer_ipc_service.h
index d2b22ce..3fdc5d6 100644
--- a/src/tracing/ipc/service/consumer_ipc_service.h
+++ b/src/tracing/ipc/service/consumer_ipc_service.h
@@ -25,7 +25,7 @@
 #include "perfetto/base/weak_ptr.h"
 #include "perfetto/ipc/basic_types.h"
 #include "perfetto/tracing/core/consumer.h"
-#include "perfetto/tracing/core/service.h"
+#include "perfetto/tracing/core/tracing_service.h"
 
 #include "perfetto/ipc/consumer_port.ipc.h"
 
@@ -40,8 +40,7 @@
 // on the IPC socket, through the methods overriddden from ConsumerPort.
 class ConsumerIPCService : public protos::ConsumerPort {
  public:
-  using Service = ::perfetto::Service;  // To avoid collisions w/ ipc::Service.
-  explicit ConsumerIPCService(Service* core_service);
+  explicit ConsumerIPCService(TracingService* core_service);
   ~ConsumerIPCService() override;
 
   // ConsumerPort implementation (from .proto IPC definition).
@@ -73,9 +72,9 @@
     void OnTraceData(std::vector<TracePacket>, bool has_more) override;
 
     // The interface obtained from the core service business logic through
-    // Service::ConnectConsumer(this). This allows to invoke methods for a
-    // specific Consumer on the Service business logic.
-    std::unique_ptr<Service::ConsumerEndpoint> service_endpoint;
+    // TracingService::ConnectConsumer(this). This allows to invoke methods for
+    // a specific Consumer on the Service business logic.
+    std::unique_ptr<TracingService::ConsumerEndpoint> service_endpoint;
 
     // After DisableTracing() is invoked, this binds the async callback that
     // allows to stream trace packets back to the client.
@@ -98,7 +97,7 @@
 
   void OnFlushCallback(bool success, PendingFlushResponses::iterator);
 
-  Service* const core_service_;
+  TracingService* const core_service_;
 
   // Maps IPC clients to ConsumerEndpoint instances registered on the
   // |core_service_| business logic.
diff --git a/src/tracing/ipc/service/producer_ipc_service.cc b/src/tracing/ipc/service/producer_ipc_service.cc
index a51f5b4..0b8ceef 100644
--- a/src/tracing/ipc/service/producer_ipc_service.cc
+++ b/src/tracing/ipc/service/producer_ipc_service.cc
@@ -24,7 +24,7 @@
 #include "perfetto/tracing/core/commit_data_request.h"
 #include "perfetto/tracing/core/data_source_config.h"
 #include "perfetto/tracing/core/data_source_descriptor.h"
-#include "perfetto/tracing/core/service.h"
+#include "perfetto/tracing/core/tracing_service.h"
 #include "src/tracing/ipc/posix_shared_memory.h"
 
 // The remote Producer(s) are not trusted. All the methods from the ProducerPort
@@ -33,7 +33,7 @@
 
 namespace perfetto {
 
-ProducerIPCService::ProducerIPCService(Service* core_service)
+ProducerIPCService::ProducerIPCService(TracingService* core_service)
     : core_service_(core_service), weak_ptr_factory_(this) {}
 
 ProducerIPCService::~ProducerIPCService() = default;
@@ -148,10 +148,10 @@
   std::function<void()> callback;
   if (resp.IsBound()) {
     // Capturing |resp| by reference here speculates on the fact that
-    // CommitData() in service_impl.cc invokes the passed callback inline,
-    // without posting it. If that assumption changes this code needs to wrap
-    // the response in a shared_ptr (C+11 lambdas don't support move) and use
-    // a weak ptr in the caller.
+    // CommitData() in tracing_service_impl.cc invokes the passed callback
+    // inline, without posting it. If that assumption changes this code needs to
+    // wrap the response in a shared_ptr (C+11 lambdas don't support move) and
+    // use a weak ptr in the caller.
     callback = [&resp] {
       resp.Resolve(ipc::AsyncResult<protos::CommitDataResponse>::Create());
     };
diff --git a/src/tracing/ipc/service/producer_ipc_service.h b/src/tracing/ipc/service/producer_ipc_service.h
index ab795a4..c38bcb4 100644
--- a/src/tracing/ipc/service/producer_ipc_service.h
+++ b/src/tracing/ipc/service/producer_ipc_service.h
@@ -24,7 +24,7 @@
 #include "perfetto/base/weak_ptr.h"
 #include "perfetto/ipc/basic_types.h"
 #include "perfetto/tracing/core/producer.h"
-#include "perfetto/tracing/core/service.h"
+#include "perfetto/tracing/core/tracing_service.h"
 
 #include "perfetto/ipc/producer_port.ipc.h"
 
@@ -39,8 +39,7 @@
 // on the IPC socket, through the methods overriddden from ProducerPort.
 class ProducerIPCService : public protos::ProducerPort {
  public:
-  using Service = ::perfetto::Service;  // To avoid collisions w/ ipc::Service.
-  explicit ProducerIPCService(Service* core_service);
+  explicit ProducerIPCService(TracingService* core_service);
   ~ProducerIPCService() override;
 
   // ProducerPort implementation (from .proto IPC definition).
@@ -80,7 +79,7 @@
     // The interface obtained from the core service business logic through
     // Service::ConnectProducer(this). This allows to invoke methods for a
     // specific Producer on the Service business logic.
-    std::unique_ptr<Service::ProducerEndpoint> service_endpoint;
+    std::unique_ptr<TracingService::ProducerEndpoint> service_endpoint;
 
     // The back-channel (based on a never ending stream request) that allows us
     // to send asynchronous commands to the remote Producer (e.g. start/stop a
@@ -95,7 +94,7 @@
   // the current IPC request.
   RemoteProducer* GetProducerForCurrentRequest();
 
-  Service* const core_service_;
+  TracingService* const core_service_;
 
   // Maps IPC clients to ProducerEndpoint instances registered on the
   // |core_service_| business logic.
diff --git a/src/tracing/ipc/service/service_ipc_host_impl.cc b/src/tracing/ipc/service/service_ipc_host_impl.cc
index 929e544..98b6a7a 100644
--- a/src/tracing/ipc/service/service_ipc_host_impl.cc
+++ b/src/tracing/ipc/service/service_ipc_host_impl.cc
@@ -19,7 +19,7 @@
 #include "perfetto/base/logging.h"
 #include "perfetto/base/task_runner.h"
 #include "perfetto/ipc/host.h"
-#include "perfetto/tracing/core/service.h"
+#include "perfetto/tracing/core/tracing_service.h"
 #include "src/tracing/ipc/posix_shared_memory.h"
 #include "src/tracing/ipc/service/consumer_ipc_service.h"
 #include "src/tracing/ipc/service/producer_ipc_service.h"
@@ -68,7 +68,7 @@
   // Create and initialize the platform-independent tracing business logic.
   std::unique_ptr<SharedMemory::Factory> shm_factory(
       new PosixSharedMemory::Factory());
-  svc_ = Service::CreateInstance(std::move(shm_factory), task_runner_);
+  svc_ = TracingService::CreateInstance(std::move(shm_factory), task_runner_);
 
   if (!producer_ipc_port_) {
     Shutdown();
@@ -93,7 +93,7 @@
   return true;
 }
 
-Service* ServiceIPCHostImpl::service_for_testing() const {
+TracingService* ServiceIPCHostImpl::service_for_testing() const {
   return svc_.get();
 }
 
diff --git a/src/tracing/ipc/service/service_ipc_host_impl.h b/src/tracing/ipc/service/service_ipc_host_impl.h
index a560318..8e10322 100644
--- a/src/tracing/ipc/service/service_ipc_host_impl.h
+++ b/src/tracing/ipc/service/service_ipc_host_impl.h
@@ -42,14 +42,14 @@
   bool Start(base::ScopedFile producer_socket_fd,
              base::ScopedFile consumer_socket_fd) override;
 
-  Service* service_for_testing() const;
+  TracingService* service_for_testing() const;
 
  private:
   bool DoStart();
   void Shutdown();
 
   base::TaskRunner* const task_runner_;
-  std::unique_ptr<Service> svc_;  // The service business logic.
+  std::unique_ptr<TracingService> svc_;  // The service business logic.
 
   // The IPC host that listens on the Producer socket. It owns the
   // PosixServiceProducerPort instance which deals with all producers' IPC(s).
diff --git a/src/tracing/test/mock_consumer.cc b/src/tracing/test/mock_consumer.cc
index 74833f2..38b5b6a 100644
--- a/src/tracing/test/mock_consumer.cc
+++ b/src/tracing/test/mock_consumer.cc
@@ -38,7 +38,7 @@
   task_runner_->RunUntilCheckpoint(checkpoint_name);
 }
 
-void MockConsumer::Connect(Service* svc) {
+void MockConsumer::Connect(TracingService* svc) {
   service_endpoint_ = svc->ConnectConsumer(this);
   static int i = 0;
   auto checkpoint_name = "on_consumer_connect_" + std::to_string(i++);
diff --git a/src/tracing/test/mock_consumer.h b/src/tracing/test/mock_consumer.h
index f08c98a..3908c77 100644
--- a/src/tracing/test/mock_consumer.h
+++ b/src/tracing/test/mock_consumer.h
@@ -21,8 +21,8 @@
 
 #include "gmock/gmock.h"
 #include "perfetto/tracing/core/consumer.h"
-#include "perfetto/tracing/core/service.h"
 #include "perfetto/tracing/core/trace_packet.h"
+#include "perfetto/tracing/core/tracing_service.h"
 
 #include "perfetto/trace/trace_packet.pb.h"
 
@@ -46,7 +46,7 @@
   explicit MockConsumer(base::TestTaskRunner*);
   ~MockConsumer() override;
 
-  void Connect(Service* svc);
+  void Connect(TracingService* svc);
   void EnableTracing(const TraceConfig&, base::ScopedFile = base::ScopedFile());
   void DisableTracing();
   void FreeBuffers();
@@ -54,7 +54,9 @@
   FlushRequest Flush(uint32_t timeout_ms = 10000);
   std::vector<protos::TracePacket> ReadBuffers();
 
-  Service::ConsumerEndpoint* endpoint() { return service_endpoint_.get(); }
+  TracingService::ConsumerEndpoint* endpoint() {
+    return service_endpoint_.get();
+  }
 
   // Consumer implementation.
   MOCK_METHOD0(OnConnect, void());
@@ -71,7 +73,7 @@
 
  private:
   base::TestTaskRunner* const task_runner_;
-  std::unique_ptr<Service::ConsumerEndpoint> service_endpoint_;
+  std::unique_ptr<TracingService::ConsumerEndpoint> service_endpoint_;
 };
 
 }  // namespace perfetto
diff --git a/src/tracing/test/mock_producer.cc b/src/tracing/test/mock_producer.cc
index fbf19c5..6e3f860 100644
--- a/src/tracing/test/mock_producer.cc
+++ b/src/tracing/test/mock_producer.cc
@@ -43,7 +43,7 @@
   task_runner_->RunUntilCheckpoint(checkpoint_name);
 }
 
-void MockProducer::Connect(Service* svc,
+void MockProducer::Connect(TracingService* svc,
                            const std::string& producer_name,
                            uid_t uid,
                            size_t shared_memory_size_hint_bytes) {
diff --git a/src/tracing/test/mock_producer.h b/src/tracing/test/mock_producer.h
index d734c7f..9525d50 100644
--- a/src/tracing/test/mock_producer.h
+++ b/src/tracing/test/mock_producer.h
@@ -23,8 +23,8 @@
 
 #include "gmock/gmock.h"
 #include "perfetto/tracing/core/producer.h"
-#include "perfetto/tracing/core/service.h"
 #include "perfetto/tracing/core/trace_writer.h"
+#include "perfetto/tracing/core/tracing_service.h"
 
 namespace perfetto {
 
@@ -42,7 +42,7 @@
   explicit MockProducer(base::TestTaskRunner*);
   ~MockProducer() override;
 
-  void Connect(Service* svc,
+  void Connect(TracingService* svc,
                const std::string& producer_name,
                uid_t uid = 42,
                size_t shared_memory_size_hint_bytes = 0);
@@ -58,7 +58,9 @@
   // If |writer_to_flush| == nullptr does NOT reply to the flush request.
   void WaitForFlush(TraceWriter* writer_to_flush);
 
-  Service::ProducerEndpoint* endpoint() { return service_endpoint_.get(); }
+  TracingService::ProducerEndpoint* endpoint() {
+    return service_endpoint_.get();
+  }
 
   // Producer implementation.
   MOCK_METHOD0(OnConnect, void());
@@ -73,7 +75,7 @@
  private:
   base::TestTaskRunner* const task_runner_;
   std::string producer_name_;
-  std::unique_ptr<Service::ProducerEndpoint> service_endpoint_;
+  std::unique_ptr<TracingService::ProducerEndpoint> service_endpoint_;
   std::map<std::string, EnabledDataSource> data_source_instances_;
 };
 
diff --git a/src/tracing/test/tracing_integration_test.cc b/src/tracing/test/tracing_integration_test.cc
index 5c17a69..ef8bc7a 100644
--- a/src/tracing/test/tracing_integration_test.cc
+++ b/src/tracing/test/tracing_integration_test.cc
@@ -165,9 +165,9 @@
 
   std::unique_ptr<base::TestTaskRunner> task_runner_;
   std::unique_ptr<ServiceIPCHost> svc_;
-  std::unique_ptr<Service::ProducerEndpoint> producer_endpoint_;
+  std::unique_ptr<TracingService::ProducerEndpoint> producer_endpoint_;
   MockProducer producer_;
-  std::unique_ptr<Service::ConsumerEndpoint> consumer_endpoint_;
+  std::unique_ptr<TracingService::ConsumerEndpoint> consumer_endpoint_;
   MockConsumer consumer_;
 };
 
diff --git a/test/cts/README.md b/test/cts/README.md
index ac1211f..75e7c07 100644
--- a/test/cts/README.md
+++ b/test/cts/README.md
@@ -31,4 +31,4 @@
 
 The code is located inside the Perfetto repository as we anticipate fast
 development on Perfetto and moreover, we wish to retain the ability to
-run these tests independently of the Android tree if required.
\ No newline at end of file
+run these tests independently of the Android tree if required.
diff --git a/test/end_to_end_shared_memory_fuzzer.cc b/test/end_to_end_shared_memory_fuzzer.cc
index bbde7b1..6d29512 100644
--- a/test/end_to_end_shared_memory_fuzzer.cc
+++ b/test/end_to_end_shared_memory_fuzzer.cc
@@ -102,7 +102,7 @@
   const std::string name_;
   const uint8_t* data_;
   const size_t size_;
-  std::unique_ptr<Service::ProducerEndpoint> endpoint_;
+  std::unique_ptr<TracingService::ProducerEndpoint> endpoint_;
   std::function<void()> on_produced_and_committed_;
 };
 
diff --git a/test/fake_producer.h b/test/fake_producer.h
index a980591..b9101e7 100644
--- a/test/fake_producer.h
+++ b/test/fake_producer.h
@@ -63,7 +63,7 @@
   uint32_t message_count_ = 0;
   uint32_t max_messages_per_second_ = 0;
   std::function<void()> on_create_data_source_instance_;
-  std::unique_ptr<Service::ProducerEndpoint> endpoint_;
+  std::unique_ptr<TracingService::ProducerEndpoint> endpoint_;
   std::unique_ptr<TraceWriter> trace_writer_;
 };
 
diff --git a/test/test_helper.h b/test/test_helper.h
index d7afc86..2bd4cf0 100644
--- a/test/test_helper.h
+++ b/test/test_helper.h
@@ -67,7 +67,7 @@
 
   TaskRunnerThread service_thread_;
   TaskRunnerThread producer_thread_;
-  std::unique_ptr<Service::ConsumerEndpoint> endpoint_;  // Keep last.
+  std::unique_ptr<TracingService::ConsumerEndpoint> endpoint_;  // Keep last.
 };
 
 }  // namespace perfetto