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_SHELL_TRANSITIONS_TRACKER_H_ 18 #define SRC_TRACE_PROCESSOR_IMPORTERS_PROTO_WINSCOPE_SHELL_TRANSITIONS_TRACKER_H_ 19 20 #include "perfetto/trace_processor/basic_types.h" 21 #include "src/trace_processor/storage/trace_storage.h" 22 #include "src/trace_processor/types/trace_processor_context.h" 23 #include "src/trace_processor/util/winscope_proto_mapping.h" 24 25 namespace perfetto { 26 namespace trace_processor { 27 28 // Tracks information in the transition table. 29 class ShellTransitionsTracker : public Destructible { 30 public: 31 explicit ShellTransitionsTracker(TraceProcessorContext*); 32 virtual ~ShellTransitionsTracker() override; 33 GetOrCreate(TraceProcessorContext * context)34 static ShellTransitionsTracker* GetOrCreate(TraceProcessorContext* context) { 35 if (!context->shell_transitions_tracker) { 36 context->shell_transitions_tracker.reset( 37 new ShellTransitionsTracker(context)); 38 } 39 return static_cast<ShellTransitionsTracker*>( 40 context->shell_transitions_tracker.get()); 41 } 42 43 tables::WindowManagerShellTransitionsTable::Id InternTransition( 44 int32_t transition_id); 45 46 private: 47 TraceProcessorContext* context_; 48 std::unordered_map<int32_t, tables::WindowManagerShellTransitionsTable::Id> 49 transition_id_to_row_mapping_; 50 }; 51 52 } // namespace trace_processor 53 } // namespace perfetto 54 55 #endif // SRC_TRACE_PROCESSOR_IMPORTERS_PROTO_WINSCOPE_SHELL_TRANSITIONS_TRACKER_H_ 56