| 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/assert.h" | 5 #include "platform/assert.h" |
| 6 | 6 |
| 7 #include "vm/dart_entry.h" | 7 #include "vm/dart_entry.h" |
| 8 #include "vm/debugger.h" | 8 #include "vm/debugger.h" |
| 9 #include "vm/json_stream.h" | 9 #include "vm/json_stream.h" |
| 10 #include "vm/message.h" | 10 #include "vm/message.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 int64_t process_delta_micros = 0; | 82 int64_t process_delta_micros = 0; |
| 83 if (FLAG_trace_service) { | 83 if (FLAG_trace_service) { |
| 84 process_delta_micros = OS::GetCurrentTimeMicros() - setup_time_micros_; | 84 process_delta_micros = OS::GetCurrentTimeMicros() - setup_time_micros_; |
| 85 } | 85 } |
| 86 const String& reply = String::Handle(String::New(ToCString())); | 86 const String& reply = String::Handle(String::New(ToCString())); |
| 87 ASSERT(!reply.IsNull()); | 87 ASSERT(!reply.IsNull()); |
| 88 | 88 |
| 89 uint8_t* data = NULL; | 89 uint8_t* data = NULL; |
| 90 MessageWriter writer(&data, &allocator, false); | 90 MessageWriter writer(&data, &allocator, false); |
| 91 writer.WriteMessage(reply); | 91 writer.WriteMessage(reply); |
| 92 PortMap::PostMessage(new Message(port, data, | 92 bool result = PortMap::PostMessage(new Message(port, data, |
| 93 writer.BytesWritten(), | 93 writer.BytesWritten(), |
| 94 Message::kNormalPriority)); | 94 Message::kNormalPriority)); |
| 95 if (FLAG_trace_service) { | 95 if (FLAG_trace_service) { |
| 96 Isolate* isolate = Isolate::Current(); | 96 Isolate* isolate = Isolate::Current(); |
| 97 ASSERT(isolate != NULL); | 97 ASSERT(isolate != NULL); |
| 98 const char* isolate_name = isolate->name(); | 98 const char* isolate_name = isolate->name(); |
| 99 OS::Print("Isolate %s processed service request %s in %" Pd64" us.\n", | 99 if (result) { |
| 100 isolate_name, method_, process_delta_micros); | 100 OS::Print("Isolate %s processed service request %s in %" Pd64" us.\n", |
| 101 isolate_name, method_, process_delta_micros); |
| 102 } else { |
| 103 OS::Print("Isolate %s FAILED to post response for service request %s.\n", |
| 104 isolate_name, method_); |
| 105 } |
| 101 } | 106 } |
| 102 } | 107 } |
| 103 | 108 |
| 104 | 109 |
| 105 const char* JSONStream::LookupParam(const char* key) const { | 110 const char* JSONStream::LookupParam(const char* key) const { |
| 106 for (int i = 0; i < num_params(); i++) { | 111 for (int i = 0; i < num_params(); i++) { |
| 107 if (!strcmp(key, param_keys_[i])) { | 112 if (!strcmp(key, param_keys_[i])) { |
| 108 return param_values_[i]; | 113 return param_values_[i]; |
| 109 } | 114 } |
| 110 } | 115 } |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 intptr_t len2 = OS::VSNPrint(p, len+1, format, args); | 483 intptr_t len2 = OS::VSNPrint(p, len+1, format, args); |
| 479 va_end(args); | 484 va_end(args); |
| 480 ASSERT(len == len2); | 485 ASSERT(len == len2); |
| 481 stream_->buffer_.AddChar('"'); | 486 stream_->buffer_.AddChar('"'); |
| 482 stream_->AddEscapedUTF8String(p); | 487 stream_->AddEscapedUTF8String(p); |
| 483 stream_->buffer_.AddChar('"'); | 488 stream_->buffer_.AddChar('"'); |
| 484 free(p); | 489 free(p); |
| 485 } | 490 } |
| 486 | 491 |
| 487 } // namespace dart | 492 } // namespace dart |
| OLD | NEW |