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

Unified Diff: device/u2f/u2f_packet.cc

Issue 2766723003: Use unique pointers for U2fPacket and U2fMessage (Closed)
Patch Set: Change fuzzer to use the new unique_ptr constructor 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 | « device/u2f/u2f_packet.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/u2f/u2f_packet.cc
diff --git a/device/u2f/u2f_packet.cc b/device/u2f/u2f_packet.cc
index 4c15765ed72d86e89684cc7b49113f98b42c3c97..76dbefb57301d30f877b7afbb480a24c3ff7b054 100644
--- a/device/u2f/u2f_packet.cc
+++ b/device/u2f/u2f_packet.cc
@@ -2,9 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "device/u2f/u2f_packet.h"
+#include "base/memory/ptr_util.h"
#include "net/base/io_buffer.h"
+#include "u2f_packet.h"
+
namespace device {
U2fPacket::U2fPacket(const std::vector<uint8_t> data, const uint32_t channel_id)
@@ -58,13 +60,13 @@ U2fInitPacket::U2fInitPacket(const uint32_t channel_id,
}
// static
-scoped_refptr<U2fInitPacket> U2fInitPacket::CreateFromSerializedData(
+std::unique_ptr<U2fInitPacket> U2fInitPacket::CreateFromSerializedData(
scoped_refptr<net::IOBufferWithSize> buf,
size_t* remaining_size) {
if (buf == nullptr || remaining_size == nullptr || buf->size() != kPacketSize)
return nullptr;
- return make_scoped_refptr(new U2fInitPacket(buf, remaining_size));
+ return base::MakeUnique<U2fInitPacket>(buf, remaining_size);
}
U2fInitPacket::U2fInitPacket(scoped_refptr<net::IOBufferWithSize> buf,
@@ -127,14 +129,14 @@ U2fContinuationPacket::U2fContinuationPacket(const uint32_t channel_id,
}
// static
-scoped_refptr<U2fContinuationPacket>
+std::unique_ptr<U2fContinuationPacket>
U2fContinuationPacket::CreateFromSerializedData(
scoped_refptr<net::IOBufferWithSize> buf,
size_t* remaining_size) {
if (buf == nullptr || remaining_size == nullptr || buf->size() != kPacketSize)
return nullptr;
- return make_scoped_refptr(new U2fContinuationPacket(buf, remaining_size));
+ return base::MakeUnique<U2fContinuationPacket>(buf, remaining_size);
}
U2fContinuationPacket::U2fContinuationPacket(
@@ -163,4 +165,5 @@ U2fContinuationPacket::U2fContinuationPacket(
}
U2fContinuationPacket::~U2fContinuationPacket() {}
+
} // namespace device
« no previous file with comments | « device/u2f/u2f_packet.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698