| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 OwnPtr<protocol::Runtime::StackTrace> stack = protocol::Runtime::StackTrace:
:create() | 443 OwnPtr<protocol::Runtime::StackTrace> stack = protocol::Runtime::StackTrace:
:create() |
| 444 .setCallFrames(frames.release()).build(); | 444 .setCallFrames(frames.release()).build(); |
| 445 | 445 |
| 446 return stack.release(); | 446 return stack.release(); |
| 447 } | 447 } |
| 448 | 448 |
| 449 void DartInjectedScript::packageObjectResult(Dart_Handle dartHandle, const Strin
g& objectGroup, ErrorString* errorString, bool returnByValue, bool generatePrevi
ew, OwnPtr<protocol::Runtime::RemoteObject>* result, Maybe<bool>* wasThrown) | 449 void DartInjectedScript::packageObjectResult(Dart_Handle dartHandle, const Strin
g& objectGroup, ErrorString* errorString, bool returnByValue, bool generatePrevi
ew, OwnPtr<protocol::Runtime::RemoteObject>* result, Maybe<bool>* wasThrown) |
| 450 { | 450 { |
| 451 ASSERT(Dart_IsInstance(dartHandle) || Dart_IsNull(dartHandle)); | 451 ASSERT(Dart_IsInstance(dartHandle) || Dart_IsNull(dartHandle)); |
| 452 | 452 |
| 453 *result = NULL; | |
| 454 | |
| 455 // FIXMEDART: support returnByValue for Dart types that are expressible as J
SON. | 453 // FIXMEDART: support returnByValue for Dart types that are expressible as J
SON. |
| 456 bool wasThrownVal = false; | 454 bool wasThrownVal = false; |
| 457 Dart_Handle exception = 0; | 455 Dart_Handle exception = 0; |
| 458 if (Dart_IsError(dartHandle)) { | 456 if (Dart_IsError(dartHandle)) { |
| 459 wasThrownVal = true; | 457 wasThrownVal = true; |
| 460 Dart_Handle exception = Dart_ErrorGetException(dartHandle); | 458 Dart_Handle exception = Dart_ErrorGetException(dartHandle); |
| 461 ASSERT(Dart_IsInstance(exception)); | 459 ASSERT(Dart_IsInstance(exception)); |
| 462 if (!Dart_IsInstance(exception)) { | 460 if (!Dart_IsInstance(exception)) { |
| 463 *errorString = Dart_GetError(dartHandle); | 461 *errorString = Dart_GetError(dartHandle); |
| 464 return; | 462 return; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 if (exception) { | 502 if (exception) { |
| 505 description = String::format("Instance of '%s'", typeName.utf8().dat
a()); | 503 description = String::format("Instance of '%s'", typeName.utf8().dat
a()); |
| 506 exception = 0; | 504 exception = 0; |
| 507 } | 505 } |
| 508 ASSERT(!exception); | 506 ASSERT(!exception); |
| 509 | 507 |
| 510 if (DartUtilities::isNode(dartHandle)) | 508 if (DartUtilities::isNode(dartHandle)) |
| 511 isNode = true; | 509 isNode = true; |
| 512 } | 510 } |
| 513 | 511 |
| 514 const char* remoteType; | 512 const char* remoteType = nullptr; |
| 515 const char* remoteSubType = nullptr; | 513 const char* remoteSubType = nullptr; |
| 516 switch (value->type()) { | 514 switch (value->type()) { |
| 517 case protocol::Value::TypeBoolean: | 515 case protocol::Value::TypeBoolean: |
| 518 remoteType = protocol::Runtime::RemoteObject::TypeEnum::Boolean; | 516 remoteType = protocol::Runtime::RemoteObject::TypeEnum::Boolean; |
| 519 break; | 517 break; |
| 520 case protocol::Value::TypeNumber: | 518 case protocol::Value::TypeNumber: |
| 521 remoteType = protocol::Runtime::RemoteObject::TypeEnum::Number; | 519 remoteType = protocol::Runtime::RemoteObject::TypeEnum::Number; |
| 522 break; | 520 break; |
| 523 case protocol::Value::TypeString: | 521 case protocol::Value::TypeString: |
| 524 remoteType = protocol::Runtime::RemoteObject::TypeEnum::String; | 522 remoteType = protocol::Runtime::RemoteObject::TypeEnum::String; |
| 525 break; | 523 break; |
| 526 case protocol::Value::TypeObject: | 524 case protocol::Value::TypeObject: |
| 527 remoteType = protocol::Runtime::RemoteObject::TypeEnum::Object; | 525 remoteType = protocol::Runtime::RemoteObject::TypeEnum::Object; |
| 528 break; | 526 break; |
| 529 case protocol::Value::TypeArray: | 527 case protocol::Value::TypeArray: |
| 530 remoteType = protocol::Runtime::RemoteObject::TypeEnum::Object; | 528 remoteType = protocol::Runtime::RemoteObject::TypeEnum::Object; |
| 531 remoteSubType = protocol::Runtime::RemoteObject::SubtypeEnum::Array; | 529 remoteSubType = protocol::Runtime::RemoteObject::SubtypeEnum::Array; |
| 532 break; | 530 break; |
| 533 case protocol::Value::TypeNull: | 531 case protocol::Value::TypeNull: |
| 534 default: | 532 default: |
| 535 remoteType = protocol::Runtime::RemoteObject::TypeEnum::Object; | 533 remoteType = protocol::Runtime::RemoteObject::TypeEnum::Object; |
| 536 remoteSubType = protocol::Runtime::RemoteObject::SubtypeEnum::Null; | |
| 537 break; | 534 break; |
| 538 } | 535 } |
| 539 | 536 |
| 540 OwnPtr<protocol::Runtime::RemoteObject> remoteObject = protocol::Runtime::Re
moteObject::create() | 537 OwnPtr<protocol::Runtime::RemoteObject> remoteObject = protocol::Runtime::Re
moteObject::create() |
| 541 .setType(remoteType) | 538 .setType(remoteType) |
| 542 .setLanguage("Dart") | 539 .setLanguage("Dart") |
| 543 .setClassName(typeName) | 540 .setClassName(typeName) |
| 544 .setDescription(description) | 541 .setDescription(description) |
| 545 .build(); | 542 .build(); |
| 546 if (value) | 543 if (value) |
| (...skipping 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1548 RefPtr<JSONValue> parsedObjectId = parseJSON(objectId); | 1545 RefPtr<JSONValue> parsedObjectId = parseJSON(objectId); |
| 1549 if (parsedObjectId && parsedObjectId->type() == JSONValue::TypeObject) { | 1546 if (parsedObjectId && parsedObjectId->type() == JSONValue::TypeObject) { |
| 1550 bool isDart = false; | 1547 bool isDart = false; |
| 1551 bool success = JSONObject::cast(parsedObjectId)-> getBoolean("isDart", &
isDart); | 1548 bool success = JSONObject::cast(parsedObjectId)-> getBoolean("isDart", &
isDart); |
| 1552 return success && isDart; | 1549 return success && isDart; |
| 1553 } | 1550 } |
| 1554 return false; | 1551 return false; |
| 1555 } | 1552 } |
| 1556 | 1553 |
| 1557 } // namespace blink | 1554 } // namespace blink |
| OLD | NEW |