• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2023 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_TRACE_PROCESSOR_IMPORTERS_PROTO_WINSCOPE_WINSCOPE_MODULE_H_
18 #define SRC_TRACE_PROCESSOR_IMPORTERS_PROTO_WINSCOPE_WINSCOPE_MODULE_H_
19 
20 #include <cstdint>
21 #include "perfetto/base/build_config.h"
22 #include "src/trace_processor/importers/common/parser_types.h"
23 #include "src/trace_processor/importers/proto/proto_importer_module.h"
24 #include "src/trace_processor/importers/proto/winscope/android_input_event_parser.h"
25 #include "src/trace_processor/importers/proto/winscope/protolog_parser.h"
26 #include "src/trace_processor/importers/proto/winscope/shell_transitions_parser.h"
27 #include "src/trace_processor/importers/proto/winscope/surfaceflinger_layers_parser.h"
28 #include "src/trace_processor/importers/proto/winscope/surfaceflinger_transactions_parser.h"
29 #include "src/trace_processor/importers/proto/winscope/viewcapture_parser.h"
30 
31 #include "protos/perfetto/trace/trace_packet.pbzero.h"
32 
33 namespace perfetto {
34 namespace trace_processor {
35 
36 class WinscopeModule : public ProtoImporterModule {
37  public:
38   explicit WinscopeModule(TraceProcessorContext* context);
39 
40   ModuleResult TokenizePacket(
41     const protos::pbzero::TracePacket::Decoder& decoder,
42     TraceBlobView* packet,
43     int64_t packet_timestamp,
44     RefPtr<PacketSequenceStateGeneration> state,
45     uint32_t field_id) override;
46 
47   void ParseTracePacketData(const protos::pbzero::TracePacket::Decoder&,
48                             int64_t ts,
49                             const TracePacketData&,
50                             uint32_t field_id) override;
51 
52  private:
53   void ParseWinscopeExtensionsData(protozero::ConstBytes blob,
54                                    int64_t timestamp,
55                                    const TracePacketData&);
56   void ParseInputMethodClientsData(int64_t timestamp,
57                                    protozero::ConstBytes blob);
58   void ParseInputMethodManagerServiceData(int64_t timestamp,
59                                           protozero::ConstBytes blob);
60   void ParseInputMethodServiceData(int64_t timestamp,
61                                    protozero::ConstBytes blob);
62   void ParseWindowManagerData(int64_t timestamp, protozero::ConstBytes blob);
63 
64   TraceProcessorContext* const context_;
65   util::ProtoToArgsParser args_parser_;
66 
67   SurfaceFlingerLayersParser surfaceflinger_layers_parser_;
68   SurfaceFlingerTransactionsParser surfaceflinger_transactions_parser_;
69   ShellTransitionsParser shell_transitions_parser_;
70   ProtoLogParser protolog_parser_;
71   AndroidInputEventParser android_input_event_parser_;
72   ViewCaptureParser viewcapture_parser_;
73 };
74 
75 }  // namespace trace_processor
76 }  // namespace perfetto
77 
78 #endif  // SRC_TRACE_PROCESSOR_IMPORTERS_PROTO_WINSCOPE_WINSCOPE_MODULE_H_
79