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

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

Issue 1290893006: - Clarify the order of setting the interrupt bit and posting a message in (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Review comments. Created 5 years, 4 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
« no previous file with comments | « runtime/vm/code_generator.cc ('k') | no next file » | 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 1583 matching lines...) Expand 10 before | Expand all | Expand 10 after
1594 } 1594 }
1595 1595
1596 1596
1597 DART_EXPORT void Dart_InterruptIsolate(Dart_Isolate isolate) { 1597 DART_EXPORT void Dart_InterruptIsolate(Dart_Isolate isolate) {
1598 TRACE_API_CALL(CURRENT_FUNC); 1598 TRACE_API_CALL(CURRENT_FUNC);
1599 if (isolate == NULL) { 1599 if (isolate == NULL) {
1600 FATAL1("%s expects argument 'isolate' to be non-null.", CURRENT_FUNC); 1600 FATAL1("%s expects argument 'isolate' to be non-null.", CURRENT_FUNC);
1601 } 1601 }
1602 // TODO(16615): Validate isolate parameter. 1602 // TODO(16615): Validate isolate parameter.
1603 Isolate* iso = reinterpret_cast<Isolate*>(isolate); 1603 Isolate* iso = reinterpret_cast<Isolate*>(isolate);
1604 // Schedule the interrupt. The isolate will notice this bit being set if it
1605 // is currently executing in Dart code.
1604 iso->ScheduleInterrupts(Isolate::kApiInterrupt); 1606 iso->ScheduleInterrupts(Isolate::kApiInterrupt);
1607 // If the isolate is blocked on the message queue, we post a dummy message
1608 // to the isolate's main port. The message will be ultimately ignored, but as
1609 // part of handling the message the interrupt bit which was set above will be
1610 // honored.
1605 // Can't use Dart_Post() since there isn't a current isolate. 1611 // Can't use Dart_Post() since there isn't a current isolate.
1606 Dart_CObject api_null = { Dart_CObject_kNull , { 0 } }; 1612 Dart_CObject api_null = { Dart_CObject_kNull , { 0 } };
1607 Dart_PostCObject(iso->main_port(), &api_null); 1613 Dart_PostCObject(iso->main_port(), &api_null);
1608 } 1614 }
1609 1615
1610 1616
1611 DART_EXPORT bool Dart_IsolateMakeRunnable(Dart_Isolate isolate) { 1617 DART_EXPORT bool Dart_IsolateMakeRunnable(Dart_Isolate isolate) {
1612 CHECK_NO_ISOLATE(Isolate::Current()); 1618 CHECK_NO_ISOLATE(Isolate::Current());
1613 if (isolate == NULL) { 1619 if (isolate == NULL) {
1614 FATAL1("%s expects argument 'isolate' to be non-null.", CURRENT_FUNC); 1620 FATAL1("%s expects argument 'isolate' to be non-null.", CURRENT_FUNC);
(...skipping 4406 matching lines...) Expand 10 before | Expand all | Expand 10 after
6021 ASSERT(stream != NULL); 6027 ASSERT(stream != NULL);
6022 TimelineEvent* event = stream->StartEvent(); 6028 TimelineEvent* event = stream->StartEvent();
6023 if (event != NULL) { 6029 if (event != NULL) {
6024 event->AsyncEnd(label, async_id); 6030 event->AsyncEnd(label, async_id);
6025 event->Complete(); 6031 event->Complete();
6026 } 6032 }
6027 return Api::Success(); 6033 return Api::Success();
6028 } 6034 }
6029 6035
6030 } // namespace dart 6036 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/code_generator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698