Chromium Code Reviews| Index: chrome/browser/devtools/device/port_forwarding_controller.cc |
| diff --git a/chrome/browser/devtools/device/port_forwarding_controller.cc b/chrome/browser/devtools/device/port_forwarding_controller.cc |
| index c22789b157fd2ce513c955aa2f39892140b0e517..1a6928ce0db5aeffb90dc33ebf93734041f60081 100644 |
| --- a/chrome/browser/devtools/device/port_forwarding_controller.cc |
| +++ b/chrome/browser/devtools/device/port_forwarding_controller.cc |
| @@ -68,7 +68,7 @@ class SocketTunnel : public base::NonThreadSafe { |
| private: |
| explicit SocketTunnel(const CounterCallback& callback) |
| - : pending_writes_(0), |
| + : pending_io_(0), |
| pending_destruction_(false), |
| callback_(callback), |
| about_to_destroy_(false) { |
| @@ -126,6 +126,7 @@ class SocketTunnel : public base::NonThreadSafe { |
| void Pump(net::StreamSocket* from, net::StreamSocket* to) { |
| scoped_refptr<net::IOBuffer> buffer = new net::IOBuffer(kBufferSize); |
| + pending_io_++; |
| int result = from->Read( |
| buffer.get(), |
| kBufferSize, |
| @@ -139,6 +140,7 @@ class SocketTunnel : public base::NonThreadSafe { |
| net::StreamSocket* to, |
| scoped_refptr<net::IOBuffer> buffer, |
| int result) { |
| + pending_io_--; |
|
pfeldman
2014/05/18 06:17:06
To recap offline discussion: we don't have read ti
|
| if (result <= 0) { |
| SelfDestruct(); |
| return; |
| @@ -148,7 +150,7 @@ class SocketTunnel : public base::NonThreadSafe { |
| scoped_refptr<net::DrainableIOBuffer> drainable = |
| new net::DrainableIOBuffer(buffer.get(), total); |
| - ++pending_writes_; |
| + ++pending_io_; |
| result = to->Write(drainable.get(), |
| total, |
| base::Bind(&SocketTunnel::OnWritten, |
| @@ -164,7 +166,7 @@ class SocketTunnel : public base::NonThreadSafe { |
| net::StreamSocket* from, |
| net::StreamSocket* to, |
| int result) { |
| - --pending_writes_; |
| + --pending_io_; |
| if (result < 0) { |
| SelfDestruct(); |
| return; |
| @@ -172,7 +174,7 @@ class SocketTunnel : public base::NonThreadSafe { |
| drainable->DidConsume(result); |
| if (drainable->BytesRemaining() > 0) { |
| - ++pending_writes_; |
| + ++pending_io_; |
| result = to->Write(drainable.get(), |
| drainable->BytesRemaining(), |
| base::Bind(&SocketTunnel::OnWritten, |
| @@ -198,7 +200,7 @@ class SocketTunnel : public base::NonThreadSafe { |
| // read callbacks. |
| if (about_to_destroy_) |
| return; |
| - if (pending_writes_ > 0) { |
| + if (pending_io_ > 0) { |
| pending_destruction_ = true; |
| return; |
| } |
| @@ -209,7 +211,7 @@ class SocketTunnel : public base::NonThreadSafe { |
| scoped_ptr<net::StreamSocket> host_socket_; |
| scoped_ptr<net::HostResolver> host_resolver_; |
| net::AddressList address_list_; |
| - int pending_writes_; |
| + int pending_io_; |
| bool pending_destruction_; |
| CounterCallback callback_; |
| bool about_to_destroy_; |