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

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

Issue 12614014: Add setNoDelay method on Socket/RawSocket. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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/io_buffer.h" 5 #include "bin/io_buffer.h"
6 #include "bin/socket.h" 6 #include "bin/socket.h"
7 #include "bin/dartutils.h" 7 #include "bin/dartutils.h"
8 #include "bin/thread.h" 8 #include "bin/thread.h"
9 #include "bin/utils.h" 9 #include "bin/utils.h"
10 10
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 Dart_Port service_port = Socket::GetServicePort(); 438 Dart_Port service_port = Socket::GetServicePort();
439 if (service_port != ILLEGAL_PORT) { 439 if (service_port != ILLEGAL_PORT) {
440 // Return a send port for the service port. 440 // Return a send port for the service port.
441 Dart_Handle send_port = Dart_NewSendPort(service_port); 441 Dart_Handle send_port = Dart_NewSendPort(service_port);
442 Dart_SetReturnValue(args, send_port); 442 Dart_SetReturnValue(args, send_port);
443 } 443 }
444 Dart_ExitScope(); 444 Dart_ExitScope();
445 } 445 }
446 446
447 447
448 void FUNCTION_NAME(Socket_SetNoDelay)(Dart_NativeArguments args) {
449 Dart_EnterScope();
450 Dart_Handle socket_obj = Dart_GetNativeArgument(args, 0);
451 intptr_t socket = 0;
452 Dart_Handle err = Socket::GetSocketIdNativeField(socket_obj, &socket);
453 if (Dart_IsError(err)) {
454 Dart_SetReturnValue(args, Dart_NewBoolean(false));
455 } else {
456 Dart_Handle enabled_obj = Dart_GetNativeArgument(args, 1);
457 bool enabled;
458 err = Dart_BooleanValue(enabled_obj, &enabled);
459 if (Dart_IsError(err)) {
460 Dart_SetReturnValue(args, Dart_NewBoolean(false));
461 } else {
462 bool result = Socket::SetNoDelay(socket, enabled);
463 Dart_SetReturnValue(args, Dart_NewBoolean(result));
464 }
465 }
466 Dart_ExitScope();
467 }
468
469
448 Dart_Handle Socket::SetSocketIdNativeField(Dart_Handle socket, intptr_t id) { 470 Dart_Handle Socket::SetSocketIdNativeField(Dart_Handle socket, intptr_t id) {
449 return Dart_SetNativeInstanceField(socket, kSocketIdNativeField, id); 471 return Dart_SetNativeInstanceField(socket, kSocketIdNativeField, id);
450 } 472 }
451 473
452 474
453 Dart_Handle Socket::GetSocketIdNativeField(Dart_Handle socket, intptr_t* id) { 475 Dart_Handle Socket::GetSocketIdNativeField(Dart_Handle socket, intptr_t* id) {
454 return Dart_GetNativeInstanceField(socket, kSocketIdNativeField, id); 476 return Dart_GetNativeInstanceField(socket, kSocketIdNativeField, id);
455 } 477 }
OLDNEW
« no previous file with comments | « runtime/bin/socket.h ('k') | runtime/bin/socket_linux.cc » ('j') | sdk/lib/io/socket.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698