diff options
author | dcheng@chromium.org <dcheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-09 05:45:17 +0000 |
---|---|---|
committer | dcheng@chromium.org <dcheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-09 05:45:17 +0000 |
commit | e59558b78e8c6a1b0bd916a724724b638c3c91b6 (patch) | |
tree | 712268a7e9e1cd552f309d89641b2bed5ad06322 /jingle/notifier | |
parent | 31fcd34da3797bc49160620ef8c94a38652c0587 (diff) | |
download | chromium_src-e59558b78e8c6a1b0bd916a724724b638c3c91b6.zip chromium_src-e59558b78e8c6a1b0bd916a724724b638c3c91b6.tar.gz chromium_src-e59558b78e8c6a1b0bd916a724724b638c3c91b6.tar.bz2 |
Rewrite std::string("") to std::string(), Linux edition.
This patch was generated by running the empty_string clang tool
across the Chromium Linux compilation database. Implicitly or
explicitly constructing std::string() with a "" argument is
inefficient as the caller needs to emit extra instructions to
pass an argument, and the constructor needlessly copies a byte
into internal storage. Rewriting these instances to simply call
the default constructor appears to save ~14-18 kilobytes on an
optimized release build.
BUG=none
Review URL: https://codereview.chromium.org/13145003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@193020 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'jingle/notifier')
-rw-r--r-- | jingle/notifier/base/gaia_token_pre_xmpp_auth.cc | 7 | ||||
-rw-r--r-- | jingle/notifier/communicator/single_login_attempt.cc | 6 | ||||
-rw-r--r-- | jingle/notifier/communicator/single_login_attempt_unittest.cc | 6 |
3 files changed, 10 insertions, 9 deletions
diff --git a/jingle/notifier/base/gaia_token_pre_xmpp_auth.cc b/jingle/notifier/base/gaia_token_pre_xmpp_auth.cc index 24aa6a9..f7ddf8d 100644 --- a/jingle/notifier/base/gaia_token_pre_xmpp_auth.cc +++ b/jingle/notifier/base/gaia_token_pre_xmpp_auth.cc @@ -101,9 +101,10 @@ std::string GaiaTokenPreXmppAuth::GetAuthMechanism() const { std::string GaiaTokenPreXmppAuth::ChooseBestSaslMechanism( const std::vector<std::string> & mechanisms, bool encrypted) { - return (std::find(mechanisms.begin(), - mechanisms.end(), auth_mechanism_) != - mechanisms.end()) ? auth_mechanism_ : ""; + return (std::find(mechanisms.begin(), mechanisms.end(), auth_mechanism_) != + mechanisms.end()) + ? auth_mechanism_ + : std::string(); } buzz::SaslMechanism* GaiaTokenPreXmppAuth::CreateSaslMechanism( diff --git a/jingle/notifier/communicator/single_login_attempt.cc b/jingle/notifier/communicator/single_login_attempt.cc index dda0cfe..49fcdee 100644 --- a/jingle/notifier/communicator/single_login_attempt.cc +++ b/jingle/notifier/communicator/single_login_attempt.cc @@ -85,9 +85,9 @@ net::HostPortPair ParseRedirectText(const std::string& redirect_text) { void SingleLoginAttempt::OnError(buzz::XmppEngine::Error error, int subcode, const buzz::XmlElement* stream_error) { DVLOG(1) << "Error: " << error << ", subcode: " << subcode - << (stream_error ? - (", stream error: " + XmlElementToString(*stream_error)) : - ""); + << (stream_error + ? (", stream error: " + XmlElementToString(*stream_error)) + : std::string()); DCHECK_EQ(error == buzz::XmppEngine::ERROR_STREAM, stream_error != NULL); diff --git a/jingle/notifier/communicator/single_login_attempt_unittest.cc b/jingle/notifier/communicator/single_login_attempt_unittest.cc index 582b808..4d009c2 100644 --- a/jingle/notifier/communicator/single_login_attempt_unittest.cc +++ b/jingle/notifier/communicator/single_login_attempt_unittest.cc @@ -219,7 +219,7 @@ TEST_F(SingleLoginAttemptTest, RedirectInvalidPort) { // Fire an empty redirect and make sure the delegate does not get a // redirect. TEST_F(SingleLoginAttemptTest, RedirectEmpty) { - scoped_ptr<buzz::XmlElement> redirect_error(MakeRedirectError("")); + scoped_ptr<buzz::XmlElement> redirect_error(MakeRedirectError(std::string())); FireRedirect(redirect_error.get()); EXPECT_EQ(IDLE, fake_delegate_.state()); } @@ -227,7 +227,7 @@ TEST_F(SingleLoginAttemptTest, RedirectEmpty) { // Fire a redirect with a missing text element and make sure the // delegate does not get a redirect. TEST_F(SingleLoginAttemptTest, RedirectMissingText) { - scoped_ptr<buzz::XmlElement> redirect_error(MakeRedirectError("")); + scoped_ptr<buzz::XmlElement> redirect_error(MakeRedirectError(std::string())); redirect_error->RemoveChildAfter(redirect_error->FirstChild()); FireRedirect(redirect_error.get()); EXPECT_EQ(IDLE, fake_delegate_.state()); @@ -236,7 +236,7 @@ TEST_F(SingleLoginAttemptTest, RedirectMissingText) { // Fire a redirect with a missing see-other-host element and make sure // the delegate does not get a redirect. TEST_F(SingleLoginAttemptTest, RedirectMissingSeeOtherHost) { - scoped_ptr<buzz::XmlElement> redirect_error(MakeRedirectError("")); + scoped_ptr<buzz::XmlElement> redirect_error(MakeRedirectError(std::string())); redirect_error->RemoveChildAfter(NULL); FireRedirect(redirect_error.get()); EXPECT_EQ(IDLE, fake_delegate_.state()); |