Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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/dartutils.h" | 5 #include "bin/dartutils.h" |
| 6 | 6 |
| 7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
| 8 | 8 |
| 9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
| 10 #include "platform/globals.h" | 10 #include "platform/globals.h" |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 235 bool bytes_written = file_stream->WriteFully(buffer, num_bytes); | 235 bool bytes_written = file_stream->WriteFully(buffer, num_bytes); |
| 236 ASSERT(bytes_written); | 236 ASSERT(bytes_written); |
| 237 } | 237 } |
| 238 | 238 |
| 239 | 239 |
| 240 void DartUtils::CloseFile(void* stream) { | 240 void DartUtils::CloseFile(void* stream) { |
| 241 delete reinterpret_cast<File*>(stream); | 241 delete reinterpret_cast<File*>(stream); |
| 242 } | 242 } |
| 243 | 243 |
| 244 | 244 |
| 245 // Writes string into socket. | 245 static Dart_Handle SingleArgDart_Invoke(Dart_Handle arg, Dart_Handle lib, |
| 246 // Return < 0 indicates an error. | 246 const char* method) { |
| 247 // Return >= 0 number of bytes written. | 247 const int kNumArgs = 1; |
| 248 static intptr_t SocketWriteString(intptr_t socket, const char* str, | 248 Dart_Handle dart_args[kNumArgs]; |
| 249 intptr_t len) { | 249 dart_args[0] = arg; |
| 250 int r; | 250 return Dart_Invoke(lib, DartUtils::NewString(method), kNumArgs, dart_args); |
| 251 intptr_t cursor = 0; | |
| 252 do { | |
| 253 r = Socket::Write(socket, &str[cursor], len); | |
| 254 if (r < 0) { | |
| 255 return r; | |
| 256 } | |
| 257 cursor += r; | |
| 258 len -= r; | |
| 259 } while (len > 0); | |
| 260 ASSERT(len == 0); | |
| 261 return cursor; | |
| 262 } | 251 } |
| 263 | 252 |
| 264 | 253 |
| 265 static uint8_t* SocketReadUntilEOF(intptr_t socket, intptr_t* response_len) { | |
| 266 const intptr_t kInitialBufferSize = 16 * KB; | |
| 267 intptr_t buffer_size = kInitialBufferSize; | |
| 268 uint8_t* buffer = reinterpret_cast<uint8_t*>(malloc(buffer_size)); | |
| 269 ASSERT(buffer != NULL); | |
| 270 intptr_t buffer_cursor = 0; | |
| 271 do { | |
| 272 int bytes_read = Socket::Read(socket, &buffer[buffer_cursor], | |
| 273 buffer_size - buffer_cursor - 1); | |
| 274 if (bytes_read < 0) { | |
| 275 free(buffer); | |
| 276 return NULL; | |
| 277 } | |
| 278 | |
| 279 buffer_cursor += bytes_read; | |
| 280 | |
| 281 if (bytes_read == 0) { | |
| 282 *response_len = buffer_cursor; | |
| 283 buffer[buffer_cursor] = '\0'; | |
| 284 break; | |
| 285 } | |
| 286 | |
| 287 // There is still more data to be read, check that we have room in the | |
| 288 // buffer for more data. | |
| 289 if (buffer_cursor == buffer_size - 1) { | |
| 290 // Buffer is full. Increase buffer size. | |
| 291 buffer_size *= 2; | |
| 292 buffer = reinterpret_cast<uint8_t*>(realloc(buffer, buffer_size)); | |
| 293 ASSERT(buffer != NULL); | |
| 294 } | |
| 295 } while (true); | |
| 296 return buffer; | |
| 297 } | |
| 298 | |
| 299 | |
| 300 static bool HttpGetRequestOkay(const char* response) { | |
| 301 static const char* kOkayReply = "HTTP/1.0 200 OK"; | |
| 302 static const intptr_t kOkayReplyLen = strlen(kOkayReply); | |
| 303 return (strncmp(response, kOkayReply, kOkayReplyLen) == 0); | |
| 304 } | |
| 305 | |
| 306 | |
| 307 static const uint8_t* HttpRequestGetPayload(const char* response) { | |
| 308 const char* split = strstr(response, "\r\n\r\n"); | |
| 309 if (split != NULL) { | |
| 310 return reinterpret_cast<const uint8_t*>(split+4); | |
| 311 } | |
| 312 return NULL; | |
| 313 } | |
| 314 | |
| 315 | |
| 316 // TODO(iposva): Allocate from the zone instead of leaking error string | 254 // TODO(iposva): Allocate from the zone instead of leaking error string |
| 317 // here. On the other hand the binary is about the exit anyway. | 255 // here. On the other hand the binary is about the exit anyway. |
| 318 #define SET_ERROR_MSG(error_msg, format, ...) \ | 256 #define SET_ERROR_MSG(error_msg, format, ...) \ |
| 319 intptr_t len = snprintf(NULL, 0, format, __VA_ARGS__); \ | 257 intptr_t len = snprintf(NULL, 0, format, __VA_ARGS__); \ |
| 320 char *msg = reinterpret_cast<char*>(malloc(len + 1)); \ | 258 char *msg = reinterpret_cast<char*>(malloc(len + 1)); \ |
| 321 snprintf(msg, len + 1, format, __VA_ARGS__); \ | 259 snprintf(msg, len + 1, format, __VA_ARGS__); \ |
| 322 *error_msg = msg | 260 *error_msg = msg |
| 323 | 261 |
| 324 | 262 |
| 325 static const uint8_t* HttpGetRequest(const char* host, const char* path, | 263 Dart_Handle MakeHttpRequest(Dart_Handle uri, Dart_Handle builtin_lib, |
| 326 int port, intptr_t* response_len, | 264 uint8_t** buffer, intptr_t* buffer_len) { |
| 327 const char** error_msg) { | 265 const intptr_t HttpResponseCodeOK = 200; |
| 328 OSError* error = NULL; | 266 ASSERT(buffer != NULL); |
| 329 SocketAddresses* addresses = Socket::LookupAddress(host, -1, &error); | 267 ASSERT(buffer_len != NULL); |
| 330 if (addresses == NULL || addresses->count() == 0) { | 268 ASSERT(!Dart_HasLivePorts()); |
| 331 SET_ERROR_MSG(error_msg, "Unable to resolve %s", host); | 269 SingleArgDart_Invoke(uri, builtin_lib, "_makeHttpRequest"); |
| 332 return NULL; | 270 // Run until all ports to isolate are closed. |
| 333 } | 271 Dart_Handle result = Dart_RunLoop(); |
| 334 | |
| 335 int preferred_address = 0; | |
| 336 for (int i = 0; i < addresses->count(); i++) { | |
| 337 SocketAddress* address = addresses->GetAt(i); | |
| 338 if (address->GetType() == SocketAddress::ADDRESS_LOOPBACK_IP_V4) { | |
| 339 // Prefer the IP_V4 loop back. | |
| 340 preferred_address = i; | |
| 341 break; | |
| 342 } | |
| 343 } | |
| 344 | |
| 345 RawAddr addr = addresses->GetAt(preferred_address)->addr(); | |
| 346 intptr_t tcp_client = Socket::Create(addr); | |
| 347 if (tcp_client < 0) { | |
| 348 SET_ERROR_MSG(error_msg, "Unable to create socket to %s:%d", host, port); | |
| 349 return NULL; | |
| 350 } | |
| 351 Socket::Connect(tcp_client, addr, port); | |
| 352 if (tcp_client < 0) { | |
| 353 SET_ERROR_MSG(error_msg, "Unable to connect to %s:%d", host, port); | |
| 354 return NULL; | |
| 355 } | |
| 356 // Send get request. | |
| 357 { | |
| 358 const char* format = | |
| 359 "GET %s HTTP/1.0\r\nUser-Agent: Dart VM\r\nHost: %s\r\n\r\n"; | |
| 360 intptr_t len = snprintf(NULL, 0, format, path, host); | |
| 361 char* get_request = reinterpret_cast<char*>(malloc(len + 1)); | |
| 362 snprintf(get_request, len + 1, format, path, host); | |
| 363 intptr_t r = SocketWriteString(tcp_client, get_request, len); | |
| 364 free(get_request); | |
| 365 if (r < len) { | |
| 366 SET_ERROR_MSG(error_msg, "Unable to write to %s:%d - %d", host, port, | |
| 367 static_cast<int>(r)); | |
| 368 Socket::Close(tcp_client); | |
| 369 return NULL; | |
| 370 } | |
| 371 ASSERT(r == len); | |
| 372 } | |
| 373 // Consume response. | |
| 374 uint8_t* response = SocketReadUntilEOF(tcp_client, response_len); | |
| 375 // Close socket. | |
| 376 Socket::Close(tcp_client); | |
| 377 if (response == NULL) { | |
| 378 SET_ERROR_MSG(error_msg, "Unable to read from %s:%d", host, port); | |
| 379 return NULL; | |
| 380 } | |
| 381 if (HttpGetRequestOkay(reinterpret_cast<const char*>(response)) == false) { | |
| 382 SET_ERROR_MSG(error_msg, "Invalid HTTP response from %s:%d", host, port); | |
| 383 free(response); | |
| 384 return NULL; | |
| 385 } | |
| 386 return response; | |
| 387 } | |
| 388 | |
| 389 | |
| 390 static Dart_Handle ParseHttpUri(const char* script_uri, const char** host_str, | |
| 391 int64_t* port_int, const char** path_str) { | |
| 392 ASSERT(script_uri != NULL); | |
| 393 ASSERT(host_str != NULL); | |
| 394 ASSERT(port_int != NULL); | |
| 395 ASSERT(path_str != NULL); | |
| 396 Dart_Handle result; | |
| 397 Dart_Handle uri = DartUtils::NewString(script_uri); | |
| 398 Dart_Handle builtin_lib = | |
| 399 Builtin::LoadAndCheckLibrary(Builtin::kBuiltinLibrary); | |
| 400 Dart_Handle path = DartUtils::PathFromUri(uri, builtin_lib); | |
| 401 if (Dart_IsError(path)) { | |
| 402 return path; | |
| 403 } | |
| 404 Dart_Handle host = DartUtils::DomainFromUri(uri, builtin_lib); | |
| 405 if (Dart_IsError(host)) { | |
| 406 return host; | |
| 407 } | |
| 408 Dart_Handle port = DartUtils::PortFromUri(uri, builtin_lib); | |
| 409 if (Dart_IsError(port)) { | |
| 410 return port; | |
| 411 } | |
| 412 result = Dart_StringToCString(path, path_str); | |
| 413 if (Dart_IsError(result)) { | 272 if (Dart_IsError(result)) { |
| 414 return result; | 273 return result; |
| 415 } | 274 } |
| 416 result = Dart_StringToCString(host, host_str); | 275 intptr_t responseCode = |
| 276 DartUtils::GetIntegerField(builtin_lib, "_httpRequestResponseCode"); | |
| 277 if (responseCode != HttpResponseCodeOK) { | |
| 278 // Return error. | |
| 279 Dart_Handle responseStatus = | |
| 280 Dart_GetField(builtin_lib, | |
| 281 DartUtils::NewString("_httpRequestStatusString")); | |
| 282 if (Dart_IsError(responseStatus)) { | |
| 283 return responseStatus; | |
| 284 } | |
| 285 if (Dart_IsNull(responseStatus)) { | |
| 286 return Dart_Error("HTTP error."); | |
| 287 } | |
| 288 return Dart_Error(DartUtils::GetStringValue(responseStatus)); | |
| 289 } | |
| 290 Dart_Handle responseList = | |
| 291 Dart_GetField(builtin_lib, DartUtils::NewString("_httpRequestResponse")); | |
| 292 if (Dart_IsError(responseList)) { | |
| 293 return responseList; | |
| 294 } | |
| 295 // Query list length. | |
| 296 result = Dart_ListLength(responseList, buffer_len); | |
| 417 if (Dart_IsError(result)) { | 297 if (Dart_IsError(result)) { |
| 298 *buffer_len = 0; | |
| 299 *buffer = NULL; | |
| 418 return result; | 300 return result; |
| 419 } | 301 } |
| 420 if (DartUtils::GetInt64Value(port, port_int) == false) { | 302 // Get payload as bytes. |
| 421 return Dart_Error("Invalid port"); | 303 *buffer = reinterpret_cast<uint8_t*>(malloc(*buffer_len)); |
| 304 result = Dart_ListGetAsBytes(responseList, 0, *buffer, *buffer_len); | |
| 305 if (Dart_IsError(result)) { | |
| 306 free(*buffer); | |
| 307 *buffer_len = 0; | |
| 308 *buffer = NULL; | |
| 309 return result; | |
| 422 } | 310 } |
| 423 return result; | 311 return result; |
| 424 } | 312 } |
| 425 | 313 |
| 426 | 314 |
| 427 Dart_Handle DartUtils::ReadStringFromHttp(const char* script_uri) { | 315 Dart_Handle DartUtils::ReadStringFromHttp(const char* script_uri) { |
| 428 const char* host_str = NULL; | 316 Dart_Handle uri = NewString(script_uri); |
| 429 int64_t port_int = 0; | 317 if (Dart_IsError(uri)) { |
| 430 const char* path_str = NULL; | 318 return uri; |
| 431 Dart_Handle result = ParseHttpUri(script_uri, &host_str, &port_int, | 319 } |
| 432 &path_str); | 320 Dart_Handle builtin_lib = |
| 321 Builtin::LoadAndCheckLibrary(Builtin::kBuiltinLibrary); | |
| 322 uint8_t* buffer; | |
| 323 intptr_t bufferLen; | |
| 324 Dart_Handle result = MakeHttpRequest(uri, builtin_lib, &buffer, &bufferLen); | |
| 433 if (Dart_IsError(result)) { | 325 if (Dart_IsError(result)) { |
| 434 return result; | 326 return result; |
| 435 } | 327 } |
| 436 const char* error_msg = NULL; | 328 Dart_Handle str = Dart_NewStringFromUTF8(buffer, |
| 437 intptr_t len; | 329 bufferLen); |
|
Søren Gjesse
2013/06/03 09:20:00
By using the HttpBodyHandler the supported charset
| |
| 438 const uint8_t* text_buffer = HttpGetRequest(host_str, path_str, port_int, | 330 free(buffer); |
| 439 &len, &error_msg); | |
| 440 if (text_buffer == NULL) { | |
| 441 return Dart_Error(error_msg); | |
| 442 } | |
| 443 const uint8_t* payload = HttpRequestGetPayload( | |
| 444 reinterpret_cast<const char*>(text_buffer)); | |
| 445 if (payload == NULL) { | |
| 446 return Dart_Error("Invalid HTTP response."); | |
| 447 } | |
| 448 // Subtract HTTP response from length. | |
| 449 len -= (payload-text_buffer); | |
| 450 ASSERT(len >= 0); | |
| 451 Dart_Handle str = Dart_NewStringFromUTF8(payload, len); | |
| 452 return str; | 331 return str; |
| 453 } | 332 } |
| 454 | 333 |
| 455 | 334 |
| 456 static const uint8_t* ReadFileFully(const char* filename, | 335 static const uint8_t* ReadFileFully(const char* filename, |
| 457 intptr_t* file_len, | 336 intptr_t* file_len, |
| 458 const char** error_msg) { | 337 const char** error_msg) { |
| 459 void* stream = DartUtils::OpenFile(filename, false); | 338 void* stream = DartUtils::OpenFile(filename, false); |
| 460 if (stream == NULL) { | 339 if (stream == NULL) { |
| 461 SET_ERROR_MSG(error_msg, "Unable to open file: %s", filename); | 340 SET_ERROR_MSG(error_msg, "Unable to open file: %s", filename); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 505 Dart_Handle dart_args[kNumArgs]; | 384 Dart_Handle dart_args[kNumArgs]; |
| 506 dart_args[0] = script_uri; | 385 dart_args[0] = script_uri; |
| 507 dart_args[1] = (IsWindowsHost() ? Dart_True() : Dart_False()); | 386 dart_args[1] = (IsWindowsHost() ? Dart_True() : Dart_False()); |
| 508 return Dart_Invoke(builtin_lib, | 387 return Dart_Invoke(builtin_lib, |
| 509 NewString("_filePathFromUri"), | 388 NewString("_filePathFromUri"), |
| 510 kNumArgs, | 389 kNumArgs, |
| 511 dart_args); | 390 dart_args); |
| 512 } | 391 } |
| 513 | 392 |
| 514 | 393 |
| 515 static Dart_Handle SingleArgDart_Invoke(Dart_Handle arg, Dart_Handle lib, | |
| 516 const char* method) { | |
| 517 const int kNumArgs = 1; | |
| 518 Dart_Handle dart_args[kNumArgs]; | |
| 519 dart_args[0] = arg; | |
| 520 return Dart_Invoke(lib, DartUtils::NewString(method), kNumArgs, dart_args); | |
| 521 } | |
| 522 | |
| 523 Dart_Handle DartUtils::PathFromUri(Dart_Handle script_uri, | |
| 524 Dart_Handle builtin_lib) { | |
| 525 return SingleArgDart_Invoke(script_uri, builtin_lib, "_pathFromHttpUri"); | |
| 526 } | |
| 527 | |
| 528 | |
| 529 Dart_Handle DartUtils::DomainFromUri(Dart_Handle script_uri, | |
| 530 Dart_Handle builtin_lib) { | |
| 531 return SingleArgDart_Invoke(script_uri, builtin_lib, "_domainFromHttpUri"); | |
| 532 } | |
| 533 | |
| 534 | |
| 535 Dart_Handle DartUtils::PortFromUri(Dart_Handle script_uri, | |
| 536 Dart_Handle builtin_lib) { | |
| 537 return SingleArgDart_Invoke(script_uri, builtin_lib, "_portFromHttpUri"); | |
| 538 } | |
| 539 | |
| 540 | |
| 541 Dart_Handle DartUtils::ResolveUri(Dart_Handle library_url, | 394 Dart_Handle DartUtils::ResolveUri(Dart_Handle library_url, |
| 542 Dart_Handle url, | 395 Dart_Handle url, |
| 543 Dart_Handle builtin_lib) { | 396 Dart_Handle builtin_lib) { |
| 544 const int kNumArgs = 2; | 397 const int kNumArgs = 2; |
| 545 Dart_Handle dart_args[kNumArgs]; | 398 Dart_Handle dart_args[kNumArgs]; |
| 546 dart_args[0] = library_url; | 399 dart_args[0] = library_url; |
| 547 dart_args[1] = url; | 400 dart_args[1] = url; |
| 548 return Dart_Invoke( | 401 return Dart_Invoke( |
| 549 builtin_lib, NewString("_resolveUri"), kNumArgs, dart_args); | 402 builtin_lib, NewString("_resolveUri"), kNumArgs, dart_args); |
| 550 } | 403 } |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 658 } | 511 } |
| 659 | 512 |
| 660 | 513 |
| 661 void DartUtils::WriteMagicNumber(File* file) { | 514 void DartUtils::WriteMagicNumber(File* file) { |
| 662 // Write a magic number and version information into the snapshot file. | 515 // Write a magic number and version information into the snapshot file. |
| 663 bool bytes_written = file->WriteFully(magic_number, sizeof(magic_number)); | 516 bool bytes_written = file->WriteFully(magic_number, sizeof(magic_number)); |
| 664 ASSERT(bytes_written); | 517 ASSERT(bytes_written); |
| 665 } | 518 } |
| 666 | 519 |
| 667 | 520 |
| 668 Dart_Handle DartUtils::LoadScriptHttp(const char* script_uri, | 521 Dart_Handle DartUtils::LoadScriptHttp(Dart_Handle uri, |
| 669 Dart_Handle builtin_lib) { | 522 Dart_Handle builtin_lib) { |
| 670 Dart_Handle uri = NewString(script_uri); | 523 intptr_t len = 0; |
| 671 if (Dart_IsError(uri)) { | 524 uint8_t* buffer = NULL; |
| 672 return uri; | 525 Dart_Handle result = MakeHttpRequest(uri, builtin_lib, &buffer, &len); |
| 673 } | |
| 674 const char* host_str = NULL; | |
| 675 int64_t port_int = 0; | |
| 676 const char* path_str = NULL; | |
| 677 Dart_Handle result = ParseHttpUri(script_uri, &host_str, &port_int, | |
| 678 &path_str); | |
| 679 if (Dart_IsError(result)) { | 526 if (Dart_IsError(result)) { |
| 680 return result; | 527 return result; |
| 681 } | 528 } |
| 682 const char* error_msg = NULL; | 529 const uint8_t* payload = buffer; |
| 683 intptr_t len; | |
| 684 const uint8_t* text_buffer; | |
| 685 text_buffer = HttpGetRequest(host_str, path_str, port_int, &len, | |
| 686 &error_msg); | |
| 687 if (text_buffer == NULL) { | |
| 688 return Dart_Error(error_msg); | |
| 689 } | |
| 690 const uint8_t* payload = HttpRequestGetPayload( | |
| 691 reinterpret_cast<const char*>(text_buffer)); | |
| 692 if (payload == NULL) { | |
| 693 return Dart_Error("Invalid HTTP response."); | |
| 694 } | |
| 695 // Subtract HTTP response from length. | |
| 696 len -= (payload-text_buffer); | |
| 697 ASSERT(len >= 0); | |
| 698 // At this point we have received a valid HTTP 200 reply and | |
| 699 // payload points at the beginning of the script or snapshot. | |
| 700 bool is_snapshot = false; | 530 bool is_snapshot = false; |
| 701 payload = SniffForMagicNumber(payload, &len, &is_snapshot); | 531 payload = SniffForMagicNumber(payload, &len, &is_snapshot); |
| 702 if (is_snapshot) { | 532 if (is_snapshot) { |
| 703 return Dart_LoadScriptFromSnapshot(payload, len); | 533 return Dart_LoadScriptFromSnapshot(payload, len); |
| 704 } else { | 534 } else { |
| 705 Dart_Handle source = Dart_NewStringFromUTF8(payload, len); | 535 Dart_Handle source = Dart_NewStringFromUTF8(payload, len); |
| 706 if (Dart_IsError(source)) { | 536 if (Dart_IsError(source)) { |
| 707 return source; | 537 return source; |
| 708 } | 538 } |
| 709 return Dart_LoadScript(uri, source, 0, 0); | 539 return Dart_LoadScript(uri, source, 0, 0); |
| 710 } | 540 } |
| 711 } | 541 } |
| 712 | 542 |
| 713 | 543 |
| 714 Dart_Handle DartUtils::LoadScript(const char* script_uri, | 544 Dart_Handle DartUtils::LoadScript(const char* script_uri, |
| 715 Dart_Handle builtin_lib) { | 545 Dart_Handle builtin_lib) { |
| 716 if (DartUtils::IsHttpSchemeURL(script_uri)) { | 546 if (DartUtils::IsHttpSchemeURL(script_uri)) { |
| 717 return LoadScriptHttp(script_uri, builtin_lib); | 547 return LoadScriptHttp(NewString(script_uri), builtin_lib); |
| 718 } | 548 } |
| 719 Dart_Handle resolved_script_uri; | 549 Dart_Handle resolved_script_uri; |
| 720 resolved_script_uri = ResolveScriptUri(NewString(script_uri), builtin_lib); | 550 resolved_script_uri = ResolveScriptUri(NewString(script_uri), builtin_lib); |
| 721 if (Dart_IsError(resolved_script_uri)) { | 551 if (Dart_IsError(resolved_script_uri)) { |
| 722 return resolved_script_uri; | 552 return resolved_script_uri; |
| 723 } | 553 } |
| 724 Dart_Handle script_path = DartUtils::FilePathFromUri(resolved_script_uri, | 554 Dart_Handle script_path = DartUtils::FilePathFromUri(resolved_script_uri, |
| 725 builtin_lib); | 555 builtin_lib); |
| 726 if (Dart_IsError(script_path)) { | 556 if (Dart_IsError(script_path)) { |
| 727 return script_path; | 557 return script_path; |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1103 new CObjectString(CObject::NewString(os_error->message())); | 933 new CObjectString(CObject::NewString(os_error->message())); |
| 1104 CObjectArray* result = new CObjectArray(CObject::NewArray(3)); | 934 CObjectArray* result = new CObjectArray(CObject::NewArray(3)); |
| 1105 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError))); | 935 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError))); |
| 1106 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code()))); | 936 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code()))); |
| 1107 result->SetAt(2, error_message); | 937 result->SetAt(2, error_message); |
| 1108 return result; | 938 return result; |
| 1109 } | 939 } |
| 1110 | 940 |
| 1111 } // namespace bin | 941 } // namespace bin |
| 1112 } // namespace dart | 942 } // namespace dart |
| OLD | NEW |