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

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

Issue 2635253002: VM eventhandler: Read "old" event mask before it can be modified. (Closed)
Patch Set: Revert previous changes. Read correct old_mask. Created 3 years, 11 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
« no previous file with comments | « runtime/bin/eventhandler_android.cc ('k') | runtime/bin/eventhandler_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) 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 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 381
382 void EventHandlerImplementation::HandleEvents(struct epoll_event* events, 382 void EventHandlerImplementation::HandleEvents(struct epoll_event* events,
383 int size) { 383 int size) {
384 bool interrupt_seen = false; 384 bool interrupt_seen = false;
385 for (int i = 0; i < size; i++) { 385 for (int i = 0; i < size; i++) {
386 if (events[i].data.ptr == NULL) { 386 if (events[i].data.ptr == NULL) {
387 interrupt_seen = true; 387 interrupt_seen = true;
388 } else { 388 } else {
389 DescriptorInfo* di = 389 DescriptorInfo* di =
390 reinterpret_cast<DescriptorInfo*>(events[i].data.ptr); 390 reinterpret_cast<DescriptorInfo*>(events[i].data.ptr);
391 const intptr_t old_mask = di->Mask();
391 intptr_t event_mask = GetPollEvents(events[i].events, di); 392 intptr_t event_mask = GetPollEvents(events[i].events, di);
392
393 if ((event_mask & (1 << kErrorEvent)) != 0) { 393 if ((event_mask & (1 << kErrorEvent)) != 0) {
394 di->NotifyAllDartPorts(event_mask); 394 di->NotifyAllDartPorts(event_mask);
395 } 395 }
396 event_mask &= ~(1 << kErrorEvent); 396 event_mask &= ~(1 << kErrorEvent);
397 397
398 LOG_INFO("HandleEvents: fd=%ld events=%ld\n", di->fd(), event_mask); 398 LOG_INFO("HandleEvents: fd=%ld events=%ld\n", di->fd(), event_mask);
399 if (event_mask != 0) { 399 if (event_mask != 0) {
400 intptr_t old_mask = di->Mask();
401 Dart_Port port = di->NextNotifyDartPort(event_mask); 400 Dart_Port port = di->NextNotifyDartPort(event_mask);
402 ASSERT(port != 0); 401 ASSERT(port != 0);
403 UpdateEpollInstance(old_mask, di); 402 UpdateEpollInstance(old_mask, di);
404 LOG_INFO("HandleEvents: Posting %ld to %ld for fd=%ld\n", event_mask, 403 LOG_INFO("HandleEvents: Posting %ld to %ld for fd=%ld\n", event_mask,
405 port, di->fd()); 404 port, di->fd());
406 bool success = DartUtils::PostInt32(port, event_mask); 405 bool success = DartUtils::PostInt32(port, event_mask);
407 if (!success) { 406 if (!success) {
408 // This can happen if e.g. the isolate that owns the port has died 407 // This can happen if e.g. the isolate that owns the port has died
409 // for some reason. 408 // for some reason.
410 LOG_ERR("Failed to post event for fd %ld to port %ld", di->fd(), 409 LOG_ERR("Failed to post event for fd %ld to port %ld", di->fd(),
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 // The hashmap does not support keys with value 0. 504 // The hashmap does not support keys with value 0.
506 return dart::Utils::WordHash(fd + 1); 505 return dart::Utils::WordHash(fd + 1);
507 } 506 }
508 507
509 } // namespace bin 508 } // namespace bin
510 } // namespace dart 509 } // namespace dart
511 510
512 #endif // defined(TARGET_OS_FUCHSIA) 511 #endif // defined(TARGET_OS_FUCHSIA)
513 512
514 #endif // !defined(DART_IO_DISABLED) 513 #endif // !defined(DART_IO_DISABLED)
OLDNEW
« no previous file with comments | « runtime/bin/eventhandler_android.cc ('k') | runtime/bin/eventhandler_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698