I just fixed GURL::Replacements' Set*Str methods so that they take a StringPiece rather than a std::string& [1]. If you don't use the GURL API you can stop reading now.
Previously, you had to make sure that you pass a string object that outlives the Replacements object, so you couldn't pass a char* like this:
replacements.SetSchemeStr("http");
(because the char* would create a temporary std::string which would immediately go out of scope).
You had to do this:
std::string scheme("http");
replacements.SetSchemeStr(scheme);
Now that it accepts a StringPiece, you can safely pass a char* (e.g., a string literal). Or, if you need to pass a substring, you can make a StringPiece and pass that instead (avoiding a copy).
Note that you still need to ensure the std::string, char* or StringPiece remains in scope over the lifetime of the Replacements object. But you can now use a char* directly, so stop copying them into temporary string objects.
I have updated (I believe) every single caller to avoid doing the unnecessary conversion to a std::string [1]. So this is just a PSA to avoid creating new unnecessary conversions in the future.