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

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
« no previous file with comments | « runtime/bin/socket.h ('k') | runtime/bin/socket_android.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) 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_SetOption)(Dart_NativeArguments args) {
449 Dart_EnterScope();
450 Dart_Handle socket_obj = Dart_GetNativeArgument(args, 0);
451 intptr_t socket = 0;
452 bool result = false;
453 Dart_Handle err = Socket::GetSocketIdNativeField(socket_obj, &socket);
454 if (Dart_IsError(err)) Dart_PropagateError(err);
455 Dart_Handle option_obj = Dart_GetNativeArgument(args, 1);
456 int64_t option;
457 err = Dart_IntegerToInt64(option_obj, &option);
458 if (Dart_IsError(err)) Dart_PropagateError(err);
459 Dart_Handle enabled_obj = Dart_GetNativeArgument(args, 2);
460 bool enabled;
461 err = Dart_BooleanValue(enabled_obj, &enabled);
462 if (Dart_IsError(err)) Dart_PropagateError(err);
463 switch (option) {
464 case 0: // TCP_NODELAY.
465 result = Socket::SetNoDelay(socket, enabled);
466 break;
467 default:
468 break;
469 }
470 Dart_SetReturnValue(args, Dart_NewBoolean(result));
471 Dart_ExitScope();
472 }
473
474
448 Dart_Handle Socket::SetSocketIdNativeField(Dart_Handle socket, intptr_t id) { 475 Dart_Handle Socket::SetSocketIdNativeField(Dart_Handle socket, intptr_t id) {
449 return Dart_SetNativeInstanceField(socket, kSocketIdNativeField, id); 476 return Dart_SetNativeInstanceField(socket, kSocketIdNativeField, id);
450 } 477 }
451 478
452 479
453 Dart_Handle Socket::GetSocketIdNativeField(Dart_Handle socket, intptr_t* id) { 480 Dart_Handle Socket::GetSocketIdNativeField(Dart_Handle socket, intptr_t* id) {
454 return Dart_GetNativeInstanceField(socket, kSocketIdNativeField, id); 481 return Dart_GetNativeInstanceField(socket, kSocketIdNativeField, id);
455 } 482 }
OLDNEW
« no previous file with comments | « runtime/bin/socket.h ('k') | runtime/bin/socket_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698