Commit 2763b961 authored by Istiaque Ahmed's avatar Istiaque Ahmed Committed by Commit Bot

Extensions: Reduce two string copies in IsBackgroundPageURL().

We can do this without any string copy, so use StringPiece
variant from GURL.

This is interesting because every extension resource fetch goes
through this method.

Bug: None
Change-Id: Ief332c09295b1087f64721e44f026eccc4a49497
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1631938Reviewed-by: default avatarDevlin <rdevlin.cronin@chromium.org>
Commit-Queue: Istiaque Ahmed <lazyboy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#664028}
parent 51415e41
...@@ -521,8 +521,9 @@ void GetSecurityPolicyForURL(const GURL& url, ...@@ -521,8 +521,9 @@ void GetSecurityPolicyForURL(const GURL& url,
} }
bool IsBackgroundPageURL(const GURL& url) { bool IsBackgroundPageURL(const GURL& url) {
std::string path = url.path(); base::StringPiece path_piece = url.path_piece();
return path.size() > 1 && path.substr(1) == kGeneratedBackgroundPageFilename; return path_piece.size() > 1 &&
path_piece.substr(1) == kGeneratedBackgroundPageFilename;
} }
class ExtensionProtocolHandler class ExtensionProtocolHandler
......
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