• 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,DataSourceStaticState *)56 bool TracingMuxerFake::RegisterDataSource(const DataSourceDescriptor&,
57                                           DataSourceFactory,
58                                           DataSourceStaticState*) {
59   FailUninitialized();
60 }
61 
UpdateDataSourceDescriptor(const DataSourceDescriptor &,const DataSourceStaticState *)62 void TracingMuxerFake::UpdateDataSourceDescriptor(
63     const DataSourceDescriptor&,
64     const DataSourceStaticState*) {
65   FailUninitialized();
66 }
67 
CreateTraceWriter(DataSourceStaticState *,uint32_t,DataSourceState *,BufferExhaustedPolicy)68 std::unique_ptr<TraceWriterBase> TracingMuxerFake::CreateTraceWriter(
69     DataSourceStaticState*,
70     uint32_t,
71     DataSourceState*,
72     BufferExhaustedPolicy) {
73   FailUninitialized();
74 }
75 
DestroyStoppedTraceWritersForCurrentThread()76 void TracingMuxerFake::DestroyStoppedTraceWritersForCurrentThread() {
77   FailUninitialized();
78 }
79 
RegisterInterceptor(const InterceptorDescriptor &,InterceptorFactory,InterceptorBase::TLSFactory,InterceptorBase::TracePacketCallback)80 void TracingMuxerFake::RegisterInterceptor(
81     const InterceptorDescriptor&,
82     InterceptorFactory,
83     InterceptorBase::TLSFactory,
84     InterceptorBase::TracePacketCallback) {
85   FailUninitialized();
86 }
87 
88 }  // namespace internal
89 }  // namespace perfetto
90