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

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

Issue 165723007: Move signal_blocker to platform and use it by default in TEMP_FAILURE_RETRY. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Tiny fix. Created 6 years, 9 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') | runtime/bin/directory_android.cc » ('j') | 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
11 #include <string.h> // NOLINT 11 #include <string.h> // NOLINT
12 #include <sys/event.h> // NOLINT 12 #include <sys/event.h> // NOLINT
13 #include <unistd.h> // NOLINT 13 #include <unistd.h> // NOLINT
14 14
15 #include "bin/dartutils.h" 15 #include "bin/dartutils.h"
16 #include "bin/dbg_connection.h" 16 #include "bin/dbg_connection.h"
17 #include "bin/fdutils.h" 17 #include "bin/fdutils.h"
18 #include "bin/log.h" 18 #include "bin/log.h"
19 #include "bin/socket.h" 19 #include "bin/socket.h"
20 #include "platform/signal_blocker.h"
20 #include "platform/thread.h" 21 #include "platform/thread.h"
21 #include "platform/utils.h" 22 #include "platform/utils.h"
22 23
23 24
24 namespace dart { 25 namespace dart {
25 namespace bin { 26 namespace bin {
26 27
27 #define INVALID_FD -1 28 #define INVALID_FD -1
28 29
29 int DebuggerConnectionImpl::kqueue_fd_ = INVALID_FD; 30 int DebuggerConnectionImpl::kqueue_fd_ = INVALID_FD;
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 HandleEvent(&events[i]); 126 HandleEvent(&events[i]);
126 } 127 }
127 } 128 }
128 } 129 }
129 Log::Print("shutting down debugger thread\n"); 130 Log::Print("shutting down debugger thread\n");
130 } 131 }
131 132
132 133
133 void DebuggerConnectionImpl::SetupPollQueue() { 134 void DebuggerConnectionImpl::SetupPollQueue() {
134 int result; 135 int result;
135 result = TEMP_FAILURE_RETRY(pipe(wakeup_fds_)); 136 result = NO_RETRY_EXPECTED(pipe(wakeup_fds_));
136 if (result != 0) { 137 if (result != 0) {
137 FATAL1("Pipe creation failed with error %d\n", result); 138 FATAL1("Pipe creation failed with error %d\n", result);
138 } 139 }
139 FDUtils::SetNonBlocking(wakeup_fds_[0]); 140 FDUtils::SetNonBlocking(wakeup_fds_[0]);
140 141
141 kqueue_fd_ = TEMP_FAILURE_RETRY(kqueue()); 142 kqueue_fd_ = NO_RETRY_EXPECTED(kqueue());
142 if (kqueue_fd_ == -1) { 143 if (kqueue_fd_ == -1) {
143 FATAL("Failed creating kqueue\n"); 144 FATAL("Failed creating kqueue\n");
144 } 145 }
145 // Register the wakeup_fd_ with the kqueue. 146 // Register the wakeup_fd_ with the kqueue.
146 struct kevent event; 147 struct kevent event;
147 EV_SET(&event, wakeup_fds_[0], EVFILT_READ, EV_ADD, 0, 0, NULL); 148 EV_SET(&event, wakeup_fds_[0], EVFILT_READ, EV_ADD, 0, 0, NULL);
148 int status = TEMP_FAILURE_RETRY(kevent(kqueue_fd_, &event, 1, NULL, 0, NULL)); 149 int status = NO_RETRY_EXPECTED(kevent(kqueue_fd_, &event, 1, NULL, 0, NULL));
149 if (status == -1) { 150 if (status == -1) {
150 const int kBufferSize = 1024; 151 const int kBufferSize = 1024;
151 char error_message[kBufferSize]; 152 char error_message[kBufferSize];
152 strerror_r(errno, error_message, kBufferSize); 153 strerror_r(errno, error_message, kBufferSize);
153 FATAL1("Failed adding wakeup pipe fd to kqueue: %s\n", error_message); 154 FATAL1("Failed adding wakeup pipe fd to kqueue: %s\n", error_message);
154 } 155 }
155 156
156 // Register the listening socket. 157 // Register the listening socket.
157 EV_SET(&event, DebuggerConnectionHandler::listener_fd_, 158 EV_SET(&event, DebuggerConnectionHandler::listener_fd_,
158 EVFILT_READ, EV_ADD, 0, 0, NULL); 159 EVFILT_READ, EV_ADD, 0, 0, NULL);
159 status = TEMP_FAILURE_RETRY(kevent(kqueue_fd_, &event, 1, NULL, 0, NULL)); 160 status = NO_RETRY_EXPECTED(kevent(kqueue_fd_, &event, 1, NULL, 0, NULL));
160 if (status == -1) { 161 if (status == -1) {
161 const int kBufferSize = 1024; 162 const int kBufferSize = 1024;
162 char error_message[kBufferSize]; 163 char error_message[kBufferSize];
163 strerror_r(errno, error_message, kBufferSize); 164 strerror_r(errno, error_message, kBufferSize);
164 FATAL1("Failed adding listener socket to kqueue: %s\n", error_message); 165 FATAL1("Failed adding listener socket to kqueue: %s\n", error_message);
165 } 166 }
166 } 167 }
167 168
168 169
169 void DebuggerConnectionImpl::StartHandler(int port_number) { 170 void DebuggerConnectionImpl::StartHandler(int port_number) {
(...skipping 14 matching lines...) Expand all
184 185
185 186
186 intptr_t DebuggerConnectionImpl::Receive(intptr_t socket, char* buf, int len) { 187 intptr_t DebuggerConnectionImpl::Receive(intptr_t socket, char* buf, int len) {
187 return TEMP_FAILURE_RETRY(read(socket, buf, len)); 188 return TEMP_FAILURE_RETRY(read(socket, buf, len));
188 } 189 }
189 190
190 } // namespace bin 191 } // namespace bin
191 } // namespace dart 192 } // namespace dart
192 193
193 #endif // defined(TARGET_OS_MACOS) 194 #endif // defined(TARGET_OS_MACOS)
OLDNEW
« no previous file with comments | « runtime/bin/dbg_connection_linux.cc ('k') | runtime/bin/directory_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698