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

Side by Side Diff: dart/runtime/bin/eventhandler.cc

Issue 879353003: Introduce optional 'bool shared' parameter to ServerSocket.bind() ... (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments Created 5 years, 10 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 | « dart/runtime/bin/eventhandler.h ('k') | dart/runtime/bin/eventhandler_android.h » ('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 "bin/dartutils.h" 5 #include "bin/dartutils.h"
6 #include "bin/eventhandler.h" 6 #include "bin/eventhandler.h"
7 #include "bin/socket.h" 7 #include "bin/socket.h"
8 8
9 #include "include/dart_api.h" 9 #include "include/dart_api.h"
10 10
11 11
12 namespace dart { 12 namespace dart {
13 namespace bin { 13 namespace bin {
14 14
15 static const intptr_t kTimerId = -1;
16 static const intptr_t kInvalidId = -2;
17 15
18 void TimeoutQueue::UpdateTimeout(Dart_Port port, int64_t timeout) { 16 void TimeoutQueue::UpdateTimeout(Dart_Port port, int64_t timeout) {
19 // Find port if present. 17 // Find port if present.
20 Timeout* last = NULL; 18 Timeout* last = NULL;
21 Timeout* current = timeouts_; 19 Timeout* current = timeouts_;
22 while (current != NULL) { 20 while (current != NULL) {
23 if (current->port() == port) { 21 if (current->port() == port) {
24 // Found. 22 // Found.
25 if (timeout < 0) { 23 if (timeout < 0) {
26 // Remove from list and delete existing. 24 // Remove from list and delete existing.
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 return &event_handler->delegate_; 76 return &event_handler->delegate_;
79 } 77 }
80 78
81 79
82 /* 80 /*
83 * Send data to the EventHandler thread to register for a given instance 81 * Send data to the EventHandler thread to register for a given instance
84 * args[0] a ReceivePort args[1] with a notification event args[2]. 82 * args[0] a ReceivePort args[1] with a notification event args[2].
85 */ 83 */
86 void FUNCTION_NAME(EventHandler_SendData)(Dart_NativeArguments args) { 84 void FUNCTION_NAME(EventHandler_SendData)(Dart_NativeArguments args) {
87 Dart_Handle sender = Dart_GetNativeArgument(args, 0); 85 Dart_Handle sender = Dart_GetNativeArgument(args, 0);
88 intptr_t id = kInvalidId; 86 intptr_t id;
89 if (Dart_IsNull(sender)) { 87 if (Dart_IsNull(sender)) {
90 id = kTimerId; 88 id = kTimerId;
91 } else { 89 } else {
92 id = Socket::GetSocketIdNativeField(sender); 90 id = Socket::GetSocketIdNativeField(sender);
93 } 91 }
94 // Get the id out of the send port. If the handle is not a send port 92 // Get the id out of the send port. If the handle is not a send port
95 // we will get an error and propagate that out. 93 // we will get an error and propagate that out.
96 Dart_Handle handle = Dart_GetNativeArgument(args, 1); 94 Dart_Handle handle = Dart_GetNativeArgument(args, 1);
97 Dart_Port dart_port; 95 Dart_Port dart_port;
98 handle = Dart_SendPortGetId(handle, &dart_port); 96 handle = Dart_SendPortGetId(handle, &dart_port);
99 if (Dart_IsError(handle)) { 97 if (Dart_IsError(handle)) {
100 Dart_PropagateError(handle); 98 Dart_PropagateError(handle);
101 UNREACHABLE(); 99 UNREACHABLE();
102 } 100 }
103 int64_t data = DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 2)); 101 int64_t data = DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 2));
104 event_handler->SendData(id, dart_port, data); 102 event_handler->SendData(id, dart_port, data);
105 } 103 }
106 104
107 } // namespace bin 105 } // namespace bin
108 } // namespace dart 106 } // namespace dart
OLDNEW
« no previous file with comments | « dart/runtime/bin/eventhandler.h ('k') | dart/runtime/bin/eventhandler_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698