| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "remoting/protocol/fake_session.h" | 5 #include "remoting/protocol/fake_session.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "net/base/address_list.h" | 9 #include "net/base/address_list.h" |
| 10 #include "net/base/io_buffer.h" | 10 #include "net/base/io_buffer.h" |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 const net::CompletionCallback& callback) { | 112 const net::CompletionCallback& callback) { |
| 113 write_pending_ = false; | 113 write_pending_ = false; |
| 114 | 114 |
| 115 if (next_write_error_ != net::OK) { | 115 if (next_write_error_ != net::OK) { |
| 116 int r = next_write_error_; | 116 int r = next_write_error_; |
| 117 next_write_error_ = net::OK; | 117 next_write_error_ = net::OK; |
| 118 callback.Run(r); | 118 callback.Run(r); |
| 119 return; | 119 return; |
| 120 } | 120 } |
| 121 | 121 |
| 122 DoWrite(buf, buf_len); | 122 DoWrite(buf.get(), buf_len); |
| 123 callback.Run(buf_len); | 123 callback.Run(buf_len); |
| 124 } | 124 } |
| 125 | 125 |
| 126 void FakeSocket::DoWrite(net::IOBuffer* buf, int buf_len) { | 126 void FakeSocket::DoWrite(net::IOBuffer* buf, int buf_len) { |
| 127 written_data_.insert(written_data_.end(), | 127 written_data_.insert(written_data_.end(), |
| 128 buf->data(), buf->data() + buf_len); | 128 buf->data(), buf->data() + buf_len); |
| 129 | 129 |
| 130 if (peer_socket_) { | 130 if (peer_socket_) { |
| 131 message_loop_->PostTask(FROM_HERE, base::Bind( | 131 message_loop_->PostTask(FROM_HERE, base::Bind( |
| 132 &FakeSocket::AppendInputData, peer_socket_, | 132 &FakeSocket::AppendInputData, peer_socket_, |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 callback.Run(scoped_ptr<net::Socket>(datagram_channels_[name])); | 380 callback.Run(scoped_ptr<net::Socket>(datagram_channels_[name])); |
| 381 } | 381 } |
| 382 | 382 |
| 383 void FakeSession::CancelChannelCreation(const std::string& name) { | 383 void FakeSession::CancelChannelCreation(const std::string& name) { |
| 384 stream_channels_.erase(name); | 384 stream_channels_.erase(name); |
| 385 datagram_channels_.erase(name); | 385 datagram_channels_.erase(name); |
| 386 } | 386 } |
| 387 | 387 |
| 388 } // namespace protocol | 388 } // namespace protocol |
| 389 } // namespace remoting | 389 } // namespace remoting |
| OLD | NEW |