summaryrefslogtreecommitdiff
path: root/google/compression_utils.h
diff options
context:
space:
mode:
authorSamuel Huang <huangs@chromium.org>2019-05-14 22:29:14 +0000
committerCommit Bot <commit-bot@chromium.org>2019-05-14 22:29:14 +0000
commit6b6e20f61377df3a532d95087f9fc1324650974b (patch)
tree111421b6399fd3cd2743ce1ebe4deff2afcd8686 /google/compression_utils.h
parent8f2b9d41fbd341ab8ceaa726fb544bd72afd9b82 (diff)
downloadzlib-6b6e20f61377df3a532d95087f9fc1324650974b.tar.gz
[DOM Distiller] Compress resources to save 86 kB on Android.
This CL compresses DOM distiller's resources, which reduces Chrome's binary size by 86 kB on Android. Details: * Add compress="gzip" to all dom_distiller_resoruces.grdp items. * Add resource_utils.* with GetResrouceFromIdAsString() to centralize ui::ResourceBundle() usage, and perform uncompression. * Ensure that all IDR_* usage go through GetResourceFromIdAsString(). * Exception: WebUI (for chrome://dom-distiller), which uses content::WebUIDataSource, so decompression is already handled. Also update third_party/zlib: * Add GzipUncompress(base::StringPiece, std::string*), which allocates the output string (used by GetResrouceFromIdAsString()). * Add CompressionUtilsTest::GzipUncompressionFromStringPieceToString. Bug: 872559, 961866 Change-Id: I54f7f80bd3b90e9e0226901295043a25e714a938 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1606245 Commit-Queue: Samuel Huang <huangs@chromium.org> Reviewed-by: Alexei Svitkine <asvitkine@chromium.org> Reviewed-by: Wei-Yin Chen (陳威尹) <wychen@chromium.org> Reviewed-by: Samuel Huang <huangs@chromium.org> Cr-Original-Commit-Position: refs/heads/master@{#659695} Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src Cr-Mirrored-Commit: 400f6e823a75b4b8fada6e270071da8082527dc2
Diffstat (limited to 'google/compression_utils.h')
-rw-r--r--google/compression_utils.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/google/compression_utils.h b/google/compression_utils.h
index fe741d0..5162207 100644
--- a/google/compression_utils.h
+++ b/google/compression_utils.h
@@ -42,6 +42,12 @@ bool GzipUncompress(const std::string& input, std::string* output);
// Returns true for success.
bool GzipUncompress(base::StringPiece input, base::StringPiece output);
+// Uncompresses the data in |input| using gzip, and writes the results to
+// |output|, which must NOT be the underlying string of |input|, and is resized
+// if necessary.
+// Returns true for success.
+bool GzipUncompress(base::StringPiece input, std::string* output);
+
// Returns the uncompressed size from GZIP-compressed |compressed_data|.
uint32_t GetUncompressedSize(base::StringPiece compressed_data);