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 /remoting/jingle_glue | |
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 'remoting/jingle_glue')
-rw-r--r-- | remoting/jingle_glue/iq_sender_unittest.cc | 18 | ||||
-rw-r--r-- | remoting/jingle_glue/xmpp_signal_strategy.cc | 9 |
2 files changed, 14 insertions, 13 deletions
diff --git a/remoting/jingle_glue/iq_sender_unittest.cc b/remoting/jingle_glue/iq_sender_unittest.cc index b09f114..2876735 100644 --- a/remoting/jingle_glue/iq_sender_unittest.cc +++ b/remoting/jingle_glue/iq_sender_unittest.cc @@ -91,9 +91,9 @@ TEST_F(IqSenderTest, SendIq) { }); scoped_ptr<XmlElement> response(new XmlElement(buzz::QN_IQ)); - response->AddAttr(QName("", "type"), "result"); - response->AddAttr(QName("", "id"), kStanzaId); - response->AddAttr(QName("", "from"), kTo); + response->AddAttr(QName(std::string(), "type"), "result"); + response->AddAttr(QName(std::string(), "id"), kStanzaId); + response->AddAttr(QName(std::string(), "from"), kTo); XmlElement* result = new XmlElement( QName("test:namespace", "response-body")); @@ -123,9 +123,9 @@ TEST_F(IqSenderTest, InvalidFrom) { }); scoped_ptr<XmlElement> response(new XmlElement(buzz::QN_IQ)); - response->AddAttr(QName("", "type"), "result"); - response->AddAttr(QName("", "id"), kStanzaId); - response->AddAttr(QName("", "from"), "different_user@domain.com"); + response->AddAttr(QName(std::string(), "type"), "result"); + response->AddAttr(QName(std::string(), "id"), kStanzaId); + response->AddAttr(QName(std::string(), "from"), "different_user@domain.com"); XmlElement* result = new XmlElement( QName("test:namespace", "response-body")); @@ -143,9 +143,9 @@ TEST_F(IqSenderTest, IdMatchingHack) { }); scoped_ptr<XmlElement> response(new XmlElement(buzz::QN_IQ)); - response->AddAttr(QName("", "type"), "result"); - response->AddAttr(QName("", "id"), "DIFFERENT_ID"); - response->AddAttr(QName("", "from"), kTo); + response->AddAttr(QName(std::string(), "type"), "result"); + response->AddAttr(QName(std::string(), "id"), "DIFFERENT_ID"); + response->AddAttr(QName(std::string(), "from"), kTo); XmlElement* result = new XmlElement( QName("test:namespace", "response-body")); diff --git a/remoting/jingle_glue/xmpp_signal_strategy.cc b/remoting/jingle_glue/xmpp_signal_strategy.cc index 51bbade..88fc9f3 100644 --- a/remoting/jingle_glue/xmpp_signal_strategy.cc +++ b/remoting/jingle_glue/xmpp_signal_strategy.cc @@ -91,9 +91,10 @@ void XmppSignalStrategy::Connect() { task_runner_.reset(new jingle_glue::TaskPump()); xmpp_client_ = new buzz::XmppClient(task_runner_.get()); - xmpp_client_->Connect(settings, "", socket, CreatePreXmppAuth(settings)); - xmpp_client_->SignalStateChange.connect( - this, &XmppSignalStrategy::OnConnectionStateChanged); + xmpp_client_->Connect( + settings, std::string(), socket, CreatePreXmppAuth(settings)); + xmpp_client_->SignalStateChange + .connect(this, &XmppSignalStrategy::OnConnectionStateChanged); xmpp_client_->engine()->AddStanzaHandler(this, buzz::XmppEngine::HL_TYPE); xmpp_client_->Start(); @@ -156,7 +157,7 @@ std::string XmppSignalStrategy::GetNextId() { if (!xmpp_client_) { // If the connection has been terminated then it doesn't matter // what Id we return. - return ""; + return std::string(); } return xmpp_client_->NextId(); } |