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

Side by Side Diff: runtime/bin/dbg_connection.cc

Issue 16514010: Add NetworkAdaptor to dart:io. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Clean up implementation and add tests. Created 7 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
« no previous file with comments | « no previous file | runtime/bin/socket.h » ('j') | runtime/bin/socket_linux.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "bin/dbg_connection.h" 5 #include "bin/dbg_connection.h"
6 #include "bin/dbg_message.h" 6 #include "bin/dbg_message.h"
7 #include "bin/dartutils.h" 7 #include "bin/dartutils.h"
8 #include "bin/log.h" 8 #include "bin/log.h"
9 #include "bin/socket.h" 9 #include "bin/socket.h"
10 #include "bin/thread.h" 10 #include "bin/thread.h"
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 // Initialize the socket implementation. 293 // Initialize the socket implementation.
294 if (!Socket::Initialize()) { 294 if (!Socket::Initialize()) {
295 FATAL("Failed initializing socket implementation."); 295 FATAL("Failed initializing socket implementation.");
296 } 296 }
297 297
298 // Now setup a listener socket and start a thread which will 298 // Now setup a listener socket and start a thread which will
299 // listen, accept connections from debuggers, read and handle/dispatch 299 // listen, accept connections from debuggers, read and handle/dispatch
300 // debugger commands received on these connections. 300 // debugger commands received on these connections.
301 ASSERT(listener_fd_ == -1); 301 ASSERT(listener_fd_ == -1);
302 OSError *os_error; 302 OSError *os_error;
303 SocketAddresses* addresses = Socket::LookupAddress(address, -1, &os_error); 303 AddressList<SocketAddress>* addresses =
304 Socket::LookupAddress(address, -1, &os_error);
304 listener_fd_ = ServerSocket::CreateBindListen( 305 listener_fd_ = ServerSocket::CreateBindListen(
305 addresses->GetAt(0)->addr(), port_number, 1); 306 addresses->GetAt(0)->addr(), port_number, 1);
307 delete addresses;
306 port_number = Socket::GetPort(listener_fd_); 308 port_number = Socket::GetPort(listener_fd_);
307 DebuggerConnectionImpl::StartHandler(port_number); 309 DebuggerConnectionImpl::StartHandler(port_number);
308 return port_number; 310 return port_number;
309 } 311 }
310 312
311 313
312 void DebuggerConnectionHandler::WaitForConnection() { 314 void DebuggerConnectionHandler::WaitForConnection() {
313 ASSERT(handler_lock_ != NULL); 315 ASSERT(handler_lock_ != NULL);
314 MonitorLocker ml(handler_lock_); 316 MonitorLocker ml(handler_lock_);
315 while (!IsConnected()) { 317 while (!IsConnected()) {
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 454
453 455
454 bool DebuggerConnectionHandler::IsConnected() { 456 bool DebuggerConnectionHandler::IsConnected() {
455 // TODO(asiva): Support multiple debugger connections. 457 // TODO(asiva): Support multiple debugger connections.
456 // Return true if a connection has been established. 458 // Return true if a connection has been established.
457 return singleton_handler != NULL; 459 return singleton_handler != NULL;
458 } 460 }
459 461
460 } // namespace bin 462 } // namespace bin
461 } // namespace dart 463 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/socket.h » ('j') | runtime/bin/socket_linux.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698