1 /* 2 * Copyright (C) 2019 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 SRC_TRACING_TEST_FAKE_PRODUCER_ENDPOINT_H_ 18 #define SRC_TRACING_TEST_FAKE_PRODUCER_ENDPOINT_H_ 19 20 #include "perfetto/ext/tracing/core/commit_data_request.h" 21 #include "perfetto/ext/tracing/core/tracing_service.h" 22 23 namespace perfetto { 24 25 class FakeProducerEndpoint : public TracingService::ProducerEndpoint { 26 public: RegisterDataSource(const DataSourceDescriptor &)27 void RegisterDataSource(const DataSourceDescriptor&) override {} UnregisterDataSource(const std::string &)28 void UnregisterDataSource(const std::string&) override {} RegisterTraceWriter(uint32_t,uint32_t)29 void RegisterTraceWriter(uint32_t, uint32_t) override {} UnregisterTraceWriter(uint32_t)30 void UnregisterTraceWriter(uint32_t) override {} CommitData(const CommitDataRequest & req,CommitDataCallback callback)31 void CommitData(const CommitDataRequest& req, 32 CommitDataCallback callback) override { 33 last_commit_data_request = req; 34 last_commit_data_callback = callback; 35 } NotifyFlushComplete(FlushRequestID)36 void NotifyFlushComplete(FlushRequestID) override {} NotifyDataSourceStarted(DataSourceInstanceID)37 void NotifyDataSourceStarted(DataSourceInstanceID) override {} NotifyDataSourceStopped(DataSourceInstanceID)38 void NotifyDataSourceStopped(DataSourceInstanceID) override {} ActivateTriggers(const std::vector<std::string> &)39 void ActivateTriggers(const std::vector<std::string>&) override {} Sync(std::function<void ()>)40 void Sync(std::function<void()>) override {} shared_memory()41 SharedMemory* shared_memory() const override { return nullptr; } shared_buffer_page_size_kb()42 size_t shared_buffer_page_size_kb() const override { return 0; } CreateTraceWriter(BufferID,BufferExhaustedPolicy)43 std::unique_ptr<TraceWriter> CreateTraceWriter( 44 BufferID, 45 BufferExhaustedPolicy) override { 46 return nullptr; 47 } MaybeSharedMemoryArbiter()48 SharedMemoryArbiter* MaybeSharedMemoryArbiter() override { return nullptr; } IsShmemProvidedByProducer()49 bool IsShmemProvidedByProducer() const override { return false; } 50 51 CommitDataRequest last_commit_data_request; 52 CommitDataCallback last_commit_data_callback; 53 }; 54 55 } // namespace perfetto 56 57 #endif // SRC_TRACING_TEST_FAKE_PRODUCER_ENDPOINT_H_ 58