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

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

Issue 371123002: Minor cleanup in use of intptr_t vs int (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 5 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 | « runtime/bin/dbg_connection_linux.cc ('k') | no next file » | no next file with comments »
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 "platform/globals.h" 5 #include "platform/globals.h"
6 #if defined(TARGET_OS_MACOS) 6 #if defined(TARGET_OS_MACOS)
7 7
8 #include <errno.h> // NOLINT 8 #include <errno.h> // NOLINT
9 #include <stdio.h> // NOLINT 9 #include <stdio.h> // NOLINT
10 #include <stdlib.h> // NOLINT 10 #include <stdlib.h> // NOLINT
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 total_read += bytes_read; 64 total_read += bytes_read;
65 remaining -= bytes_read; 65 remaining -= bytes_read;
66 } 66 }
67 } 67 }
68 ASSERT(remaining >= 0); 68 ASSERT(remaining >= 0);
69 return remaining == 0; 69 return remaining == 0;
70 } 70 }
71 71
72 72
73 void DebuggerConnectionImpl::HandleEvent(struct kevent* event) { 73 void DebuggerConnectionImpl::HandleEvent(struct kevent* event) {
74 int ident = event->ident; 74 intptr_t ident = event->ident;
75 if (ident == DebuggerConnectionHandler::listener_fd_) { 75 if (ident == DebuggerConnectionHandler::listener_fd_) {
76 if (DebuggerConnectionHandler::IsConnected()) { 76 if (DebuggerConnectionHandler::IsConnected()) {
77 FATAL("Cannot connect to more than one debugger.\n"); 77 FATAL("Cannot connect to more than one debugger.\n");
78 } 78 }
79 intptr_t fd = ServerSocket::Accept(ident); 79 intptr_t fd = ServerSocket::Accept(ident);
80 if (fd < 0) { 80 if (fd < 0) {
81 FATAL("Accepting new debugger connection failed.\n"); 81 FATAL("Accepting new debugger connection failed.\n");
82 } 82 }
83 FDUtils::SetBlocking(fd); 83 FDUtils::SetBlocking(fd);
84 DebuggerConnectionHandler::AcceptDbgConnection(fd); 84 DebuggerConnectionHandler::AcceptDbgConnection(fd);
(...skipping 16 matching lines...) Expand all
101 Log::Print("Received sync message id %d.\n", msg.msg_id); 101 Log::Print("Received sync message id %d.\n", msg.msg_id);
102 } 102 }
103 } else { 103 } else {
104 Log::Print("unexpected: receiving debugger connection event.\n"); 104 Log::Print("unexpected: receiving debugger connection event.\n");
105 UNIMPLEMENTED(); 105 UNIMPLEMENTED();
106 } 106 }
107 } 107 }
108 108
109 109
110 void DebuggerConnectionImpl::Handler(uword args) { 110 void DebuggerConnectionImpl::Handler(uword args) {
111 static const intptr_t kMaxEvents = 4; 111 static const int kMaxEvents = 4;
112 struct kevent events[kMaxEvents]; 112 struct kevent events[kMaxEvents];
113 113
114 while (1) { 114 while (1) {
115 // Wait indefinitely for an event. 115 // Wait indefinitely for an event.
116 int result = TEMP_FAILURE_RETRY( 116 int result = TEMP_FAILURE_RETRY(
117 kevent(kqueue_fd_, NULL, 0, events, kMaxEvents, NULL)); 117 kevent(kqueue_fd_, NULL, 0, events, kMaxEvents, NULL));
118 if (result == -1) { 118 if (result == -1) {
119 const int kBufferSize = 1024; 119 const int kBufferSize = 1024;
120 char error_message[kBufferSize]; 120 char error_message[kBufferSize];
121 strerror_r(errno, error_message, kBufferSize); 121 strerror_r(errno, error_message, kBufferSize);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 185
186 186
187 intptr_t DebuggerConnectionImpl::Receive(intptr_t socket, char* buf, int len) { 187 intptr_t DebuggerConnectionImpl::Receive(intptr_t socket, char* buf, int len) {
188 return TEMP_FAILURE_RETRY(read(socket, buf, len)); 188 return TEMP_FAILURE_RETRY(read(socket, buf, len));
189 } 189 }
190 190
191 } // namespace bin 191 } // namespace bin
192 } // namespace dart 192 } // namespace dart
193 193
194 #endif // defined(TARGET_OS_MACOS) 194 #endif // defined(TARGET_OS_MACOS)
OLDNEW
« no previous file with comments | « runtime/bin/dbg_connection_linux.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698