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 #include "src/trace_processor/importers/proto/proto_importer_module.h"
18 #include "src/trace_processor/trace_processor_context.h"
19 
20 namespace perfetto {
21 namespace trace_processor {
22 
ProtoImporterModule()23 ProtoImporterModule::ProtoImporterModule() {}
24 
~ProtoImporterModule()25 ProtoImporterModule::~ProtoImporterModule() {}
26 
TokenizePacket(const protos::pbzero::TracePacket_Decoder &,TraceBlobView *,int64_t,PacketSequenceState *,uint32_t)27 ModuleResult ProtoImporterModule::TokenizePacket(
28     const protos::pbzero::TracePacket_Decoder&,
29     TraceBlobView* /*packet*/,
30     int64_t /*packet_timestamp*/,
31     PacketSequenceState*,
32     uint32_t /*field_id*/) {
33   return ModuleResult::Ignored();
34 }
35 
ParsePacket(const protos::pbzero::TracePacket_Decoder &,const TimestampedTracePiece &,uint32_t)36 void ProtoImporterModule::ParsePacket(
37     const protos::pbzero::TracePacket_Decoder&,
38     const TimestampedTracePiece&,
39     uint32_t /*field_id*/) {}
40 
ParseTraceConfig(const protos::pbzero::TraceConfig_Decoder &)41 void ProtoImporterModule::ParseTraceConfig(
42     const protos::pbzero::TraceConfig_Decoder&) {}
43 
RegisterForField(uint32_t field_id,TraceProcessorContext * context)44 void ProtoImporterModule::RegisterForField(uint32_t field_id,
45                                            TraceProcessorContext* context) {
46   if (context->modules_by_field.size() <= field_id) {
47     context->modules_by_field.resize(field_id + 1, nullptr);
48   }
49   PERFETTO_DCHECK(!context->modules_by_field[field_id]);
50   context->modules_by_field[field_id] = this;
51 }
52 
53 }  // namespace trace_processor
54 }  // namespace perfetto
55