| 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 "include/dart_api.h" | 5 #include "include/dart_api.h" |
| 6 #include "include/dart_mirrors_api.h" | 6 #include "include/dart_mirrors_api.h" |
| 7 #include "include/dart_native_api.h" | 7 #include "include/dart_native_api.h" |
| 8 | 8 |
| 9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
| 10 #include "vm/class_finalizer.h" | 10 #include "vm/class_finalizer.h" |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 return Api::NewHandle(isolate, isolate->object_store()->sticky_error()); | 432 return Api::NewHandle(isolate, isolate->object_store()->sticky_error()); |
| 433 } | 433 } |
| 434 | 434 |
| 435 | 435 |
| 436 Dart_Isolate Api::CastIsolate(Isolate* isolate) { | 436 Dart_Isolate Api::CastIsolate(Isolate* isolate) { |
| 437 return reinterpret_cast<Dart_Isolate>(isolate); | 437 return reinterpret_cast<Dart_Isolate>(isolate); |
| 438 } | 438 } |
| 439 | 439 |
| 440 | 440 |
| 441 Dart_Handle Api::NewError(const char* format, ...) { | 441 Dart_Handle Api::NewError(const char* format, ...) { |
| 442 Isolate* isolate = Isolate::Current(); | 442 Thread* thread = Thread::Current(); |
| 443 Isolate* isolate = thread->isolate(); |
| 444 Zone* zone = thread->zone(); |
| 443 DARTSCOPE(isolate); | 445 DARTSCOPE(isolate); |
| 444 CHECK_CALLBACK_STATE(isolate); | 446 CHECK_CALLBACK_STATE(isolate); |
| 445 | 447 |
| 446 va_list args; | 448 va_list args; |
| 447 va_start(args, format); | 449 va_start(args, format); |
| 448 intptr_t len = OS::VSNPrint(NULL, 0, format, args); | 450 intptr_t len = OS::VSNPrint(NULL, 0, format, args); |
| 449 va_end(args); | 451 va_end(args); |
| 450 | 452 |
| 451 char* buffer = isolate->current_zone()->Alloc<char>(len + 1); | 453 char* buffer = zone->Alloc<char>(len + 1); |
| 452 va_list args2; | 454 va_list args2; |
| 453 va_start(args2, format); | 455 va_start(args2, format); |
| 454 OS::VSNPrint(buffer, (len + 1), format, args2); | 456 OS::VSNPrint(buffer, (len + 1), format, args2); |
| 455 va_end(args2); | 457 va_end(args2); |
| 456 | 458 |
| 457 const String& message = String::Handle(isolate, String::New(buffer)); | 459 const String& message = String::Handle(zone, String::New(buffer)); |
| 458 return Api::NewHandle(isolate, ApiError::New(message)); | 460 return Api::NewHandle(isolate, ApiError::New(message)); |
| 459 } | 461 } |
| 460 | 462 |
| 461 | 463 |
| 462 void Api::SetupAcquiredError(Isolate* isolate) { | 464 void Api::SetupAcquiredError(Isolate* isolate) { |
| 463 ASSERT(isolate != NULL); | 465 ASSERT(isolate != NULL); |
| 464 ApiState* state = isolate->api_state(); | 466 ApiState* state = isolate->api_state(); |
| 465 ASSERT(state != NULL); | 467 ASSERT(state != NULL); |
| 466 state->SetupAcquiredError(); | 468 state->SetupAcquiredError(); |
| 467 } | 469 } |
| (...skipping 5319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5787 ASSERT(stream != NULL); | 5789 ASSERT(stream != NULL); |
| 5788 TimelineEvent* event = stream->StartEvent(); | 5790 TimelineEvent* event = stream->StartEvent(); |
| 5789 if (event != NULL) { | 5791 if (event != NULL) { |
| 5790 event->AsyncEnd(label, async_id); | 5792 event->AsyncEnd(label, async_id); |
| 5791 event->Complete(); | 5793 event->Complete(); |
| 5792 } | 5794 } |
| 5793 return Api::Success(); | 5795 return Api::Success(); |
| 5794 } | 5796 } |
| 5795 | 5797 |
| 5796 } // namespace dart | 5798 } // namespace dart |
| OLD | NEW |