Commit 49bc0d85 authored by Jeremy Roman's avatar Jeremy Roman Committed by Commit Bot

data_resource_helper: use String::FromUTF8 overload that takes base::StringPiece.

This avoids an unnecessary strlen (the length is already known) and would also fix
the result for any hypothetical resource that had a null character inside it, which
is legal (though it's somewhat doubtful that we have any such resource).

Change-Id: I2a75d1a058d6980076bdc33467fd1c50c7b19591
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1741290
Commit-Queue: Jeremy Roman <jbroman@chromium.org>
Commit-Queue: Gyuyoung Kim <gyuyoung@igalia.com>
Auto-Submit: Jeremy Roman <jbroman@chromium.org>
Reviewed-by: default avatarGyuyoung Kim <gyuyoung@igalia.com>
Cr-Commit-Position: refs/heads/master@{#685202}
parent 9f64ec44
...@@ -32,7 +32,7 @@ String UncompressResourceAsString(int resource_id) { ...@@ -32,7 +32,7 @@ String UncompressResourceAsString(int resource_id) {
ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
std::string uncompressed = bundle.DecompressDataResourceScaled( std::string uncompressed = bundle.DecompressDataResourceScaled(
resource_id, bundle.GetMaxScaleFactor()); resource_id, bundle.GetMaxScaleFactor());
return String::FromUTF8(uncompressed.data()); return String::FromUTF8(uncompressed);
} }
Vector<char> UncompressResourceAsBinary(int resource_id) { Vector<char> UncompressResourceAsBinary(int resource_id) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment