| OLD | NEW |
| 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 "platform/globals.h" | 5 #include "platform/globals.h" |
| 6 | 6 |
| 7 #include "include/dart_tools_api.h" | 7 #include "include/dart_tools_api.h" |
| 8 #include "vm/dart_api_impl.h" | 8 #include "vm/dart_api_impl.h" |
| 9 #include "vm/dart_entry.h" | 9 #include "vm/dart_entry.h" |
| 10 #include "vm/debugger.h" | 10 #include "vm/debugger.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 ~ServiceTestMessageHandler() { | 28 ~ServiceTestMessageHandler() { |
| 29 free(_msg); | 29 free(_msg); |
| 30 } | 30 } |
| 31 | 31 |
| 32 MessageStatus HandleMessage(Message* message) { | 32 MessageStatus HandleMessage(Message* message) { |
| 33 if (_msg != NULL) { | 33 if (_msg != NULL) { |
| 34 free(_msg); | 34 free(_msg); |
| 35 } | 35 } |
| 36 | 36 |
| 37 // Parse the message. | 37 // Parse the message. |
| 38 Thread* thread = Thread::Current(); | |
| 39 MessageSnapshotReader reader(message->data(), message->len(), thread); | |
| 40 const Object& response_obj = Object::Handle(reader.ReadObject()); | |
| 41 String& response = String::Handle(); | 38 String& response = String::Handle(); |
| 39 Object& response_obj = Object::Handle(); |
| 40 if (message->IsRaw()) { |
| 41 response_obj = message->raw_obj(); |
| 42 } else { |
| 43 Thread* thread = Thread::Current(); |
| 44 MessageSnapshotReader reader(message->data(), message->len(), thread); |
| 45 response_obj = reader.ReadObject(); |
| 46 } |
| 42 response ^= response_obj.raw(); | 47 response ^= response_obj.raw(); |
| 43 _msg = strdup(response.ToCString()); | 48 _msg = strdup(response.ToCString()); |
| 44 return kOK; | 49 return kOK; |
| 45 } | 50 } |
| 46 | 51 |
| 47 const char* msg() const { return _msg; } | 52 const char* msg() const { return _msg; } |
| 48 | 53 |
| 49 virtual Isolate* isolate() const { return Isolate::Current(); } | 54 virtual Isolate* isolate() const { return Isolate::Current(); } |
| 50 | 55 |
| 51 private: | 56 private: |
| (...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 Eval(lib, "[0, port, '0', '_getCpuProfile', ['tags'], ['Bogus']]"); | 633 Eval(lib, "[0, port, '0', '_getCpuProfile', ['tags'], ['Bogus']]"); |
| 629 Service::HandleIsolateMessage(isolate, service_msg); | 634 Service::HandleIsolateMessage(isolate, service_msg); |
| 630 EXPECT_EQ(MessageHandler::kOK, handler.HandleNextMessage()); | 635 EXPECT_EQ(MessageHandler::kOK, handler.HandleNextMessage()); |
| 631 // Expect error. | 636 // Expect error. |
| 632 EXPECT_SUBSTRING("\"error\"", handler.msg()); | 637 EXPECT_SUBSTRING("\"error\"", handler.msg()); |
| 633 } | 638 } |
| 634 | 639 |
| 635 #endif // !defined(TARGET_ARCH_ARM64) | 640 #endif // !defined(TARGET_ARCH_ARM64) |
| 636 | 641 |
| 637 } // namespace dart | 642 } // namespace dart |
| OLD | NEW |