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