Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(583)

Side by Side Diff: runtime/vm/dart_api_impl.cc

Issue 1672853002: Move sticky_error_ from isolate to thread (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: r Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "lib/stacktrace.h" 10 #include "lib/stacktrace.h"
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 452
453 Dart_Handle Api::CheckAndFinalizePendingClasses(Thread* thread) { 453 Dart_Handle Api::CheckAndFinalizePendingClasses(Thread* thread) {
454 Isolate* isolate = thread->isolate(); 454 Isolate* isolate = thread->isolate();
455 if (!isolate->AllowClassFinalization()) { 455 if (!isolate->AllowClassFinalization()) {
456 // Class finalization is blocked for the isolate. Do nothing. 456 // Class finalization is blocked for the isolate. Do nothing.
457 return Api::Success(); 457 return Api::Success();
458 } 458 }
459 if (ClassFinalizer::ProcessPendingClasses()) { 459 if (ClassFinalizer::ProcessPendingClasses()) {
460 return Api::Success(); 460 return Api::Success();
461 } 461 }
462 ASSERT(isolate->object_store()->sticky_error() != Object::null()); 462 ASSERT(thread->sticky_error() != Object::null());
463 return Api::NewHandle(thread, isolate->object_store()->sticky_error()); 463 return Api::NewHandle(thread, thread->sticky_error());
464 } 464 }
465 465
466 466
467 Dart_Isolate Api::CastIsolate(Isolate* isolate) { 467 Dart_Isolate Api::CastIsolate(Isolate* isolate) {
468 return reinterpret_cast<Dart_Isolate>(isolate); 468 return reinterpret_cast<Dart_Isolate>(isolate);
469 } 469 }
470 470
471 471
472 Dart_Handle Api::NewError(const char* format, ...) { 472 Dart_Handle Api::NewError(const char* format, ...) {
473 Thread* T = Thread::Current(); 473 Thread* T = Thread::Current();
(...skipping 1141 matching lines...) Expand 10 before | Expand all | Expand 10 after
1615 data.monitor = &monitor; 1615 data.monitor = &monitor;
1616 data.done = false; 1616 data.done = false;
1617 I->message_handler()->Run( 1617 I->message_handler()->Run(
1618 Dart::thread_pool(), 1618 Dart::thread_pool(),
1619 NULL, RunLoopDone, reinterpret_cast<uword>(&data)); 1619 NULL, RunLoopDone, reinterpret_cast<uword>(&data));
1620 while (!data.done) { 1620 while (!data.done) {
1621 ml.Wait(); 1621 ml.Wait();
1622 } 1622 }
1623 ::Dart_EnterIsolate(Api::CastIsolate(I)); 1623 ::Dart_EnterIsolate(Api::CastIsolate(I));
1624 } 1624 }
1625 if (I->object_store()->sticky_error() != Object::null()) { 1625 if (T->sticky_error() != Object::null()) {
1626 Dart_Handle error = Api::NewHandle(T, I->object_store()->sticky_error()); 1626 Dart_Handle error = Api::NewHandle(T, T->sticky_error());
1627 I->object_store()->clear_sticky_error(); 1627 T->clear_sticky_error();
1628 return error; 1628 return error;
1629 } 1629 }
1630 if (FLAG_print_class_table) { 1630 if (FLAG_print_class_table) {
1631 HANDLESCOPE(T); 1631 HANDLESCOPE(T);
1632 I->class_table()->Print(); 1632 I->class_table()->Print();
1633 } 1633 }
1634 return Api::Success(); 1634 return Api::Success();
1635 } 1635 }
1636 1636
1637 1637
1638 DART_EXPORT Dart_Handle Dart_HandleMessage() { 1638 DART_EXPORT Dart_Handle Dart_HandleMessage() {
1639 Thread* T = Thread::Current(); 1639 Thread* T = Thread::Current();
1640 Isolate* I = T->isolate(); 1640 Isolate* I = T->isolate();
1641 CHECK_API_SCOPE(T); 1641 CHECK_API_SCOPE(T);
1642 CHECK_CALLBACK_STATE(T); 1642 CHECK_CALLBACK_STATE(T);
1643 API_TIMELINE_BEGIN_END; 1643 API_TIMELINE_BEGIN_END;
1644 TransitionNativeToVM transition(T); 1644 TransitionNativeToVM transition(T);
1645 if (I->message_handler()->HandleNextMessage() != MessageHandler::kOK) { 1645 if (I->message_handler()->HandleNextMessage() != MessageHandler::kOK) {
1646 Dart_Handle error = Api::NewHandle(T, I->object_store()->sticky_error()); 1646 Dart_Handle error = Api::NewHandle(T, T->sticky_error());
1647 I->object_store()->clear_sticky_error(); 1647 T->clear_sticky_error();
1648 return error; 1648 return error;
1649 } 1649 }
1650 return Api::Success(); 1650 return Api::Success();
1651 } 1651 }
1652 1652
1653 1653
1654 DART_EXPORT Dart_Handle Dart_HandleMessages() { 1654 DART_EXPORT Dart_Handle Dart_HandleMessages() {
1655 Thread* T = Thread::Current(); 1655 Thread* T = Thread::Current();
1656 Isolate* I = T->isolate(); 1656 Isolate* I = T->isolate();
1657 CHECK_API_SCOPE(T); 1657 CHECK_API_SCOPE(T);
1658 CHECK_CALLBACK_STATE(T); 1658 CHECK_CALLBACK_STATE(T);
1659 API_TIMELINE_BEGIN_END; 1659 API_TIMELINE_BEGIN_END;
1660 TransitionNativeToVM transition(T); 1660 TransitionNativeToVM transition(T);
1661 if (I->message_handler()->HandleAllMessages() != MessageHandler::kOK) { 1661 if (I->message_handler()->HandleAllMessages() != MessageHandler::kOK) {
1662 Dart_Handle error = Api::NewHandle(T, I->object_store()->sticky_error()); 1662 Dart_Handle error = Api::NewHandle(T, T->sticky_error());
1663 I->object_store()->clear_sticky_error(); 1663 T->clear_sticky_error();
1664 return error; 1664 return error;
1665 } 1665 }
1666 return Api::Success(); 1666 return Api::Success();
1667 } 1667 }
1668 1668
1669 1669
1670 DART_EXPORT bool Dart_HandleServiceMessages() { 1670 DART_EXPORT bool Dart_HandleServiceMessages() {
1671 Thread* T = Thread::Current(); 1671 Thread* T = Thread::Current();
1672 Isolate* I = T->isolate(); 1672 Isolate* I = T->isolate();
1673 CHECK_API_SCOPE(T); 1673 CHECK_API_SCOPE(T);
(...skipping 4456 matching lines...) Expand 10 before | Expand all | Expand 10 after
6130 return Api::Success(); 6130 return Api::Success();
6131 } 6131 }
6132 #endif // DART_PRECOMPILER 6132 #endif // DART_PRECOMPILER
6133 6133
6134 6134
6135 DART_EXPORT bool Dart_IsRunningPrecompiledCode() { 6135 DART_EXPORT bool Dart_IsRunningPrecompiledCode() {
6136 return Dart::IsRunningPrecompiledCode(); 6136 return Dart::IsRunningPrecompiledCode();
6137 } 6137 }
6138 6138
6139 } // namespace dart 6139 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/dart.cc ('k') | runtime/vm/debugger.cc » ('j') | runtime/vm/thread.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698