Commit 8c23e548 authored by Scott Violet's avatar Scott Violet Committed by Commit Bot

error_page_populator: minor optimization

This code should do nothing if error_html is null. This moves
the check earlier.

BUG=none
TEST=none

Change-Id: I568c5ece3c2e1aca23e91480918ce1a35a07fa55
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2324654
Commit-Queue: Scott Violet <sky@chromium.org>
Commit-Queue: Bo <boliu@chromium.org>
Auto-Submit: Scott Violet <sky@chromium.org>
Reviewed-by: default avatarBo <boliu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#792463}
parent f19bd07b
...@@ -26,15 +26,15 @@ constexpr char kThrottledErrorDescription[] = ...@@ -26,15 +26,15 @@ constexpr char kThrottledErrorDescription[] =
void PopulateErrorPageHtml(const blink::WebURLError& error, void PopulateErrorPageHtml(const blink::WebURLError& error,
std::string* error_html) { std::string* error_html) {
if (!error_html)
return;
std::string err; std::string err;
if (error.reason() == net::ERR_TEMPORARILY_THROTTLED) if (error.reason() == net::ERR_TEMPORARILY_THROTTLED)
err = kThrottledErrorDescription; err = kThrottledErrorDescription;
else else
err = net::ErrorToString(error.reason()); err = net::ErrorToString(error.reason());
if (!error_html)
return;
// Create the error page based on the error reason. // Create the error page based on the error reason.
GURL gurl(error.url()); GURL gurl(error.url());
std::string url_string = gurl.possibly_invalid_spec(); std::string url_string = gurl.possibly_invalid_spec();
......
...@@ -14,7 +14,7 @@ struct WebURLError; ...@@ -14,7 +14,7 @@ struct WebURLError;
namespace android_system_error_page { namespace android_system_error_page {
// Populates |error_html| to display an error page with an Android system feel // Populates |error_html| to display an error page with an Android system feel
// for |error|. // for |error|. Does nothing if |error_html| is null.
void PopulateErrorPageHtml(const blink::WebURLError& error, void PopulateErrorPageHtml(const blink::WebURLError& error,
std::string* error_html); std::string* error_html);
......
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