Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(112)

Unified Diff: net/base/registry_controlled_domains/registry_controlled_domain.h

Issue 2380523004: Avoid unnecessary std::string allocations. (Closed)
Patch Set: Correct comment. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/base/registry_controlled_domains/registry_controlled_domain.h
diff --git a/net/base/registry_controlled_domains/registry_controlled_domain.h b/net/base/registry_controlled_domains/registry_controlled_domain.h
index 24ffb707a50ab5fd44e7b7f86427a9dfd0bff8b6..89aa6d6c18bc351d26a862a8f8fa79ef70aa325f 100644
--- a/net/base/registry_controlled_domains/registry_controlled_domain.h
+++ b/net/base/registry_controlled_domains/registry_controlled_domain.h
@@ -182,6 +182,14 @@ enum UnknownRegistryFilter {
NET_EXPORT std::string GetDomainAndRegistry(const GURL& gurl,
PrivateRegistryFilter filter);
+// Same as above, but returns the domain and registry as a StringPiece that
+// references the underlying string of the passed-in |gurl|.
+// TODO(pkalinnikov): Rename this to GetDomainAndRegistry and get rid of the
+// std::string-returning version. Update clients.
+NET_EXPORT base::StringPiece GetDomainAndRegistryAsStringPiece(
+ const GURL& gurl,
+ PrivateRegistryFilter filter);
+
// Like the GURL version, but takes a host (which is canonicalized internally)
// instead of a full GURL.
NET_EXPORT std::string GetDomainAndRegistry(base::StringPiece host,

Powered by Google App Engine
This is Rietveld 408576698