Index: device/u2f/u2f_message.cc |
diff --git a/device/u2f/u2f_message.cc b/device/u2f/u2f_message.cc |
index 8cf2281ef24504e9ab54280a9c78550b066a0ca1..0778025470c93f8b487147c4d2c1f9b5ddc9885d 100644 |
--- a/device/u2f/u2f_message.cc |
+++ b/device/u2f/u2f_message.cc |
@@ -23,11 +23,9 @@ std::unique_ptr<U2fMessage> U2fMessage::Create( |
// static |
std::unique_ptr<U2fMessage> U2fMessage::CreateFromSerializedData( |
- scoped_refptr<net::IOBufferWithSize> buf) { |
+ const std::vector<uint8_t>& buf) { |
size_t remaining_size = 0; |
- if (buf == nullptr || |
- static_cast<size_t>(buf->size()) > U2fPacket::kPacketSize || |
- static_cast<size_t>(buf->size()) < kInitPacketHeader) |
+ if (buf.size() > U2fPacket::kPacketSize || buf.size() < kInitPacketHeader) |
return nullptr; |
std::unique_ptr<U2fInitPacket> init_packet = |
@@ -95,16 +93,16 @@ std::list<std::unique_ptr<U2fPacket>>::const_iterator U2fMessage::end() { |
scoped_refptr<net::IOBufferWithSize> U2fMessage::PopNextPacket() { |
if (NumPackets() > 0) { |
- scoped_refptr<net::IOBufferWithSize> buf = |
- packets_.front()->GetSerializedBuffer(); |
+ scoped_refptr<net::IOBufferWithSize> data = |
+ packets_.front()->GetSerializedData(); |
+ |
packets_.pop_front(); |
- return buf; |
+ return data; |
} |
return nullptr; |
} |
-bool U2fMessage::AddContinuationPacket( |
- scoped_refptr<net::IOBufferWithSize> buf) { |
+bool U2fMessage::AddContinuationPacket(const std::vector<uint8_t>& buf) { |
size_t remaining_size = remaining_size_; |
std::unique_ptr<U2fContinuationPacket> cont_packet = |
U2fContinuationPacket::CreateFromSerializedData(buf, &remaining_size); |