| 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 "content/browser/devtools/tethering_handler.h" | 5 #include "content/browser/devtools/tethering_handler.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 wire_buffer_size_ -= offset; | 142 wire_buffer_size_ -= offset; |
| 143 wire_buffer_->set_offset(0); | 143 wire_buffer_->set_offset(0); |
| 144 } | 144 } |
| 145 | 145 |
| 146 if (result != net::ERR_IO_PENDING) | 146 if (result != net::ERR_IO_PENDING) |
| 147 OnClientWrite(result); | 147 OnClientWrite(result); |
| 148 return; | 148 return; |
| 149 } | 149 } |
| 150 | 150 |
| 151 void SelfDestruct() { | 151 void SelfDestruct() { |
| 152 if (wire_buffer_->offset() != wire_buffer_size_) { | 152 if (wire_buffer_ && wire_buffer_->offset() != wire_buffer_size_) { |
| 153 pending_destruction_ = true; | 153 pending_destruction_ = true; |
| 154 return; | 154 return; |
| 155 } | 155 } |
| 156 delete this; | 156 delete this; |
| 157 } | 157 } |
| 158 | 158 |
| 159 private: | 159 private: |
| 160 scoped_ptr<net::StreamSocket> client_socket_; | 160 scoped_ptr<net::StreamSocket> client_socket_; |
| 161 scoped_ptr<net::StreamListenSocket> server_socket_; | 161 scoped_ptr<net::StreamListenSocket> server_socket_; |
| 162 scoped_ptr<net::StreamListenSocket> accepted_socket_; | 162 scoped_ptr<net::StreamListenSocket> accepted_socket_; |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 BoundSockets::iterator it = bound_sockets_.find(port); | 299 BoundSockets::iterator it = bound_sockets_.find(port); |
| 300 if (it == bound_sockets_.end()) | 300 if (it == bound_sockets_.end()) |
| 301 return command->InternalErrorResponse("Port is not bound"); | 301 return command->InternalErrorResponse("Port is not bound"); |
| 302 | 302 |
| 303 delete it->second; | 303 delete it->second; |
| 304 bound_sockets_.erase(it); | 304 bound_sockets_.erase(it); |
| 305 return command->SuccessResponse(NULL); | 305 return command->SuccessResponse(NULL); |
| 306 } | 306 } |
| 307 | 307 |
| 308 } // namespace content | 308 } // namespace content |
| OLD | NEW |