1 /* 2 * Copyright (C) 2024 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef INCLUDE_PERFETTO_EXT_TRACING_CORE_NULL_CONSUMER_ENDPOINT_FOR_TESTING_H_ 18 #define INCLUDE_PERFETTO_EXT_TRACING_CORE_NULL_CONSUMER_ENDPOINT_FOR_TESTING_H_ 19 20 #include "perfetto/ext/tracing/core/tracing_service.h" 21 22 namespace perfetto { 23 24 // An empty implemetation of ConsumerEndpoint. This is used only to handle 25 // code in other repos like arctraceservice/PerfettoClient_test.cpp which 26 // ended up depending on internal perfetto interfaces against our plans. 27 // This allows to make changes to the ConsumerEndpoint without requiring 3way 28 // patches when touching methods that are not overridden by other projects. 29 class NullConsumerEndpointForTesting : public ConsumerEndpoint { 30 public: ~NullConsumerEndpointForTesting()31 ~NullConsumerEndpointForTesting() override {} 32 EnableTracing(const TraceConfig &,base::ScopedFile)33 void EnableTracing(const TraceConfig&, base::ScopedFile) override {} ChangeTraceConfig(const perfetto::TraceConfig &)34 void ChangeTraceConfig(const perfetto::TraceConfig&) override {} StartTracing()35 void StartTracing() override {} DisableTracing()36 void DisableTracing() override {} CloneSession(TracingSessionID,CloneSessionArgs)37 void CloneSession(TracingSessionID, CloneSessionArgs) override {} Flush(uint32_t,FlushCallback,FlushFlags)38 void Flush(uint32_t, FlushCallback, FlushFlags) override {} ReadBuffers()39 void ReadBuffers() override {} FreeBuffers()40 void FreeBuffers() override {} Detach(const std::string &)41 void Detach(const std::string&) override {} Attach(const std::string &)42 void Attach(const std::string&) override {} GetTraceStats()43 void GetTraceStats() override {} ObserveEvents(uint32_t)44 void ObserveEvents(uint32_t) override {} QueryServiceState(ConsumerEndpoint::QueryServiceStateArgs,ConsumerEndpoint::QueryServiceStateCallback)45 void QueryServiceState(ConsumerEndpoint::QueryServiceStateArgs, 46 ConsumerEndpoint::QueryServiceStateCallback) override { 47 } QueryCapabilities(ConsumerEndpoint::QueryCapabilitiesCallback)48 void QueryCapabilities(ConsumerEndpoint::QueryCapabilitiesCallback) override { 49 } SaveTraceForBugreport(ConsumerEndpoint::SaveTraceForBugreportCallback)50 void SaveTraceForBugreport( 51 ConsumerEndpoint::SaveTraceForBugreportCallback) override {} 52 }; 53 54 } // namespace perfetto 55 56 #endif // INCLUDE_PERFETTO_EXT_TRACING_CORE_NULL_CONSUMER_ENDPOINT_FOR_TESTING_H_ 57