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 "net/socket/buffered_write_stream_socket.h" | 5 #include "net/socket/buffered_write_stream_socket.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "net/base/io_buffer.h" | 10 #include "net/base/io_buffer.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 if (!callback_pending_) { | 52 if (!callback_pending_) { |
53 base::MessageLoop::current()->PostTask( | 53 base::MessageLoop::current()->PostTask( |
54 FROM_HERE, | 54 FROM_HERE, |
55 base::Bind(&BufferedWriteStreamSocket::DoDelayedWrite, | 55 base::Bind(&BufferedWriteStreamSocket::DoDelayedWrite, |
56 weak_factory_.GetWeakPtr())); | 56 weak_factory_.GetWeakPtr())); |
57 callback_pending_ = true; | 57 callback_pending_ = true; |
58 } | 58 } |
59 return buf_len; | 59 return buf_len; |
60 } | 60 } |
61 | 61 |
62 bool BufferedWriteStreamSocket::SetReceiveBufferSize(int32 size) { | 62 int BufferedWriteStreamSocket::SetReceiveBufferSize(int32 size) { |
63 return wrapped_socket_->SetReceiveBufferSize(size); | 63 return wrapped_socket_->SetReceiveBufferSize(size); |
64 } | 64 } |
65 | 65 |
66 bool BufferedWriteStreamSocket::SetSendBufferSize(int32 size) { | 66 int BufferedWriteStreamSocket::SetSendBufferSize(int32 size) { |
67 return wrapped_socket_->SetSendBufferSize(size); | 67 return wrapped_socket_->SetSendBufferSize(size); |
68 } | 68 } |
69 | 69 |
70 int BufferedWriteStreamSocket::Connect(const CompletionCallback& callback) { | 70 int BufferedWriteStreamSocket::Connect(const CompletionCallback& callback) { |
71 return wrapped_socket_->Connect(callback); | 71 return wrapped_socket_->Connect(callback); |
72 } | 72 } |
73 | 73 |
74 void BufferedWriteStreamSocket::Disconnect() { | 74 void BufferedWriteStreamSocket::Disconnect() { |
75 wrapped_socket_->Disconnect(); | 75 wrapped_socket_->Disconnect(); |
76 } | 76 } |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 io_buffer_->set_offset(io_buffer_->offset() + result); | 152 io_buffer_->set_offset(io_buffer_->offset() + result); |
153 if (io_buffer_->RemainingCapacity()) { | 153 if (io_buffer_->RemainingCapacity()) { |
154 DoDelayedWrite(); | 154 DoDelayedWrite(); |
155 } else { | 155 } else { |
156 io_buffer_->SetCapacity(0); | 156 io_buffer_->SetCapacity(0); |
157 } | 157 } |
158 } | 158 } |
159 } | 159 } |
160 | 160 |
161 } // namespace net | 161 } // namespace net |
OLD | NEW |