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

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

Issue 1041523002: Refactor Thread lifecycle interface, add Thread::Enter/ExitIsolate. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/dart_api_impl.h ('k') | runtime/vm/gc_sweeper.cc » ('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 1338 matching lines...) Expand 10 before | Expand all | Expand 10 after
1349 DARTSCOPE(isolate); 1349 DARTSCOPE(isolate);
1350 return Api::NewHandle(isolate, String::New(isolate->name())); 1350 return Api::NewHandle(isolate, String::New(isolate->name()));
1351 } 1351 }
1352 1352
1353 1353
1354 1354
1355 DART_EXPORT void Dart_EnterIsolate(Dart_Isolate isolate) { 1355 DART_EXPORT void Dart_EnterIsolate(Dart_Isolate isolate) {
1356 CHECK_NO_ISOLATE(Isolate::Current()); 1356 CHECK_NO_ISOLATE(Isolate::Current());
1357 // TODO(16615): Validate isolate parameter. 1357 // TODO(16615): Validate isolate parameter.
1358 Isolate* iso = reinterpret_cast<Isolate*>(isolate); 1358 Isolate* iso = reinterpret_cast<Isolate*>(isolate);
1359 Isolate::SetCurrent(iso); 1359 if (iso->mutator_thread() != NULL) {
1360 FATAL("Multiple mutators within one isolate is not supported.");
1361 }
1362 Thread::EnterIsolate(iso);
1360 } 1363 }
1361 1364
1362 1365
1363 DART_EXPORT void Dart_IsolateBlocked() { 1366 DART_EXPORT void Dart_IsolateBlocked() {
1364 Isolate* isolate = Isolate::Current(); 1367 Isolate* isolate = Isolate::Current();
1365 CHECK_ISOLATE(isolate); 1368 CHECK_ISOLATE(isolate);
1366 IsolateProfilerData* profiler_data = isolate->profiler_data(); 1369 IsolateProfilerData* profiler_data = isolate->profiler_data();
1367 if (profiler_data == NULL) { 1370 if (profiler_data == NULL) {
1368 return; 1371 return;
1369 } 1372 }
1370 profiler_data->Block(); 1373 profiler_data->Block();
1371 } 1374 }
1372 1375
1373 1376
1374 DART_EXPORT void Dart_IsolateUnblocked() { 1377 DART_EXPORT void Dart_IsolateUnblocked() {
1375 Isolate* isolate = Isolate::Current(); 1378 Isolate* isolate = Isolate::Current();
1376 CHECK_ISOLATE(isolate); 1379 CHECK_ISOLATE(isolate);
1377 IsolateProfilerData* profiler_data = isolate->profiler_data(); 1380 IsolateProfilerData* profiler_data = isolate->profiler_data();
1378 if (profiler_data == NULL) { 1381 if (profiler_data == NULL) {
1379 return; 1382 return;
1380 } 1383 }
1381 profiler_data->Unblock(); 1384 profiler_data->Unblock();
1382 } 1385 }
1383 1386
1384 1387
1385 DART_EXPORT void Dart_ExitIsolate() { 1388 DART_EXPORT void Dart_ExitIsolate() {
1386 CHECK_ISOLATE(Isolate::Current()); 1389 CHECK_ISOLATE(Isolate::Current());
1387 Isolate::SetCurrent(NULL); 1390 Thread::ExitIsolate();
1388 } 1391 }
1389 1392
1390 1393
1391 DART_EXPORT Dart_Handle Dart_IsolateSetStrictCompilation(bool value) { 1394 DART_EXPORT Dart_Handle Dart_IsolateSetStrictCompilation(bool value) {
1392 CHECK_ISOLATE(Isolate::Current()); 1395 CHECK_ISOLATE(Isolate::Current());
1393 Isolate* isolate = Isolate::Current(); 1396 Isolate* isolate = Isolate::Current();
1394 if (isolate->has_compiled()) { 1397 if (isolate->has_compiled()) {
1395 return Api::NewError( 1398 return Api::NewError(
1396 "%s expects that the isolate has not yet compiled code.", CURRENT_FUNC); 1399 "%s expects that the isolate has not yet compiled code.", CURRENT_FUNC);
1397 } 1400 }
(...skipping 4122 matching lines...) Expand 10 before | Expand all | Expand 10 after
5520 5523
5521 5524
5522 DART_EXPORT void Dart_RegisterRootServiceRequestCallback( 5525 DART_EXPORT void Dart_RegisterRootServiceRequestCallback(
5523 const char* name, 5526 const char* name,
5524 Dart_ServiceRequestCallback callback, 5527 Dart_ServiceRequestCallback callback,
5525 void* user_data) { 5528 void* user_data) {
5526 Service::RegisterRootEmbedderCallback(name, callback, user_data); 5529 Service::RegisterRootEmbedderCallback(name, callback, user_data);
5527 } 5530 }
5528 5531
5529 } // namespace dart 5532 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/dart_api_impl.h ('k') | runtime/vm/gc_sweeper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698