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

Unified Diff: runtime/bin/eventhandler.cc

Issue 10962012: Use native wrapper fields to store socket ids. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/bin/eventhandler.dart » ('j') | runtime/bin/socket.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/eventhandler.cc
diff --git a/runtime/bin/eventhandler.cc b/runtime/bin/eventhandler.cc
index e091bdc4389fcef4faedc8218b22ba9833523bef..5689676d4f0dfc71bdc457f5925f9a003d1bb704 100644
--- a/runtime/bin/eventhandler.cc
+++ b/runtime/bin/eventhandler.cc
@@ -4,11 +4,14 @@
#include "bin/dartutils.h"
#include "bin/eventhandler.h"
+#include "bin/socket.h"
#include "include/dart_api.h"
-static const intptr_t kNativeEventHandlerFieldIndex = 0;
+static const int kNativeEventHandlerFieldIndex = 0;
+static const intptr_t kTimerId = -1;
+static const intptr_t kInvalidId = -2;
/*
* Returns the reference of the EventHandler stored in the native field.
@@ -59,7 +62,13 @@ void FUNCTION_NAME(EventHandler_SendData)(Dart_NativeArguments args) {
Dart_EnterScope();
Dart_Handle handle = Dart_GetNativeArgument(args, 0);
EventHandler* event_handler = GetEventHandler(handle);
- intptr_t id = DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 1));
+ Dart_Handle sender = Dart_GetNativeArgument(args, 1);
+ intptr_t id = kInvalidId;
+ if (Dart_IsNull(sender)) {
+ id = kTimerId;
+ } else {
+ Socket::GetSocketIdNativeField(sender, &id);
+ }
handle = Dart_GetNativeArgument(args, 2);
Dart_Port dart_port =
DartUtils::GetIntegerField(handle, DartUtils::kIdFieldName);
« no previous file with comments | « no previous file | runtime/bin/eventhandler.dart » ('j') | runtime/bin/socket.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698