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

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

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