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

Unified Diff: remoting/protocol/fake_datagram_socket.cc

Issue 1197853003: Add P2PDatagramSocket and P2PStreamSocket interfaces. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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 | « remoting/protocol/fake_datagram_socket.h ('k') | remoting/protocol/fake_stream_socket.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/fake_datagram_socket.cc
diff --git a/remoting/protocol/fake_datagram_socket.cc b/remoting/protocol/fake_datagram_socket.cc
index 9bd4ede48b336e0356aebfa8b7342676f68dd1cc..53d31d098276420b140092c0add0c4a22a479eaa 100644
--- a/remoting/protocol/fake_datagram_socket.cc
+++ b/remoting/protocol/fake_datagram_socket.cc
@@ -51,7 +51,8 @@ base::WeakPtr<FakeDatagramSocket> FakeDatagramSocket::GetWeakPtr() {
return weak_factory_.GetWeakPtr();
}
-int FakeDatagramSocket::Read(net::IOBuffer* buf, int buf_len,
+int FakeDatagramSocket::Recv(const scoped_refptr<net::IOBuffer>& buf,
+ int buf_len,
const net::CompletionCallback& callback) {
EXPECT_TRUE(task_runner_->BelongsToCurrentThread());
if (input_pos_ < static_cast<int>(input_packets_.size())) {
@@ -64,8 +65,9 @@ int FakeDatagramSocket::Read(net::IOBuffer* buf, int buf_len,
}
}
-int FakeDatagramSocket::Write(net::IOBuffer* buf, int buf_len,
- const net::CompletionCallback& callback) {
+int FakeDatagramSocket::Send(const scoped_refptr<net::IOBuffer>& buf,
+ int buf_len,
+ const net::CompletionCallback& callback) {
EXPECT_TRUE(task_runner_->BelongsToCurrentThread());
written_packets_.push_back(std::string());
written_packets_.back().assign(buf->data(), buf->data() + buf_len);
@@ -73,25 +75,15 @@ int FakeDatagramSocket::Write(net::IOBuffer* buf, int buf_len,
if (peer_socket_.get()) {
task_runner_->PostTask(
FROM_HERE,
- base::Bind(&FakeDatagramSocket::AppendInputPacket,
- peer_socket_,
+ base::Bind(&FakeDatagramSocket::AppendInputPacket, peer_socket_,
std::string(buf->data(), buf->data() + buf_len)));
}
return buf_len;
}
-int FakeDatagramSocket::SetReceiveBufferSize(int32 size) {
- NOTIMPLEMENTED();
- return net::ERR_NOT_IMPLEMENTED;
-}
-
-int FakeDatagramSocket::SetSendBufferSize(int32 size) {
- NOTIMPLEMENTED();
- return net::ERR_NOT_IMPLEMENTED;
-}
-
-int FakeDatagramSocket::CopyReadData(net::IOBuffer* buf, int buf_len) {
+int FakeDatagramSocket::CopyReadData(const scoped_refptr<net::IOBuffer>& buf,
+ int buf_len) {
int size = std::min(
buf_len, static_cast<int>(input_packets_[input_pos_].size()));
memcpy(buf->data(), &(*input_packets_[input_pos_].begin()), size);
« no previous file with comments | « remoting/protocol/fake_datagram_socket.h ('k') | remoting/protocol/fake_stream_socket.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698