ee6a907611
big global change, so let me explain in more detail. This refactoring CL does the following: - moves all the dart code for isolates in a common library (lib/isolate) - changes frog to understand 'dart:isolate' imoprts by loading the code from the location above. - changes the vm to undernstand 'dart:isolate' imports by creating a separate library that is part of the bootstrap. This follows the same code-structure that Todd suggested in his CL introducing the mirror library - changes dartc to use the shared isolate library as the source of truth for type checking. I left around some of the internal js code in dartc so that the backend continues to work for apps that don't use isolates. - changes all tests that use isolates to import the library explicitly (this is a large bulk of the files in this CL) - changes test status for tests we can't fix in this repo (e.g. co19) - splits the isolate library code to make it possible to preserve some tests without exposing internal types (e.g. tests about serialization/deserialization) - changes the create_sdk script to copy the isolate library to the sdk - includes the isolate library in dartdoc I'll wait for at least one lgtm from each area (dartc, vm, frog, sdk) There is one important pending thing this CL doesn't do: - update test_runner.dart: This should be updated next time we upload the new binaries to tool/testing/bin - dartium specific changes: Vijay, is there anything I need to do for dartium? Review URL: https://chromiumcodereview.appspot.com//9422019 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4647 260f80e4-7a28-3924-810f-c04153c831b5
56 lines
1.9 KiB
C++
56 lines
1.9 KiB
C++
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
#include "platform/assert.h"
|
|
#include "vm/globals.h"
|
|
#include "vm/isolate.h"
|
|
#include "vm/unit_test.h"
|
|
|
|
namespace dart {
|
|
|
|
UNIT_TEST_CASE(IsolateCurrent) {
|
|
Isolate* isolate = Isolate::Init(NULL);
|
|
EXPECT_EQ(isolate, Isolate::Current());
|
|
isolate->Shutdown();
|
|
EXPECT_EQ(reinterpret_cast<Isolate*>(NULL), Isolate::Current());
|
|
delete isolate;
|
|
}
|
|
|
|
|
|
// Only ia32 and x64 can run dart execution tests.
|
|
#if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64)
|
|
// Unit test case to verify error during isolate spawning (application classes
|
|
// not loaded into the isolate).
|
|
TEST_CASE(IsolateSpawn) {
|
|
const char* kScriptChars =
|
|
"#import('dart:isolate');\n"
|
|
"class SpawnNewIsolate extends Isolate {\n"
|
|
" SpawnNewIsolate() : super() { }\n"
|
|
" void main() {\n"
|
|
" }\n"
|
|
" static int testMain() {\n"
|
|
" try {\n"
|
|
" new SpawnNewIsolate().spawn().then(function(SendPort port) {\n"
|
|
" });\n"
|
|
" } catch (var e) {\n"
|
|
" throw;\n"
|
|
" }\n"
|
|
" return 0;\n"
|
|
" }\n"
|
|
"}\n";
|
|
Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
|
|
Dart_Handle result = Dart_InvokeStatic(lib,
|
|
Dart_NewString("SpawnNewIsolate"),
|
|
Dart_NewString("testMain"),
|
|
0,
|
|
NULL);
|
|
EXPECT(Dart_IsError(result));
|
|
EXPECT(Dart_ErrorHasException(result));
|
|
Dart_Handle exception_result = Dart_ErrorGetException(result);
|
|
EXPECT_VALID(exception_result);
|
|
}
|
|
#endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64).
|
|
|
|
} // namespace dart
|