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

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: Changed to be setOption. 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_linux.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);
Søren Gjesse 2013/03/14 12:39:59 Use if (Dart_IsError(err)) Dart_PropagateError(er
Anders Johnsen 2013/03/14 12:45:05 Done.
454 if (!Dart_IsError(err)) {
455 Dart_Handle option_obj = Dart_GetNativeArgument(args, 1);
456 int64_t option;
457 err = Dart_IntegerToInt64(option_obj, &option);
Søren Gjesse 2013/03/14 12:39:59 And here.
Anders Johnsen 2013/03/14 12:45:05 Done.
458 if (!Dart_IsError(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)) {
463 switch (option) {
464 case 0: // TCP_NODELAY.
465 result = Socket::SetNoDelay(socket, enabled);
466 break;
467 default:
468 break;
469 }
470 }
471 }
472 }
473 Dart_SetReturnValue(args, Dart_NewBoolean(result));
474 Dart_ExitScope();
475 }
476
477
448 Dart_Handle Socket::SetSocketIdNativeField(Dart_Handle socket, intptr_t id) { 478 Dart_Handle Socket::SetSocketIdNativeField(Dart_Handle socket, intptr_t id) {
449 return Dart_SetNativeInstanceField(socket, kSocketIdNativeField, id); 479 return Dart_SetNativeInstanceField(socket, kSocketIdNativeField, id);
450 } 480 }
451 481
452 482
453 Dart_Handle Socket::GetSocketIdNativeField(Dart_Handle socket, intptr_t* id) { 483 Dart_Handle Socket::GetSocketIdNativeField(Dart_Handle socket, intptr_t* id) {
454 return Dart_GetNativeInstanceField(socket, kSocketIdNativeField, id); 484 return Dart_GetNativeInstanceField(socket, kSocketIdNativeField, id);
455 } 485 }
OLDNEW
« no previous file with comments | « runtime/bin/socket.h ('k') | runtime/bin/socket_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698