Commit 87d9c99c authored by Jeremy Roman's avatar Jeremy Roman Committed by Chromium LUCI CQ

safe_browsing: Replace a long series of string appends with a single base::StrCat.

This will do a single allocation of the right size.

Bug: None
Change-Id: I777f61ff740f5d375c8aa461431f92dee1fbb6f4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2570412
Auto-Submit: Jeremy Roman <jbroman@chromium.org>
Commit-Queue: Daniel Rubery <drubery@chromium.org>
Reviewed-by: default avatarDaniel Rubery <drubery@chromium.org>
Cr-Commit-Position: refs/heads/master@{#834338}
parent 0a97797f
......@@ -9,6 +9,7 @@
#include "base/bind.h"
#include "base/memory/scoped_refptr.h"
#include "base/metrics/histogram_functions.h"
#include "base/strings/strcat.h"
#include "base/time/time.h"
#include "components/safe_browsing/core/features.h"
#include "content/public/browser/browser_task_traits.h"
......@@ -75,9 +76,9 @@ void MultipartUploadRequest::Start() {
std::string MultipartUploadRequest::GenerateRequestBody(
const std::string& metadata,
const std::string& data) {
return "--" + boundary_ + "\r\n" + kDataContentType + "\r\n\r\n" + metadata +
"\r\n--" + boundary_ + "\r\n" + kDataContentType + "\r\n\r\n" + data +
"\r\n--" + boundary_ + "--\r\n";
return base::StrCat({"--", boundary_, "\r\n", kDataContentType, "\r\n\r\n",
metadata, "\r\n--", boundary_, "\r\n", kDataContentType,
"\r\n\r\n", data, "\r\n--", boundary_, "--\r\n"});
}
void MultipartUploadRequest::SendRequest() {
......
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