• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021 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 #include "src/tracing/internal/tracing_muxer_fake.h"
18 
19 namespace perfetto {
20 namespace internal {
21 namespace {
22 
FailUninitialized()23 PERFETTO_NORETURN void FailUninitialized() {
24   PERFETTO_FATAL(
25       "Tracing not initialized. Call perfetto::Tracing::Initialize() first.");
26 }
27 
28 }  // namespace
29 
30 #if PERFETTO_HAS_NO_DESTROY()
31 // static
32 PERFETTO_NO_DESTROY TracingMuxerFake::FakePlatform
33     TracingMuxerFake::FakePlatform::instance{};
34 // static
35 PERFETTO_NO_DESTROY TracingMuxerFake TracingMuxerFake::instance{};
36 #endif  // PERFETTO_HAS_NO_DESTROY()
37 
38 TracingMuxerFake::~TracingMuxerFake() = default;
39 
40 TracingMuxerFake::FakePlatform::~FakePlatform() = default;
41 
42 Platform::ThreadLocalObject*
GetOrCreateThreadLocalObject()43 TracingMuxerFake::FakePlatform::GetOrCreateThreadLocalObject() {
44   FailUninitialized();
45 }
46 
47 std::unique_ptr<base::TaskRunner>
CreateTaskRunner(const CreateTaskRunnerArgs &)48 TracingMuxerFake::FakePlatform::CreateTaskRunner(const CreateTaskRunnerArgs&) {
49   FailUninitialized();
50 }
51 
GetCurrentProcessName()52 std::string TracingMuxerFake::FakePlatform::GetCurrentProcessName() {
53   FailUninitialized();
54 }
55 
RegisterDataSource(const DataSourceDescriptor &,DataSourceFactory,DataSourceParams,DataSourceStaticState *)56 bool TracingMuxerFake::RegisterDataSource(const DataSourceDescriptor&,
57                                           DataSourceFactory,
58                                           DataSourceParams,
59                                           DataSourceStaticState*) {
60   FailUninitialized();
61 }
62 
UpdateDataSourceDescriptor(const DataSourceDescriptor &,const DataSourceStaticState *)63 void TracingMuxerFake::UpdateDataSourceDescriptor(
64     const DataSourceDescriptor&,
65     const DataSourceStaticState*) {
66   FailUninitialized();
67 }
68 
CreateTraceWriter(DataSourceStaticState *,uint32_t,DataSourceState *,BufferExhaustedPolicy)69 std::unique_ptr<TraceWriterBase> TracingMuxerFake::CreateTraceWriter(
70     DataSourceStaticState*,
71     uint32_t,
72     DataSourceState*,
73     BufferExhaustedPolicy) {
74   FailUninitialized();
75 }
76 
DestroyStoppedTraceWritersForCurrentThread()77 void TracingMuxerFake::DestroyStoppedTraceWritersForCurrentThread() {
78   FailUninitialized();
79 }
80 
RegisterInterceptor(const InterceptorDescriptor &,InterceptorFactory,InterceptorBase::TLSFactory,InterceptorBase::TracePacketCallback)81 void TracingMuxerFake::RegisterInterceptor(
82     const InterceptorDescriptor&,
83     InterceptorFactory,
84     InterceptorBase::TLSFactory,
85     InterceptorBase::TracePacketCallback) {
86   FailUninitialized();
87 }
88 
ActivateTriggers(const std::vector<std::string> &,uint32_t)89 void TracingMuxerFake::ActivateTriggers(const std::vector<std::string>&,
90                                         uint32_t) {
91   FailUninitialized();
92 }
93 
94 }  // namespace internal
95 }  // namespace perfetto
96