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

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

Issue 1255793005: Fix shutdown failure path (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: 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 | « no previous file | 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 1346 matching lines...) Expand 10 before | Expand all | Expand 10 after
1357 1357
1358 // Setup default flags in case none were passed. 1358 // Setup default flags in case none were passed.
1359 Dart_IsolateFlags api_flags; 1359 Dart_IsolateFlags api_flags;
1360 if (flags == NULL) { 1360 if (flags == NULL) {
1361 Isolate::Flags vm_flags; 1361 Isolate::Flags vm_flags;
1362 vm_flags.CopyTo(&api_flags); 1362 vm_flags.CopyTo(&api_flags);
1363 flags = &api_flags; 1363 flags = &api_flags;
1364 } 1364 }
1365 Isolate* isolate = Dart::CreateIsolate(isolate_name, *flags); 1365 Isolate* isolate = Dart::CreateIsolate(isolate_name, *flags);
1366 free(isolate_name); 1366 free(isolate_name);
1367 StackZone zone(isolate); 1367 {
1368 HANDLESCOPE(isolate); 1368 StackZone zone(isolate);
1369 // We enter an API scope here as InitializeIsolate could compile some 1369 HANDLESCOPE(isolate);
1370 // bootstrap library files which call out to a tag handler that may create 1370 // We enter an API scope here as InitializeIsolate could compile some
1371 // Api Handles when an error is encountered. 1371 // bootstrap library files which call out to a tag handler that may create
1372 Dart_EnterScope(); 1372 // Api Handles when an error is encountered.
1373 const Error& error_obj = 1373 Dart_EnterScope();
1374 Error::Handle(isolate, Dart::InitializeIsolate(snapshot, callback_data)); 1374 const Error& error_obj =
1375 if (error_obj.IsNull()) { 1375 Error::Handle(isolate,
1376 #if defined(DART_NO_SNAPSHOT) 1376 Dart::InitializeIsolate(snapshot, callback_data));
1377 if (FLAG_check_function_fingerprints) { 1377 if (error_obj.IsNull()) {
1378 Library::CheckFunctionFingerprints(); 1378 #if defined(DART_NO_SNAPSHOT)
1379 if (FLAG_check_function_fingerprints) {
1380 Library::CheckFunctionFingerprints();
1381 }
1382 #endif // defined(DART_NO_SNAPSHOT).
1383 // We exit the API scope entered above.
1384 Dart_ExitScope();
1385 START_TIMER(isolate, time_total_runtime);
1386 return Api::CastIsolate(isolate);
1379 } 1387 }
1380 #endif // defined(DART_NO_SNAPSHOT). 1388 *error = strdup(error_obj.ToErrorCString());
1381 // We exit the API scope entered above. 1389 // We exit the API scope entered above.
1382 Dart_ExitScope(); 1390 Dart_ExitScope();
1383 START_TIMER(isolate, time_total_runtime);
1384 return Api::CastIsolate(isolate);
1385 } 1391 }
1386 *error = strdup(error_obj.ToErrorCString());
1387 // We exit the API scope entered above.
1388 Dart_ExitScope();
1389 Dart::ShutdownIsolate(); 1392 Dart::ShutdownIsolate();
1390 return reinterpret_cast<Dart_Isolate>(NULL); 1393 return reinterpret_cast<Dart_Isolate>(NULL);
1391 } 1394 }
1392 1395
1393 1396
1394 DART_EXPORT void Dart_ShutdownIsolate() { 1397 DART_EXPORT void Dart_ShutdownIsolate() {
1395 Isolate* isolate = Isolate::Current(); 1398 Isolate* isolate = Isolate::Current();
1396 CHECK_ISOLATE(isolate); 1399 CHECK_ISOLATE(isolate);
1397 { 1400 {
1398 StackZone zone(isolate); 1401 StackZone zone(isolate);
(...skipping 4458 matching lines...) Expand 10 before | Expand all | Expand 10 after
5857 ASSERT(stream != NULL); 5860 ASSERT(stream != NULL);
5858 TimelineEvent* event = stream->StartEvent(); 5861 TimelineEvent* event = stream->StartEvent();
5859 if (event != NULL) { 5862 if (event != NULL) {
5860 event->AsyncEnd(label, async_id); 5863 event->AsyncEnd(label, async_id);
5861 event->Complete(); 5864 event->Complete();
5862 } 5865 }
5863 return Api::Success(); 5866 return Api::Success();
5864 } 5867 }
5865 5868
5866 } // namespace dart 5869 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698