OLD | NEW |
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_tools_api.h" | 10 #include "include/dart_tools_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/dbg_connection.h" | 14 #include "bin/dbg_connection.h" |
15 #include "bin/directory.h" | 15 #include "bin/directory.h" |
| 16 #include "bin/embedded_dart_io.h" |
16 #include "bin/eventhandler.h" | 17 #include "bin/eventhandler.h" |
17 #include "bin/extensions.h" | 18 #include "bin/extensions.h" |
18 #include "bin/file.h" | 19 #include "bin/file.h" |
19 #include "bin/isolate_data.h" | 20 #include "bin/isolate_data.h" |
20 #include "bin/log.h" | 21 #include "bin/log.h" |
21 #include "bin/platform.h" | 22 #include "bin/platform.h" |
22 #include "bin/process.h" | 23 #include "bin/process.h" |
23 #include "bin/thread.h" | 24 #include "bin/thread.h" |
24 #include "bin/vmservice_impl.h" | 25 #include "bin/vmservice_impl.h" |
25 #include "platform/globals.h" | 26 #include "platform/globals.h" |
(...skipping 1028 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1054 return strdup(json); | 1055 return strdup(json); |
1055 } | 1056 } |
1056 | 1057 |
1057 | 1058 |
1058 static const char* kStdoutStreamId = "Stdout"; | 1059 static const char* kStdoutStreamId = "Stdout"; |
1059 static const char* kStderrStreamId = "Stderr"; | 1060 static const char* kStderrStreamId = "Stderr"; |
1060 | 1061 |
1061 | 1062 |
1062 static bool ServiceStreamListenCallback(const char* stream_id) { | 1063 static bool ServiceStreamListenCallback(const char* stream_id) { |
1063 if (strcmp(stream_id, kStdoutStreamId) == 0) { | 1064 if (strcmp(stream_id, kStdoutStreamId) == 0) { |
1064 File::set_capture_stdout(true); | 1065 SetCaptureStdout(true); |
1065 return true; | 1066 return true; |
1066 } else if (strcmp(stream_id, kStderrStreamId) == 0) { | 1067 } else if (strcmp(stream_id, kStderrStreamId) == 0) { |
1067 File::set_capture_stderr(true); | 1068 SetCaptureStderr(true); |
1068 return true; | 1069 return true; |
1069 } | 1070 } |
1070 return false; | 1071 return false; |
1071 } | 1072 } |
1072 | 1073 |
1073 | 1074 |
1074 static void ServiceStreamCancelCallback(const char* stream_id) { | 1075 static void ServiceStreamCancelCallback(const char* stream_id) { |
1075 if (strcmp(stream_id, kStdoutStreamId) == 0) { | 1076 if (strcmp(stream_id, kStdoutStreamId) == 0) { |
1076 File::set_capture_stdout(false); | 1077 SetCaptureStdout(false); |
1077 } else if (strcmp(stream_id, kStderrStreamId) == 0) { | 1078 } else if (strcmp(stream_id, kStderrStreamId) == 0) { |
1078 File::set_capture_stderr(false); | 1079 SetCaptureStderr(false); |
1079 } | 1080 } |
1080 } | 1081 } |
1081 | 1082 |
1082 | 1083 |
1083 static void WriteSnapshotFile(const char* filename, | 1084 static void WriteSnapshotFile(const char* filename, |
1084 const uint8_t* buffer, | 1085 const uint8_t* buffer, |
1085 const intptr_t size) { | 1086 const intptr_t size) { |
1086 File* file = File::Open(filename, File::kWriteTruncate); | 1087 File* file = File::Open(filename, File::kWriteTruncate); |
1087 ASSERT(file != NULL); | 1088 ASSERT(file != NULL); |
1088 if (!file->WriteFully(buffer, size)) { | 1089 if (!file->WriteFully(buffer, size)) { |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1516 Platform::Exit(Process::GlobalExitCode()); | 1517 Platform::Exit(Process::GlobalExitCode()); |
1517 } | 1518 } |
1518 | 1519 |
1519 } // namespace bin | 1520 } // namespace bin |
1520 } // namespace dart | 1521 } // namespace dart |
1521 | 1522 |
1522 int main(int argc, char** argv) { | 1523 int main(int argc, char** argv) { |
1523 dart::bin::main(argc, argv); | 1524 dart::bin::main(argc, argv); |
1524 UNREACHABLE(); | 1525 UNREACHABLE(); |
1525 } | 1526 } |
OLD | NEW |