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

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

Issue 8231005: Fix wrong pointer arithmetic when extending the file descripter list in the eventhandler (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixed comment in test case Created 9 years, 2 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
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 <errno.h> 5 #include <errno.h>
6 #include <poll.h> 6 #include <poll.h>
7 #include <pthread.h> 7 #include <pthread.h>
8 #include <stdio.h> 8 #include <stdio.h>
9 #include <string.h> 9 #include <string.h>
10 #include <sys/time.h> 10 #include <sys/time.h>
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 if (fd >= port_map_size_) { 64 if (fd >= port_map_size_) {
65 intptr_t new_port_map_size = port_map_size_; 65 intptr_t new_port_map_size = port_map_size_;
66 do { 66 do {
67 new_port_map_size = new_port_map_size * kPortMapGrowingFactor; 67 new_port_map_size = new_port_map_size * kPortMapGrowingFactor;
68 } while (fd >= new_port_map_size); 68 } while (fd >= new_port_map_size);
69 size_t new_port_map_bytes = new_port_map_size * sizeof(PortData); 69 size_t new_port_map_bytes = new_port_map_size * sizeof(PortData);
70 port_map_ = reinterpret_cast<PortData*>(realloc(port_map_, 70 port_map_ = reinterpret_cast<PortData*>(realloc(port_map_,
71 new_port_map_bytes)); 71 new_port_map_bytes));
72 ASSERT(port_map_ != NULL); 72 ASSERT(port_map_ != NULL);
73 size_t port_map_bytes = port_map_size_ * sizeof(PortData); 73 size_t port_map_bytes = port_map_size_ * sizeof(PortData);
74 memset(port_map_ + port_map_bytes, 74 memset(port_map_ + port_map_size_,
75 0, 75 0,
76 new_port_map_bytes - port_map_bytes); 76 new_port_map_bytes - port_map_bytes);
77 port_map_size_ = new_port_map_size; 77 port_map_size_ = new_port_map_size;
78 } 78 }
79 79
80 /* 80 /*
81 * Only change the port map entries count if SetPort changes 81 * Only change the port map entries count if SetPort changes
82 * the port map state. 82 * the port map state.
83 */ 83 */
84 if (dart_port == 0 && PortFor(fd) != 0) { 84 if (dart_port == 0 && PortFor(fd) != 0) {
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 FATAL("Create start event handler thread"); 316 FATAL("Create start event handler thread");
317 } 317 }
318 } 318 }
319 319
320 320
321 void EventHandlerImplementation::SendData(intptr_t id, 321 void EventHandlerImplementation::SendData(intptr_t id,
322 Dart_Port dart_port, 322 Dart_Port dart_port,
323 intptr_t data) { 323 intptr_t data) {
324 RegisterFdWakeup(id, dart_port, data); 324 RegisterFdWakeup(id, dart_port, data);
325 } 325 }
OLDNEW
« no previous file with comments | « runtime/bin/eventhandler_linux.cc ('k') | runtime/tests/dart/src/SocketManyConnectionsTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698