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

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

Issue 2458703004: Use 'mx_channel' instead of deprecated 'mx_msgpipe' naming (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « no previous file | 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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 #if !defined(DART_IO_DISABLED) 5 #if !defined(DART_IO_DISABLED)
6 6
7 #include "platform/globals.h" 7 #include "platform/globals.h"
8 #if defined(TARGET_OS_FUCHSIA) 8 #if defined(TARGET_OS_FUCHSIA)
9 9
10 #include "bin/eventhandler.h" 10 #include "bin/eventhandler.h"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 if (signals_states_ == NULL) { 137 if (signals_states_ == NULL) {
138 FATAL("Failed to grow signals_states array"); 138 FATAL("Failed to grow signals_states array");
139 } 139 }
140 capacity_ = new_capacity; 140 capacity_ = new_capacity;
141 LOG_INFO("GrowArraysIfNeeded(%ld), capacity = %ld\n", 141 LOG_INFO("GrowArraysIfNeeded(%ld), capacity = %ld\n",
142 desired_size, capacity_); 142 desired_size, capacity_);
143 } 143 }
144 144
145 145
146 EventHandlerImplementation::EventHandlerImplementation() { 146 EventHandlerImplementation::EventHandlerImplementation() {
147 mx_status_t status = mx_msgpipe_create(interrupt_handles_, 0); 147 mx_status_t status = mx_channel_create(0, &interrupt_handles_[0],
148 &interrupt_handles_[1]);
148 if (status != NO_ERROR) { 149 if (status != NO_ERROR) {
149 FATAL1("mx_msgpipe_create failed: %s\n", mx_status_get_string(status)); 150 FATAL1("mx_channel_create failed: %s\n", mx_status_get_string(status));
150 } 151 }
151 shutdown_ = false; 152 shutdown_ = false;
152 info_.AddHandle(interrupt_handles_[0], 153 info_.AddHandle(interrupt_handles_[0],
153 MX_SIGNAL_READABLE | MX_SIGNAL_PEER_CLOSED, 154 MX_SIGNAL_READABLE | MX_SIGNAL_PEER_CLOSED,
154 NULL); 155 NULL);
155 LOG_INFO("EventHandlerImplementation initialized\n"); 156 LOG_INFO("EventHandlerImplementation initialized\n");
156 } 157 }
157 158
158 159
159 EventHandlerImplementation::~EventHandlerImplementation() { 160 EventHandlerImplementation::~EventHandlerImplementation() {
(...skipping 11 matching lines...) Expand all
171 172
172 void EventHandlerImplementation::WakeupHandler(intptr_t id, 173 void EventHandlerImplementation::WakeupHandler(intptr_t id,
173 Dart_Port dart_port, 174 Dart_Port dart_port,
174 int64_t data) { 175 int64_t data) {
175 InterruptMessage msg; 176 InterruptMessage msg;
176 msg.id = id; 177 msg.id = id;
177 msg.dart_port = dart_port; 178 msg.dart_port = dart_port;
178 msg.data = data; 179 msg.data = data;
179 180
180 mx_status_t status = 181 mx_status_t status =
181 mx_msgpipe_write(interrupt_handles_[1], &msg, sizeof(msg), NULL, 0, 0); 182 mx_channel_write(interrupt_handles_[1], 0, &msg, sizeof(msg), NULL, 0);
182 if (status != NO_ERROR) { 183 if (status != NO_ERROR) {
183 FATAL1("mx_msgpipe_write failed: %s\n", mx_status_get_string(status)); 184 FATAL1("mx_channel_write failed: %s\n", mx_status_get_string(status));
184 } 185 }
185 LOG_INFO("WakeupHandler(%ld, %ld, %lld)\n", id, dart_port, data); 186 LOG_INFO("WakeupHandler(%ld, %ld, %lld)\n", id, dart_port, data);
186 } 187 }
187 188
188 189
189 void EventHandlerImplementation::HandleInterruptFd() { 190 void EventHandlerImplementation::HandleInterruptFd() {
190 LOG_INFO("HandleInterruptFd entry\n"); 191 LOG_INFO("HandleInterruptFd entry\n");
191 InterruptMessage msg; 192 InterruptMessage msg;
192 uint32_t bytes = kInterruptMessageSize; 193 uint32_t bytes = kInterruptMessageSize;
193 mx_status_t status; 194 mx_status_t status;
194 while (true) { 195 while (true) {
195 status = mx_msgpipe_read( 196 status = mx_channel_read(
196 interrupt_handles_[0], &msg, &bytes, NULL, NULL, 0); 197 interrupt_handles_[0], 0, &msg, bytes, &bytes, NULL, 0, NULL);
197 if (status != NO_ERROR) { 198 if (status != NO_ERROR) {
198 break; 199 break;
199 } 200 }
200 ASSERT(bytes == kInterruptMessageSize); 201 ASSERT(bytes == kInterruptMessageSize);
201 if (msg.id == kTimerId) { 202 if (msg.id == kTimerId) {
202 LOG_INFO("HandleInterruptFd read timer update\n"); 203 LOG_INFO("HandleInterruptFd read timer update\n");
203 timeout_queue_.UpdateTimeout(msg.dart_port, msg.data); 204 timeout_queue_.UpdateTimeout(msg.dart_port, msg.data);
204 } else if (msg.id == kShutdownId) { 205 } else if (msg.id == kShutdownId) {
205 LOG_INFO("HandleInterruptFd read shutdown\n"); 206 LOG_INFO("HandleInterruptFd read shutdown\n");
206 shutdown_ = true; 207 shutdown_ = true;
207 } else { 208 } else {
208 // TODO(zra): Handle commands to add and remove handles from the 209 // TODO(zra): Handle commands to add and remove handles from the
209 // MagentaWaitManyInfo. 210 // MagentaWaitManyInfo.
210 UNIMPLEMENTED(); 211 UNIMPLEMENTED();
211 } 212 }
212 } 213 }
213 // status == ERR_SHOULD_WAIT when we try to read and there are no messages 214 // status == ERR_SHOULD_WAIT when we try to read and there are no messages
214 // available, so it is an error if we get here and status != ERR_SHOULD_WAIT. 215 // available, so it is an error if we get here and status != ERR_SHOULD_WAIT.
215 if (status != ERR_SHOULD_WAIT) { 216 if (status != ERR_SHOULD_WAIT) {
216 FATAL1("mx_msgpipe_read failed: %s\n", mx_status_get_string(status)); 217 FATAL1("mx_channel_read failed: %s\n", mx_status_get_string(status));
217 } 218 }
218 LOG_INFO("HandleInterruptFd exit\n"); 219 LOG_INFO("HandleInterruptFd exit\n");
219 } 220 }
220 221
221 222
222 void EventHandlerImplementation::HandleEvents() { 223 void EventHandlerImplementation::HandleEvents() {
223 LOG_INFO("HandleEvents entry\n"); 224 LOG_INFO("HandleEvents entry\n");
224 for (intptr_t i = 1; i < info_.size(); i++) { 225 for (intptr_t i = 1; i < info_.size(); i++) {
225 if (info_.signals_states()[i].satisfied != MX_SIGNAL_NONE) { 226 if (info_.signals_states()[i].satisfied != MX_SIGNAL_NONE) {
226 // Only the control handle has no descriptor info. 227 // Only the control handle has no descriptor info.
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 int64_t data) { 321 int64_t data) {
321 WakeupHandler(id, dart_port, data); 322 WakeupHandler(id, dart_port, data);
322 } 323 }
323 324
324 } // namespace bin 325 } // namespace bin
325 } // namespace dart 326 } // namespace dart
326 327
327 #endif // defined(TARGET_OS_FUCHSIA) 328 #endif // defined(TARGET_OS_FUCHSIA)
328 329
329 #endif // !defined(DART_IO_DISABLED) 330 #endif // !defined(DART_IO_DISABLED)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698