chromium/third_party/perfetto/src/trace_processor/util/gzip_utils.cc

/*
 * 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.
 */

#include "src/trace_processor/util/gzip_utils.h"

#include <cstddef>
#include <cstdint>
#include <memory>
#include <vector>

#include "perfetto/base/build_config.h"

#if PERFETTO_BUILDFLAG(PERFETTO_ZLIB)
#include <zconf.h>
#include <zlib.h>
#else
struct z_stream_s {};
#endif

namespace perfetto::trace_processor::util {

bool IsGzipSupported() {}

#if PERFETTO_BUILDFLAG(PERFETTO_ZLIB)  // Real Implementation

GzipDecompressor::GzipDecompressor(InputMode mode)
    :{}

void GzipDecompressor::Reset() {}

void GzipDecompressor::Feed(const uint8_t* data, size_t size) {}

GzipDecompressor::Result GzipDecompressor::ExtractOutput(uint8_t* out,
                                                         size_t out_size) {}

size_t GzipDecompressor::AvailIn() const {}

void GzipDecompressor::Deleter::operator()(z_stream_s* stream) const {}

#else  // Dummy Implementation

GzipDecompressor::GzipDecompressor(InputMode) {}
void GzipDecompressor::Reset() {}
void GzipDecompressor::Feed(const uint8_t*, size_t) {}
GzipDecompressor::Result GzipDecompressor::ExtractOutput(uint8_t*, size_t) {
  return Result{ResultCode::kError, 0};
}
size_t GzipDecompressor::AvailIn() const {
  return 0;
}
void GzipDecompressor::Deleter::operator()(z_stream_s*) const {}

#endif  // PERFETTO_BUILDFLAG(PERFETTO_ZLIB)

// static
std::vector<uint8_t> GzipDecompressor::DecompressFully(const uint8_t* data,
                                                       size_t len) {}

}  // namespace perfetto::trace_processor::util