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

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

Issue 1427583009: 1. Get rid of SwitchIsolateScope as it is not clear when this should be used and there is also a bu… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « runtime/vm/dart.cc ('k') | runtime/vm/isolate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "vm/class_finalizer.h" 10 #include "vm/class_finalizer.h"
(...skipping 1646 matching lines...) Expand 10 before | Expand all | Expand 10 after
1657 1657
1658 1658
1659 DART_EXPORT Dart_Handle Dart_RunLoop() { 1659 DART_EXPORT Dart_Handle Dart_RunLoop() {
1660 Thread* T = Thread::Current(); 1660 Thread* T = Thread::Current();
1661 Isolate* I = T->isolate(); 1661 Isolate* I = T->isolate();
1662 CHECK_ISOLATE_SCOPE(I); 1662 CHECK_ISOLATE_SCOPE(I);
1663 CHECK_CALLBACK_STATE(T); 1663 CHECK_CALLBACK_STATE(T);
1664 Monitor monitor; 1664 Monitor monitor;
1665 MonitorLocker ml(&monitor); 1665 MonitorLocker ml(&monitor);
1666 { 1666 {
1667 SwitchIsolateScope switch_scope(NULL); 1667 // The message handler run loop does not expect to have a current isolate
1668 1668 // so we exit the isolate here and enter it again after the runloop is done.
1669 Thread::ExitIsolate();
1669 RunLoopData data; 1670 RunLoopData data;
1670 data.monitor = &monitor; 1671 data.monitor = &monitor;
1671 data.done = false; 1672 data.done = false;
1672 I->message_handler()->Run( 1673 I->message_handler()->Run(
1673 Dart::thread_pool(), 1674 Dart::thread_pool(),
1674 NULL, RunLoopDone, reinterpret_cast<uword>(&data)); 1675 NULL, RunLoopDone, reinterpret_cast<uword>(&data));
1675 while (!data.done) { 1676 while (!data.done) {
1676 ml.Wait(); 1677 ml.Wait();
1677 } 1678 }
1679 Thread::EnterIsolate(I);
1678 } 1680 }
1679 if (I->object_store()->sticky_error() != Object::null()) { 1681 if (I->object_store()->sticky_error() != Object::null()) {
1680 Dart_Handle error = Api::NewHandle(I, I->object_store()->sticky_error()); 1682 Dart_Handle error = Api::NewHandle(I, I->object_store()->sticky_error());
1681 I->object_store()->clear_sticky_error(); 1683 I->object_store()->clear_sticky_error();
1682 return error; 1684 return error;
1683 } 1685 }
1684 if (FLAG_print_class_table) { 1686 if (FLAG_print_class_table) {
1685 HANDLESCOPE(T); 1687 HANDLESCOPE(T);
1686 I->class_table()->Print(); 1688 I->class_table()->Print();
1687 } 1689 }
(...skipping 4396 matching lines...) Expand 10 before | Expand all | Expand 10 after
6084 ApiReallocate); 6086 ApiReallocate);
6085 writer.WriteFullSnapshot(); 6087 writer.WriteFullSnapshot();
6086 *vm_isolate_snapshot_size = writer.VmIsolateSnapshotSize(); 6088 *vm_isolate_snapshot_size = writer.VmIsolateSnapshotSize();
6087 *isolate_snapshot_size = writer.IsolateSnapshotSize(); 6089 *isolate_snapshot_size = writer.IsolateSnapshotSize();
6088 *instructions_snapshot_size = writer.InstructionsSnapshotSize(); 6090 *instructions_snapshot_size = writer.InstructionsSnapshotSize();
6089 6091
6090 return Api::Success(); 6092 return Api::Success();
6091 } 6093 }
6092 6094
6093 } // namespace dart 6095 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/dart.cc ('k') | runtime/vm/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698