OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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" |
11 | 11 |
12 #include "bin/builtin.h" | 12 #include "bin/builtin.h" |
13 #include "bin/dartutils.h" | 13 #include "bin/dartutils.h" |
| 14 #include "bin/eventhandler.h" |
14 #include "bin/file.h" | 15 #include "bin/file.h" |
15 #include "bin/globals.h" | 16 #include "bin/globals.h" |
16 #include "bin/platform.h" | 17 #include "bin/platform.h" |
17 | 18 |
18 // snapshot_buffer points to a snapshot if we link in a snapshot otherwise | 19 // snapshot_buffer points to a snapshot if we link in a snapshot otherwise |
19 // it is initialized to NULL. | 20 // it is initialized to NULL. |
20 extern const uint8_t* snapshot_buffer; | 21 extern const uint8_t* snapshot_buffer; |
21 | 22 |
22 | 23 |
23 // Global state that stores a pointer to the application script file. | 24 // Global state that stores a pointer to the application script file. |
(...skipping 349 matching lines...) Loading... |
373 argv, | 374 argv, |
374 &vm_options, | 375 &vm_options, |
375 &script_name, | 376 &script_name, |
376 &dart_options) < 0) { | 377 &dart_options) < 0) { |
377 PrintUsage(); | 378 PrintUsage(); |
378 return 255; | 379 return 255; |
379 } | 380 } |
380 | 381 |
381 Dart_SetVMFlags(vm_options.count(), vm_options.arguments()); | 382 Dart_SetVMFlags(vm_options.count(), vm_options.arguments()); |
382 | 383 |
| 384 // Initialize event handler. |
| 385 EventHandler::Initialize(); |
| 386 |
383 // Initialize the Dart VM. | 387 // Initialize the Dart VM. |
384 Dart_Initialize(CreateIsolateAndSetup, NULL); | 388 Dart_Initialize(CreateIsolateAndSetup, NULL); |
385 | 389 |
386 canonical_script_name = File::GetCanonicalPath(script_name); | 390 canonical_script_name = File::GetCanonicalPath(script_name); |
387 if (canonical_script_name == NULL) { | 391 if (canonical_script_name == NULL) { |
388 fprintf(stderr, "Unable to find '%s'\n", script_name); | 392 fprintf(stderr, "Unable to find '%s'\n", script_name); |
389 return 255; // Indicates we encountered an error. | 393 return 255; // Indicates we encountered an error. |
390 } | 394 } |
391 | 395 |
392 // If application snapshot option is specified, first create the | 396 // If application snapshot option is specified, first create the |
(...skipping 105 matching lines...) Loading... |
498 return 255; // Indicates we encountered an error. | 502 return 255; // Indicates we encountered an error. |
499 } | 503 } |
500 free(canonical_script_name); | 504 free(canonical_script_name); |
501 Dart_ExitScope(); | 505 Dart_ExitScope(); |
502 // Dump symbol information for the profiler. | 506 // Dump symbol information for the profiler. |
503 DumpPprofSymbolInfo(); | 507 DumpPprofSymbolInfo(); |
504 // Shutdown the isolate. | 508 // Shutdown the isolate. |
505 Dart_ShutdownIsolate(); | 509 Dart_ShutdownIsolate(); |
506 return 0; | 510 return 0; |
507 } | 511 } |
OLD | NEW |