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

Side by Side Diff: libraries/nacl-mounts/net/TcpServerSocket.cc

Issue 10556007: changes in memory mount and socket subsystem to port thttpd (Closed) Base URL: http://naclports.googlecode.com/svn/trunk/src/
Patch Set: Created 8 years, 6 months 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Native Client Authors. All rights reserved. 1 // Copyright (c) 2012 The Native Client 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/TcpServerSocket.h" 5 #include "net/TcpServerSocket.h"
6 6
7 #include <assert.h> 7 #include <assert.h>
8 #include <string.h> 8 #include <string.h>
9 9
10 #include "../net/SocketSubSystem.h" 10 #include "../net/SocketSubSystem.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 SimpleAutoLock lock(sys_->mutex()); 82 SimpleAutoLock lock(sys_->mutex());
83 int32_t result = PP_OK_COMPLETIONPENDING; 83 int32_t result = PP_OK_COMPLETIONPENDING;
84 pp::Module::Get()->core()->CallOnMainThread(0, 84 pp::Module::Get()->core()->CallOnMainThread(0,
85 factory_.NewCallback(&TCPServerSocket::Listen, backlog, &result)); 85 factory_.NewCallback(&TCPServerSocket::Listen, backlog, &result));
86 while (result == PP_OK_COMPLETIONPENDING) 86 while (result == PP_OK_COMPLETIONPENDING)
87 sys_->cond().wait(sys_->mutex()); 87 sys_->cond().wait(sys_->mutex());
88 return result == PP_OK; 88 return result == PP_OK;
89 } 89 }
90 90
91 PP_Resource TCPServerSocket::accept() { 91 PP_Resource TCPServerSocket::accept() {
92 if (!resource_) 92 if (!resource_) {
93 return 0; 93 return 0;
94 94 }
95 PP_Resource ret = resource_; 95 PP_Resource ret = resource_;
96 resource_ = 0; 96 resource_ = 0;
97 pp::Module::Get()->core()->CallOnMainThread(0, 97 pp::Module::Get()->core()->CallOnMainThread(0,
98 factory_.NewCallback(&TCPServerSocket::Accept, 98 factory_.NewCallback(&TCPServerSocket::Accept,
99 static_cast<int32_t*>(NULL))); 99 static_cast<int32_t*>(NULL)));
100 100
101 return ret; 101 return ret;
102 } 102 }
103 103
104 bool TCPServerSocket::CreateNetAddress(const sockaddr* saddr, 104 bool TCPServerSocket::CreateNetAddress(const sockaddr* saddr,
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 } 163 }
164 164
165 void TCPServerSocket::Close(int32_t result, int32_t* pres) { 165 void TCPServerSocket::Close(int32_t result, int32_t* pres) {
166 SimpleAutoLock lock(sys_->mutex()); 166 SimpleAutoLock lock(sys_->mutex());
167 delete socket_; 167 delete socket_;
168 socket_ = NULL; 168 socket_ = NULL;
169 *pres = PP_OK; 169 *pres = PP_OK;
170 sys_->cond().broadcast(); 170 sys_->cond().broadcast();
171 } 171 }
172 172
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698