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

Unified Diff: webrtc/p2p/base/stunserver.cc

Issue 2757893003: Add MakeUnique from chromium and change StunMessage::AddAttribute to take a unique_ptr. (Closed)
Patch Set: add ptr_util.h to rtc_base_approved build target Created 3 years, 9 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
« no previous file with comments | « webrtc/p2p/base/stunrequest.cc ('k') | webrtc/p2p/base/turnport.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/p2p/base/stunserver.cc
diff --git a/webrtc/p2p/base/stunserver.cc b/webrtc/p2p/base/stunserver.cc
index bac9fd596b4f06323937748d6ad3eb8e967b4487..532add792fd98fb16bb93ad01407f39e96262696 100644
--- a/webrtc/p2p/base/stunserver.cc
+++ b/webrtc/p2p/base/stunserver.cc
@@ -62,10 +62,10 @@ void StunServer::SendErrorResponse(
err_msg.SetType(GetStunErrorResponseType(msg.type()));
err_msg.SetTransactionID(msg.transaction_id());
- StunErrorCodeAttribute* err_code = StunAttribute::CreateErrorCode();
+ auto err_code = StunAttribute::CreateErrorCode();
err_code->SetCode(error_code);
err_code->SetReason(error_desc);
- err_msg.AddAttribute(err_code);
+ err_msg.AddAttribute(std::move(err_code));
SendResponse(err_msg, addr);
}
@@ -86,14 +86,14 @@ void StunServer::GetStunBindReqponse(StunMessage* request,
response->SetTransactionID(request->transaction_id());
// Tell the user the address that we received their request from.
- StunAddressAttribute* mapped_addr;
+ std::unique_ptr<StunAddressAttribute> mapped_addr;
if (!request->IsLegacy()) {
mapped_addr = StunAttribute::CreateAddress(STUN_ATTR_MAPPED_ADDRESS);
} else {
mapped_addr = StunAttribute::CreateXorAddress(STUN_ATTR_XOR_MAPPED_ADDRESS);
}
mapped_addr->SetAddress(remote_addr);
- response->AddAttribute(mapped_addr);
+ response->AddAttribute(std::move(mapped_addr));
}
} // namespace cricket
« no previous file with comments | « webrtc/p2p/base/stunrequest.cc ('k') | webrtc/p2p/base/turnport.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698