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

Unified Diff: runtime/bin/socket.cc

Issue 11348062: Remove overhead of socket testing flags by storing the value in a static. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/socket.cc
diff --git a/runtime/bin/socket.cc b/runtime/bin/socket.cc
index 8f8d4c99af18989b8aa9fb00d65ccc1a3cdd2fc1..e0e82420b8f7461396e27d514adb8234aaf33888 100644
--- a/runtime/bin/socket.cc
+++ b/runtime/bin/socket.cc
@@ -107,6 +107,7 @@ void FUNCTION_NAME(Socket_Read)(Dart_NativeArguments args) {
void FUNCTION_NAME(Socket_ReadList)(Dart_NativeArguments args) {
Dart_EnterScope();
+ static bool short_socket_reads = Dart_IsVMFlagSet("short_socket_read");
Dart_Handle socket_obj = Dart_GetNativeArgument(args, 0);
intptr_t socket = 0;
Socket::GetSocketIdNativeField(socket_obj, &socket);
@@ -124,7 +125,7 @@ void FUNCTION_NAME(Socket_ReadList)(Dart_NativeArguments args) {
Dart_PropagateError(result);
}
ASSERT((offset + length) <= buffer_len);
- if (Dart_IsVMFlagSet("short_socket_read")) {
+ if (short_socket_reads) {
length = (length + 1) / 2;
}
uint8_t* buffer = new uint8_t[length];
@@ -156,6 +157,7 @@ void FUNCTION_NAME(Socket_ReadList)(Dart_NativeArguments args) {
void FUNCTION_NAME(Socket_WriteList)(Dart_NativeArguments args) {
Dart_EnterScope();
+ static bool short_socket_writes = Dart_IsVMFlagSet("short_socket_write");
Dart_Handle socket_obj = Dart_GetNativeArgument(args, 0);
intptr_t socket = 0;
Socket::GetSocketIdNativeField(socket_obj, &socket);
@@ -172,7 +174,7 @@ void FUNCTION_NAME(Socket_WriteList)(Dart_NativeArguments args) {
}
ASSERT((offset + length) <= buffer_len);
- if (Dart_IsVMFlagSet("short_socket_write")) {
+ if (short_socket_writes) {
length = (length + 1) / 2;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698