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

Side by Side Diff: mojo/dart/embedder/dart_controller.cc

Issue 850963003: Dart: Updates Dart VM revision. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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 | « mojo/dart/embedder/BUILD.gn ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/callback.h" 5 #include "base/callback.h"
6 #include "base/files/file_util.h" 6 #include "base/files/file_util.h"
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/sys_info.h" 9 #include "base/sys_info.h"
10 #include "crypto/random.h" 10 #include "crypto/random.h"
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 bool DartController::vmIsInitialized = false; 364 bool DartController::vmIsInitialized = false;
365 void DartController::InitVmIfNeeded(Dart_EntropySource entropy, 365 void DartController::InitVmIfNeeded(Dart_EntropySource entropy,
366 const char** arguments, 366 const char** arguments,
367 int arguments_count) { 367 int arguments_count) {
368 // TODO(zra): If runDartScript can be called from multiple threads 368 // TODO(zra): If runDartScript can be called from multiple threads
369 // concurrently, then vmIsInitialized will need to be protected by a lock. 369 // concurrently, then vmIsInitialized will need to be protected by a lock.
370 if (vmIsInitialized) { 370 if (vmIsInitialized) {
371 return; 371 return;
372 } 372 }
373 373
374 const int kNumArgs = arguments_count + 2; 374 const int kNumArgs = arguments_count + 1;
375 const char* args[kNumArgs]; 375 const char* args[kNumArgs];
376 376
377 // TODO(zra): Fix Dart VM Shutdown race. 377 // TODO(zra): Fix Dart VM Shutdown race.
378 // There is a bug in Dart VM shutdown which causes its thread pool threads 378 // There is a bug in Dart VM shutdown which causes its thread pool threads
379 // to potentially fail to exit when the rest of the VM is going down. This 379 // to potentially fail to exit when the rest of the VM is going down. This
380 // results in a segfault if they begin running again after the Dart 380 // results in a segfault if they begin running again after the Dart
381 // embedder has been unloaded. Setting this flag to 0 ensures that these 381 // embedder has been unloaded. Setting this flag to 0 ensures that these
382 // threads sleep forever instead of waking up and trying to run code 382 // threads sleep forever instead of waking up and trying to run code
383 // that isn't there anymore. 383 // that isn't there anymore.
384 args[0] = "--worker-timeout-millis=0"; 384 args[0] = "--worker-timeout-millis=0";
385 385
386 // Enable async/await features.
387 args[1] = "--enable-async";
388
389 for (int i = 0; i < arguments_count; ++i) { 386 for (int i = 0; i < arguments_count; ++i) {
390 args[i + 2] = arguments[i]; 387 args[i + 1] = arguments[i];
391 } 388 }
392 389
393 bool result = Dart_SetVMFlags(kNumArgs, args); 390 bool result = Dart_SetVMFlags(kNumArgs, args);
394 CHECK(result); 391 CHECK(result);
395 392
396 result = Dart_Initialize(IsolateCreateCallback, 393 result = Dart_Initialize(IsolateCreateCallback,
397 nullptr, // Isolate interrupt callback. 394 nullptr, // Isolate interrupt callback.
398 UnhandledExceptionCallback, 395 UnhandledExceptionCallback,
399 IsolateShutdownCallback, 396 IsolateShutdownCallback,
400 // File IO callbacks. 397 // File IO callbacks.
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 DART_CHECK_VALID(result); 497 DART_CHECK_VALID(result);
501 498
502 Dart_ExitScope(); 499 Dart_ExitScope();
503 Dart_ShutdownIsolate(); 500 Dart_ShutdownIsolate();
504 Dart_Cleanup(); 501 Dart_Cleanup();
505 return true; 502 return true;
506 } 503 }
507 504
508 } // namespace apps 505 } // namespace apps
509 } // namespace mojo 506 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/dart/embedder/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698