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 "perfetto/base/export.h" 18 #include "perfetto/tracing/track_event_interned_data_index.h" 19 20 #ifndef INCLUDE_PERFETTO_TRACING_INTERNAL_TRACK_EVENT_INTERNED_FIELDS_H_ 21 #define INCLUDE_PERFETTO_TRACING_INTERNAL_TRACK_EVENT_INTERNED_FIELDS_H_ 22 23 namespace perfetto { 24 namespace internal { 25 26 // These helpers are exposed here to allow Chromium-without-client library 27 // to share the interning buffers with Perfetto internals (e.g. 28 // perfetto::TracedValue implementation). 29 30 struct PERFETTO_EXPORT InternedEventCategory 31 : public TrackEventInternedDataIndex< 32 InternedEventCategory, 33 perfetto::protos::pbzero::InternedData::kEventCategoriesFieldNumber, 34 const char*, 35 SmallInternedDataTraits> { 36 ~InternedEventCategory() override; 37 38 static void Add(protos::pbzero::InternedData* interned_data, 39 size_t iid, 40 const char* value, 41 size_t length); 42 }; 43 44 struct PERFETTO_EXPORT InternedEventName 45 : public TrackEventInternedDataIndex< 46 InternedEventName, 47 perfetto::protos::pbzero::InternedData::kEventNamesFieldNumber, 48 const char*, 49 SmallInternedDataTraits> { 50 ~InternedEventName() override; 51 52 static void Add(protos::pbzero::InternedData* interned_data, 53 size_t iid, 54 const char* value); 55 }; 56 57 struct PERFETTO_EXPORT InternedDebugAnnotationName 58 : public TrackEventInternedDataIndex< 59 InternedDebugAnnotationName, 60 perfetto::protos::pbzero::InternedData:: 61 kDebugAnnotationNamesFieldNumber, 62 const char*, 63 SmallInternedDataTraits> { 64 ~InternedDebugAnnotationName() override; 65 66 static void Add(protos::pbzero::InternedData* interned_data, 67 size_t iid, 68 const char* value); 69 }; 70 71 } // namespace internal 72 } // namespace perfetto 73 74 #endif // INCLUDE_PERFETTO_TRACING_INTERNAL_TRACK_EVENT_INTERNED_FIELDS_H_ 75