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

Side by Side Diff: runtime/bin/dbg_connection_android.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/crypto_macos.cc ('k') | runtime/bin/dbg_connection_linux.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_ANDROID) 6 #if defined(TARGET_OS_ANDROID)
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 <sys/epoll.h> // NOLINT 11 #include <sys/epoll.h> // NOLINT
12 12
13 #include "bin/dbg_connection.h" 13 #include "bin/dbg_connection.h"
14 #include "bin/fdutils.h" 14 #include "bin/fdutils.h"
15 #include "bin/log.h" 15 #include "bin/log.h"
16 #include "bin/socket.h" 16 #include "bin/socket.h"
17 17
18 #include "platform/signal_blocker.h"
19
18 20
19 namespace dart { 21 namespace dart {
20 namespace bin { 22 namespace bin {
21 23
22 int DebuggerConnectionImpl::epoll_fd_ = -1; 24 int DebuggerConnectionImpl::epoll_fd_ = -1;
23 int DebuggerConnectionImpl::wakeup_fds_[2] = {-1, -1}; 25 int DebuggerConnectionImpl::wakeup_fds_[2] = {-1, -1};
24 26
25 27
26 void DebuggerConnectionImpl::HandleEvent(struct epoll_event* event) { 28 void DebuggerConnectionImpl::HandleEvent(struct epoll_event* event) {
27 if (event->data.fd == DebuggerConnectionHandler::listener_fd_) { 29 if (event->data.fd == DebuggerConnectionHandler::listener_fd_) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 ASSERT(result <= kMaxEvents); 64 ASSERT(result <= kMaxEvents);
63 for (int i = 0; i < result; i++) { 65 for (int i = 0; i < result; i++) {
64 HandleEvent(&events[i]); 66 HandleEvent(&events[i]);
65 } 67 }
66 } 68 }
67 } 69 }
68 } 70 }
69 71
70 72
71 void DebuggerConnectionImpl::SetupPollQueue() { 73 void DebuggerConnectionImpl::SetupPollQueue() {
72 int result = TEMP_FAILURE_RETRY(pipe(wakeup_fds_)); 74 int result = NO_RETRY_EXPECTED(pipe(wakeup_fds_));
73 if (result != 0) { 75 if (result != 0) {
74 FATAL1("Pipe creation failed with error %d\n", result); 76 FATAL1("Pipe creation failed with error %d\n", result);
75 } 77 }
76 FDUtils::SetNonBlocking(wakeup_fds_[0]); 78 FDUtils::SetNonBlocking(wakeup_fds_[0]);
77 79
78 static const int kEpollInitialSize = 16; 80 static const int kEpollInitialSize = 16;
79 epoll_fd_ = TEMP_FAILURE_RETRY(epoll_create(kEpollInitialSize)); 81 epoll_fd_ = NO_RETRY_EXPECTED(epoll_create(kEpollInitialSize));
80 if (epoll_fd_ == -1) { 82 if (epoll_fd_ == -1) {
81 FATAL("Failed creating epoll file descriptor"); 83 FATAL("Failed creating epoll file descriptor");
82 } 84 }
83 85
84 // Register the wakeup _fd with the epoll instance. 86 // Register the wakeup _fd with the epoll instance.
85 struct epoll_event event; 87 struct epoll_event event;
86 event.events = EPOLLIN; 88 event.events = EPOLLIN;
87 event.data.fd = wakeup_fds_[0]; 89 event.data.fd = wakeup_fds_[0];
88 int status = TEMP_FAILURE_RETRY(epoll_ctl( 90 int status = NO_RETRY_EXPECTED(epoll_ctl(
89 epoll_fd_, EPOLL_CTL_ADD, wakeup_fds_[0], &event)); 91 epoll_fd_, EPOLL_CTL_ADD, wakeup_fds_[0], &event));
90 if (status == -1) { 92 if (status == -1) {
91 FATAL("Failed adding wakeup fd to epoll instance"); 93 FATAL("Failed adding wakeup fd to epoll instance");
92 } 94 }
93 95
94 // Register the listener_fd with the epoll instance. 96 // Register the listener_fd with the epoll instance.
95 event.events = EPOLLIN; 97 event.events = EPOLLIN;
96 event.data.fd = DebuggerConnectionHandler::listener_fd_; 98 event.data.fd = DebuggerConnectionHandler::listener_fd_;
97 status = TEMP_FAILURE_RETRY(epoll_ctl(epoll_fd_, EPOLL_CTL_ADD, 99 status = NO_RETRY_EXPECTED(epoll_ctl(epoll_fd_, EPOLL_CTL_ADD,
98 DebuggerConnectionHandler::listener_fd_, &event)); 100 DebuggerConnectionHandler::listener_fd_, &event));
99 if (status == -1) { 101 if (status == -1) {
100 FATAL("Failed adding listener fd to epoll instance"); 102 FATAL("Failed adding listener fd to epoll instance");
101 } 103 }
102 } 104 }
103 105
104 106
105 void DebuggerConnectionImpl::StartHandler(int port_number) { 107 void DebuggerConnectionImpl::StartHandler(int port_number) {
106 ASSERT(DebuggerConnectionHandler::listener_fd_ != -1); 108 ASSERT(DebuggerConnectionHandler::listener_fd_ != -1);
107 SetupPollQueue(); 109 SetupPollQueue();
(...skipping 12 matching lines...) Expand all
120 122
121 123
122 intptr_t DebuggerConnectionImpl::Receive(intptr_t socket, char* buf, int len) { 124 intptr_t DebuggerConnectionImpl::Receive(intptr_t socket, char* buf, int len) {
123 return TEMP_FAILURE_RETRY(read(socket, buf, len)); 125 return TEMP_FAILURE_RETRY(read(socket, buf, len));
124 } 126 }
125 127
126 } // namespace bin 128 } // namespace bin
127 } // namespace dart 129 } // namespace dart
128 130
129 #endif // defined(TARGET_OS_ANDROID) 131 #endif // defined(TARGET_OS_ANDROID)
OLDNEW
« no previous file with comments | « runtime/bin/crypto_macos.cc ('k') | runtime/bin/dbg_connection_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698