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

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

Issue 2995723002: - Convert all isolate flags to a bit field. (Closed)
Patch Set: Address build error. Created 3 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/dart_api_impl.cc ('k') | runtime/vm/debugger.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 "vm/dart_api_impl.h" 5 #include "vm/dart_api_impl.h"
6 #include "bin/builtin.h" 6 #include "bin/builtin.h"
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "include/dart_mirrors_api.h" 8 #include "include/dart_mirrors_api.h"
9 #include "include/dart_native_api.h" 9 #include "include/dart_native_api.h"
10 #include "include/dart_tools_api.h" 10 #include "include/dart_tools_api.h"
(...skipping 3453 matching lines...) Expand 10 before | Expand all | Expand 10 after
3464 " return five;" 3464 " return five;"
3465 "}\n"; 3465 "}\n";
3466 3466
3467 // Create an isolate with checked mode flags. 3467 // Create an isolate with checked mode flags.
3468 Dart_IsolateFlags api_flags; 3468 Dart_IsolateFlags api_flags;
3469 Isolate::FlagsInitialize(&api_flags); 3469 Isolate::FlagsInitialize(&api_flags);
3470 api_flags.enable_type_checks = true; 3470 api_flags.enable_type_checks = true;
3471 api_flags.enable_asserts = true; 3471 api_flags.enable_asserts = true;
3472 api_flags.enable_error_on_bad_type = true; 3472 api_flags.enable_error_on_bad_type = true;
3473 api_flags.enable_error_on_bad_override = true; 3473 api_flags.enable_error_on_bad_override = true;
3474 api_flags.use_dart_frontend = FLAG_use_dart_frontend;
3474 3475
3475 char* err; 3476 char* err;
3476 Dart_Isolate isolate = Dart_CreateIsolate( 3477 Dart_Isolate isolate = Dart_CreateIsolate(
3477 NULL, NULL, bin::core_isolate_snapshot_data, 3478 NULL, NULL, bin::core_isolate_snapshot_data,
3478 bin::core_isolate_snapshot_instructions, &api_flags, NULL, &err); 3479 bin::core_isolate_snapshot_instructions, &api_flags, NULL, &err);
3479 if (isolate == NULL) { 3480 if (isolate == NULL) {
3480 OS::Print("Creation of isolate failed '%s'\n", err); 3481 OS::Print("Creation of isolate failed '%s'\n", err);
3481 free(err); 3482 free(err);
3482 } 3483 }
3483 EXPECT(isolate != NULL); 3484 EXPECT(isolate != NULL);
(...skipping 3917 matching lines...) Expand 10 before | Expand all | Expand 10 after
7401 " Native.markMainEntered();\n" 7402 " Native.markMainEntered();\n"
7402 " while (true) {\n" // Infinite empty loop. 7403 " while (true) {\n" // Infinite empty loop.
7403 " }\n" 7404 " }\n"
7404 "}\n"; 7405 "}\n";
7405 7406
7406 // Tell the other thread that shared_isolate is created. 7407 // Tell the other thread that shared_isolate is created.
7407 Dart_Handle lib; 7408 Dart_Handle lib;
7408 { 7409 {
7409 MonitorLocker ml(sync); 7410 MonitorLocker ml(sync);
7410 char* error = NULL; 7411 char* error = NULL;
7412 Dart_IsolateFlags api_flags;
7413 Isolate::FlagsInitialize(&api_flags);
7414 api_flags.use_dart_frontend = FLAG_use_dart_frontend;
7411 shared_isolate = Dart_CreateIsolate( 7415 shared_isolate = Dart_CreateIsolate(
7412 NULL, NULL, bin::core_isolate_snapshot_data, 7416 NULL, NULL, bin::core_isolate_snapshot_data,
7413 bin::core_isolate_snapshot_instructions, NULL, NULL, &error); 7417 bin::core_isolate_snapshot_instructions, &api_flags, NULL, &error);
7414 EXPECT(shared_isolate != NULL); 7418 EXPECT(shared_isolate != NULL);
7415 Dart_EnterScope(); 7419 Dart_EnterScope();
7416 Dart_Handle url = NewString(TestCase::url()); 7420 Dart_Handle url = NewString(TestCase::url());
7417 Dart_Handle source = NewString(kScriptChars); 7421 Dart_Handle source = NewString(kScriptChars);
7418 Dart_Handle result = Dart_SetLibraryTagHandler(TestCase::library_handler); 7422 Dart_Handle result = Dart_SetLibraryTagHandler(TestCase::library_handler);
7419 EXPECT_VALID(result); 7423 EXPECT_VALID(result);
7420 lib = Dart_LoadScript(url, Dart_Null(), source, 0, 0); 7424 lib = Dart_LoadScript(url, Dart_Null(), source, 0, 0);
7421 EXPECT_VALID(lib); 7425 EXPECT_VALID(lib);
7422 result = Dart_FinalizeLoading(false); 7426 result = Dart_FinalizeLoading(false);
7423 EXPECT_VALID(result); 7427 EXPECT_VALID(result);
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
7502 "int add(int a, int b) {\n" 7506 "int add(int a, int b) {\n"
7503 " return a + b;\n" 7507 " return a + b;\n"
7504 "}\n" 7508 "}\n"
7505 "\n" 7509 "\n"
7506 "void main() {\n" 7510 "void main() {\n"
7507 " add(4, 5);\n" 7511 " add(4, 5);\n"
7508 "}\n"; 7512 "}\n";
7509 7513
7510 // Create an isolate. 7514 // Create an isolate.
7511 char* err; 7515 char* err;
7516 Dart_IsolateFlags api_flags;
7517 Isolate::FlagsInitialize(&api_flags);
7518 api_flags.use_dart_frontend = FLAG_use_dart_frontend;
7512 Dart_Isolate isolate = Dart_CreateIsolate( 7519 Dart_Isolate isolate = Dart_CreateIsolate(
7513 NULL, NULL, bin::core_isolate_snapshot_data, 7520 NULL, NULL, bin::core_isolate_snapshot_data,
7514 bin::core_isolate_snapshot_instructions, NULL, NULL, &err); 7521 bin::core_isolate_snapshot_instructions, &api_flags, NULL, &err);
7515 if (isolate == NULL) { 7522 if (isolate == NULL) {
7516 OS::Print("Creation of isolate failed '%s'\n", err); 7523 OS::Print("Creation of isolate failed '%s'\n", err);
7517 free(err); 7524 free(err);
7518 } 7525 }
7519 EXPECT(isolate != NULL); 7526 EXPECT(isolate != NULL);
7520 7527
7521 Isolate::SetShutdownCallback(IsolateShutdownRunDartCodeTestCallback); 7528 Isolate::SetShutdownCallback(IsolateShutdownRunDartCodeTestCallback);
7522 7529
7523 { 7530 {
7524 Dart_EnterScope(); 7531 Dart_EnterScope();
(...skipping 2156 matching lines...) Expand 10 before | Expand all | Expand 10 after
9681 EXPECT_VALID(result); 9688 EXPECT_VALID(result);
9682 result = Dart_FinalizeLoading(false); 9689 result = Dart_FinalizeLoading(false);
9683 EXPECT_VALID(result); 9690 EXPECT_VALID(result);
9684 result = Dart_Invoke(lib, NewString("foozoo"), 0, NULL); 9691 result = Dart_Invoke(lib, NewString("foozoo"), 0, NULL);
9685 EXPECT(Dart_IsError(result)); 9692 EXPECT(Dart_IsError(result));
9686 } 9693 }
9687 9694
9688 #endif // !PRODUCT 9695 #endif // !PRODUCT
9689 9696
9690 } // namespace dart 9697 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | runtime/vm/debugger.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698