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

Side by Side Diff: bin/main.cc

Issue 11026011: Add isolate event handler setup in order to be able to propagate isolate (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 2 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
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 <stdlib.h> 5 #include <stdlib.h>
6 #include <string.h> 6 #include <string.h>
7 #include <stdio.h> 7 #include <stdio.h>
8 8
9 #include "include/dart_api.h" 9 #include "include/dart_api.h"
10 #include "include/dart_debugger_api.h" 10 #include "include/dart_debugger_api.h"
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 656
657 // Initialize the Dart VM. 657 // Initialize the Dart VM.
658 if (!Dart_Initialize(CreateIsolateAndSetup, 658 if (!Dart_Initialize(CreateIsolateAndSetup,
659 NULL, 659 NULL,
660 ShutdownIsolate)) { 660 ShutdownIsolate)) {
661 return ErrorExit("VM initialization failed\n"); 661 return ErrorExit("VM initialization failed\n");
662 } 662 }
663 663
664 DartUtils::SetOriginalWorkingDirectory(); 664 DartUtils::SetOriginalWorkingDirectory();
665 665
666 // Start the debugger wire protocol handler if necessary.
667 if (start_debugger) {
668 ASSERT(debug_port != 0);
669 DebuggerConnectionHandler::StartHandler(debug_ip, debug_port);
670 }
671
666 // Call CreateIsolateAndSetup which creates an isolate and loads up 672 // Call CreateIsolateAndSetup which creates an isolate and loads up
667 // the specified application script. 673 // the specified application script.
668 char* error = NULL; 674 char* error = NULL;
669 char* isolate_name = BuildIsolateName(script_name, "main"); 675 char* isolate_name = BuildIsolateName(script_name, "main");
670 if (!CreateIsolateAndSetupHelper(script_name, 676 if (!CreateIsolateAndSetupHelper(script_name,
671 "main", 677 "main",
672 true, // Canonicalize the script name. 678 true, // Canonicalize the script name.
673 new IsolateData(), 679 new IsolateData(),
674 &error)) { 680 &error)) {
675 fprintf(stderr, "%s\n", error); 681 fprintf(stderr, "%s\n", error);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 // Set debug breakpoint if specified on the command line. 713 // Set debug breakpoint if specified on the command line.
708 if (breakpoint_at != NULL) { 714 if (breakpoint_at != NULL) {
709 result = SetBreakpoint(breakpoint_at, library); 715 result = SetBreakpoint(breakpoint_at, library);
710 if (Dart_IsError(result)) { 716 if (Dart_IsError(result)) {
711 return ErrorExit("Error setting breakpoint at '%s': %s\n", 717 return ErrorExit("Error setting breakpoint at '%s': %s\n",
712 breakpoint_at, 718 breakpoint_at,
713 Dart_GetError(result)); 719 Dart_GetError(result));
714 } 720 }
715 } 721 }
716 722
717 // Start the debugger wire protocol handler if necessary.
718 if (start_debugger) {
719 ASSERT(debug_port != 0);
720 DebuggerConnectionHandler::StartHandler(debug_ip, debug_port);
721 }
722
723 // Lookup and invoke the top level main function. 723 // Lookup and invoke the top level main function.
724 result = Dart_Invoke(library, Dart_NewString("main"), 0, NULL); 724 result = Dart_Invoke(library, Dart_NewString("main"), 0, NULL);
725 if (Dart_IsError(result)) { 725 if (Dart_IsError(result)) {
726 return ErrorExit("%s\n", Dart_GetError(result)); 726 return ErrorExit("%s\n", Dart_GetError(result));
727 } 727 }
728 // Keep handling messages until the last active receive port is closed. 728 // Keep handling messages until the last active receive port is closed.
729 result = Dart_RunLoop(); 729 result = Dart_RunLoop();
730 if (Dart_IsError(result)) { 730 if (Dart_IsError(result)) {
731 return ErrorExit("%s\n", Dart_GetError(result)); 731 return ErrorExit("%s\n", Dart_GetError(result));
732 } 732 }
733 733
734 Dart_ExitScope(); 734 Dart_ExitScope();
735 // Dump symbol information for the profiler. 735 // Dump symbol information for the profiler.
736 DumpPprofSymbolInfo(); 736 DumpPprofSymbolInfo();
737 // Shutdown the isolate. 737 // Shutdown the isolate.
738 Dart_ShutdownIsolate(); 738 Dart_ShutdownIsolate();
739 // Terminate process exit-code handler. 739 // Terminate process exit-code handler.
740 Process::TerminateExitCodeHandler(); 740 Process::TerminateExitCodeHandler();
741 741
742 return 0; 742 return 0;
743 } 743 }
OLDNEW
« no previous file with comments | « bin/dbg_connection.cc ('k') | include/dart_debugger_api.h » ('j') | vm/debugger.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698