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

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

Issue 81013002: Cleanup the getting and setting of the socket file descriptor (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Correctly rebased Created 7 years 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 | « no previous file | runtime/bin/process.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) 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 #include "bin/thread.h" 8 #include "bin/thread.h"
9 9
10 #include "include/dart_api.h" 10 #include "include/dart_api.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 /* 83 /*
84 * Send data to the EventHandler thread to register for a given instance 84 * Send data to the EventHandler thread to register for a given instance
85 * args[0] a ReceivePort args[1] with a notification event args[2]. 85 * args[0] a ReceivePort args[1] with a notification event args[2].
86 */ 86 */
87 void FUNCTION_NAME(EventHandler_SendData)(Dart_NativeArguments args) { 87 void FUNCTION_NAME(EventHandler_SendData)(Dart_NativeArguments args) {
88 Dart_Handle sender = Dart_GetNativeArgument(args, 0); 88 Dart_Handle sender = Dart_GetNativeArgument(args, 0);
89 intptr_t id = kInvalidId; 89 intptr_t id = kInvalidId;
90 if (Dart_IsNull(sender)) { 90 if (Dart_IsNull(sender)) {
91 id = kTimerId; 91 id = kTimerId;
92 } else { 92 } else {
93 Socket::GetSocketIdNativeField(sender, &id); 93 id = Socket::GetSocketIdNativeField(sender);
94 } 94 }
95 Dart_Handle handle = Dart_GetNativeArgument(args, 1); 95 Dart_Handle handle = Dart_GetNativeArgument(args, 1);
96 Dart_Port dart_port = 96 Dart_Port dart_port =
97 DartUtils::GetIntegerField(handle, DartUtils::kIdFieldName); 97 DartUtils::GetIntegerField(handle, DartUtils::kIdFieldName);
98 int64_t data = DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 2)); 98 int64_t data = DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 2));
99 if (id == kTimerId && data == 0) { 99 if (id == kTimerId && data == 0) {
100 // This is a 0-timer. Simply queue a 'null' on the port. 100 // This is a 0-timer. Simply queue a 'null' on the port.
101 DartUtils::PostNull(dart_port); 101 DartUtils::PostNull(dart_port);
102 } else { 102 } else {
103 event_handler->SendData(id, dart_port, data); 103 event_handler->SendData(id, dart_port, data);
104 } 104 }
105 } 105 }
106 106
107 } // namespace bin 107 } // namespace bin
108 } // namespace dart 108 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/process.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698