/* * Copyright (C) 2020 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef SRC_TRACE_PROCESSOR_UTIL_GZIP_UTILS_H_ #define SRC_TRACE_PROCESSOR_UTIL_GZIP_UTILS_H_ #include <cstddef> #include <cstdint> #include <memory> #include <vector> struct z_stream_s; namespace perfetto { namespace trace_processor { namespace util { // Returns whether gzip related functioanlity is supported with the current // build flags. bool IsGzipSupported(); // Usage: To decompress in a streaming way, there are two ways of using it: // 1. [Commonly used] - Feed the sequence of mem-blocks in 'FeedAndExtract' one // by one. Output will be produced in given output_consumer, which is simply // a callback. On each 'FeedAndExtract', output_consumer could get invoked // any number of times, based on how much partial output is available. // 2. [Uncommon ; Discouraged] - Feed the sequence of mem-blocks one by one, by // calling 'Feed'. For each time 'Feed' is called, client should call // 'ExtractOutput' again and again to extrat the partially available output, // until there in no more output to extract. Also see 'ResultCode' enum. class GzipDecompressor { … }; } // namespace util } // namespace trace_processor } // namespace perfetto #endif // SRC_TRACE_PROCESSOR_UTIL_GZIP_UTILS_H_