xref: /aosp_15_r20/external/cronet/components/metrics/log_decoder.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2017 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef COMPONENTS_METRICS_LOG_DECODER_H_
6 #define COMPONENTS_METRICS_LOG_DECODER_H_
7 
8 #include <string>
9 
10 namespace google {
11 namespace protobuf {
12 
13 class MessageLite;
14 
15 }  // namespace protobuf
16 }  // namespace google
17 
18 namespace metrics {
19 
20 // Other modules can call this function instead of directly calling gzip. This
21 // prevents other modules from having to depend on zlib, or being aware of
22 // metrics' use of gzip compression, which is a metrics implementation detail.
23 // Returns true on success, false on failure.
24 bool DecodeLogData(const std::string& compressed_log_data,
25                    std::string* log_data);
26 
27 // Decodes |compressed_log_data| and populates |proto| with the decompressed log
28 // data. Returns true on success and false on failure.
29 bool DecodeLogDataToProto(const std::string& compressed_log_data,
30                           google::protobuf::MessageLite* proto);
31 
32 }  // namespace metrics
33 
34 #endif  // COMPONENTS_METRICS_LOG_DECODER_H_
35