Add MakeUnique from chromium and change StunMessage::AddAttribute to take a unique_ptr.
BUG=NONE
Review-Url: https://codereview.webrtc.org/2757893003
Cr-Commit-Position: refs/heads/master@{#17403}
diff --git a/webrtc/p2p/base/stunrequest.cc b/webrtc/p2p/base/stunrequest.cc
index ef2bee8..d3336fa 100644
--- a/webrtc/p2p/base/stunrequest.cc
+++ b/webrtc/p2p/base/stunrequest.cc
@@ -16,6 +16,7 @@
#include "webrtc/base/checks.h"
#include "webrtc/base/helpers.h"
#include "webrtc/base/logging.h"
+#include "webrtc/base/ptr_util.h"
#include "webrtc/base/stringencode.h"
namespace cricket {
@@ -189,8 +190,8 @@
void StunRequest::Construct() {
if (msg_->type() == 0) {
if (!origin_.empty()) {
- msg_->AddAttribute(new StunByteStringAttribute(STUN_ATTR_ORIGIN,
- origin_));
+ msg_->AddAttribute(
+ rtc::MakeUnique<StunByteStringAttribute>(STUN_ATTR_ORIGIN, origin_));
}
Prepare(msg_);
RTC_DCHECK(msg_->type() != 0);