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

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

Issue 9249052: Fix type error (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 11 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 | « no previous file | no next file » | 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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/socket.h" 5 #include "bin/socket.h"
6 #include "bin/dartutils.h" 6 #include "bin/dartutils.h"
7 7
8 #include "platform/utils.h" 8 #include "platform/utils.h"
9 9
10 #include "include/dart_api.h" 10 #include "include/dart_api.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 intptr_t buffer_len = 0; 84 intptr_t buffer_len = 0;
85 Dart_Handle result = Dart_ListLength(buffer_obj, &buffer_len); 85 Dart_Handle result = Dart_ListLength(buffer_obj, &buffer_len);
86 ASSERT(!Dart_IsError(result)); 86 ASSERT(!Dart_IsError(result));
87 ASSERT((offset + length) <= buffer_len); 87 ASSERT((offset + length) <= buffer_len);
88 88
89 if (Dart_IsVMFlagSet("short_socket_write")) { 89 if (Dart_IsVMFlagSet("short_socket_write")) {
90 length = (length + 1) / 2; 90 length = (length + 1) / 2;
91 } 91 }
92 92
93 // Send data in chunks of maximum 16KB. 93 // Send data in chunks of maximum 16KB.
94 const intptr_t max_chunk_length = dart::Utils::Minimum(length, 16 * KB); 94 const intptr_t max_chunk_length =
95 dart::Utils::Minimum(length, static_cast<intptr_t>(16 * KB));
95 uint8_t* buffer = new uint8_t[max_chunk_length]; 96 uint8_t* buffer = new uint8_t[max_chunk_length];
96 intptr_t total_bytes_written = 0; 97 intptr_t total_bytes_written = 0;
97 intptr_t bytes_written = 0; 98 intptr_t bytes_written = 0;
98 do { 99 do {
99 intptr_t chunk_length = 100 intptr_t chunk_length =
100 dart::Utils::Minimum(max_chunk_length, length - total_bytes_written); 101 dart::Utils::Minimum(max_chunk_length, length - total_bytes_written);
101 result = Dart_ListGetAsBytes(buffer_obj, 102 result = Dart_ListGetAsBytes(buffer_obj,
102 offset + total_bytes_written, 103 offset + total_bytes_written,
103 buffer, 104 buffer,
104 chunk_length); 105 chunk_length);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 DartUtils::kIdFieldName); 163 DartUtils::kIdFieldName);
163 Dart_Handle socketobj = Dart_GetNativeArgument(args, 1); 164 Dart_Handle socketobj = Dart_GetNativeArgument(args, 1);
164 intptr_t newSocket = ServerSocket::Accept(socket); 165 intptr_t newSocket = ServerSocket::Accept(socket);
165 if (newSocket >= 0) { 166 if (newSocket >= 0) {
166 DartUtils::SetIntegerInstanceField( 167 DartUtils::SetIntegerInstanceField(
167 socketobj, DartUtils::kIdFieldName, newSocket); 168 socketobj, DartUtils::kIdFieldName, newSocket);
168 } 169 }
169 Dart_SetReturnValue(args, Dart_NewBoolean(newSocket >= 0)); 170 Dart_SetReturnValue(args, Dart_NewBoolean(newSocket >= 0));
170 Dart_ExitScope(); 171 Dart_ExitScope();
171 } 172 }
OLDNEW
« 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