chore: pass base::StringPiece args by value (#19432)

https://cs.chromium.org/chromium/src/base/strings/string_piece.h?l=14
discusses this, saying "Prefer passing StringPieces by value" because
"[p]assing by value generates slightly smaller code."
This commit is contained in:
Charles Kerr 2019-07-25 10:19:04 -05:00 committed by GitHub
parent 539078f281
commit f6fb877de9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 46 additions and 54 deletions

View file

@ -40,8 +40,7 @@ class WebContentsPreferences
void SetDefaults();
// A simple way to know whether a Boolean property is enabled.
bool IsEnabled(const base::StringPiece& name,
bool default_value = false) const;
bool IsEnabled(base::StringPiece name, bool default_value = false) const;
// $.extend(|web_preferences|, |new_web_preferences|).
void Merge(const base::DictionaryValue& new_web_preferences);
@ -57,7 +56,7 @@ class WebContentsPreferences
void Clear();
// Return true if the particular preference value exists.
bool GetPreference(const base::StringPiece& name, std::string* value) const;
bool GetPreference(base::StringPiece name, std::string* value) const;
// Whether to enable the remote module
bool IsRemoteModuleEnabled() const;
@ -77,10 +76,10 @@ class WebContentsPreferences
static content::WebContents* GetWebContentsFromProcessID(int process_id);
// Set preference value to given bool if user did not provide value
bool SetDefaultBoolIfUndefined(const base::StringPiece& key, bool val);
bool SetDefaultBoolIfUndefined(base::StringPiece key, bool val);
// Set preference value to given bool
void SetBool(const base::StringPiece& key, bool value);
void SetBool(base::StringPiece key, bool value);
static std::vector<WebContentsPreferences*> instances_;