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

Unified Diff: chrome/browser/extensions/api/socket/tcp_socket.cc

Issue 76403004: An implementation of chrome.socket.secure(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Made TLSSocket resumable, responses to sleevi's round-1 comments. Created 7 years 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
Index: chrome/browser/extensions/api/socket/tcp_socket.cc
diff --git a/chrome/browser/extensions/api/socket/tcp_socket.cc b/chrome/browser/extensions/api/socket/tcp_socket.cc
index 4f9273468ab31690db5401025e197e63b9aa6cb3..56dac3ead5d5dde035dc562a6b19ae7400c8d3a2 100644
--- a/chrome/browser/extensions/api/socket/tcp_socket.cc
+++ b/chrome/browser/extensions/api/socket/tcp_socket.cc
@@ -306,6 +306,34 @@ void TCPSocket::OnAccept(int result) {
accept_callback_.Reset();
}
+
+void TCPSocket::Release() {
+ if (server_socket_.release() || accept_socket_.release()) {
+ VLOG(1) << "TCPSocket::Release getting called in server mode. Odd.";
+ return;
+ }
+
+ // Release() doesn't disconnect the underlying sockets, but it does
+ // disconnect them from this TCPSocket.
+ is_connected_ = false;
+
+ // Really, the 'server' bool/checks are to get around warn_unused_result on
+ // scoped_ptr.release().
+ connect_callback_.Reset();
+ read_callback_.Reset();
+ accept_callback_.Reset();
+
+ if (socket_.release() == NULL && socket_mode_ == CLIENT) {
+ VLOG(1) << "TCPSocket::Release on null client socket.";
+ }
+}
+
+net::TCPClientSocket* TCPSocket::ClientStream() {
+ if (socket_mode_ != CLIENT || GetSocketType() != TYPE_TCP)
+ return NULL;
+ return socket_.get();
+}
+
ResumableTCPSocket::ResumableTCPSocket(const std::string& owner_extension_id)
: TCPSocket(owner_extension_id),
persistent_(false),

Powered by Google App Engine
This is Rietveld 408576698