| 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" | 
| (...skipping 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1048   Dart_Handle args[] = {paths, keys, values}; | 1048   Dart_Handle args[] = {paths, keys, values}; | 
| 1049   Dart_Handle result = Dart_Invoke(io_lib, handler_function_name, 3, args); | 1049   Dart_Handle result = Dart_Invoke(io_lib, handler_function_name, 3, args); | 
| 1050   if (Dart_IsError(result)) return ServiceRequestError(result); | 1050   if (Dart_IsError(result)) return ServiceRequestError(result); | 
| 1051   const char *json; | 1051   const char *json; | 
| 1052   result = Dart_StringToCString(result, &json); | 1052   result = Dart_StringToCString(result, &json); | 
| 1053   if (Dart_IsError(result)) return ServiceRequestError(result); | 1053   if (Dart_IsError(result)) return ServiceRequestError(result); | 
| 1054   return strdup(json); | 1054   return strdup(json); | 
| 1055 } | 1055 } | 
| 1056 | 1056 | 
| 1057 | 1057 | 
| 1058 extern bool capture_stdio; |  | 
| 1059 extern bool capture_stdout; |  | 
| 1060 extern bool capture_stderr; |  | 
| 1061 static const char* kStdoutStreamId = "Stdout"; | 1058 static const char* kStdoutStreamId = "Stdout"; | 
| 1062 static const char* kStderrStreamId = "Stderr"; | 1059 static const char* kStderrStreamId = "Stderr"; | 
| 1063 | 1060 | 
| 1064 | 1061 | 
| 1065 static bool ServiceStreamListenCallback(const char* stream_id) { | 1062 static bool ServiceStreamListenCallback(const char* stream_id) { | 
| 1066   if (strcmp(stream_id, kStdoutStreamId) == 0) { | 1063   if (strcmp(stream_id, kStdoutStreamId) == 0) { | 
| 1067     capture_stdio = true; | 1064     File::set_capture_stdout(true); | 
| 1068     capture_stdout = true; |  | 
| 1069     return true; | 1065     return true; | 
| 1070   } else if (strcmp(stream_id, kStderrStreamId) == 0) { | 1066   } else if (strcmp(stream_id, kStderrStreamId) == 0) { | 
| 1071     capture_stdio = true; | 1067     File::set_capture_stderr(true); | 
| 1072     capture_stderr = true; |  | 
| 1073     return true; | 1068     return true; | 
| 1074   } | 1069   } | 
| 1075   return false; | 1070   return false; | 
| 1076 } | 1071 } | 
| 1077 | 1072 | 
| 1078 | 1073 | 
| 1079 static void ServiceStreamCancelCallback(const char* stream_id) { | 1074 static void ServiceStreamCancelCallback(const char* stream_id) { | 
| 1080   if (strcmp(stream_id, kStdoutStreamId) == 0) { | 1075   if (strcmp(stream_id, kStdoutStreamId) == 0) { | 
| 1081     capture_stdout = false; | 1076     File::set_capture_stdout(false); | 
| 1082   } else if (strcmp(stream_id, kStderrStreamId) == 0) { | 1077   } else if (strcmp(stream_id, kStderrStreamId) == 0) { | 
| 1083     capture_stderr = false; | 1078     File::set_capture_stderr(false); | 
| 1084   } | 1079   } | 
| 1085   capture_stdio = (capture_stdout || capture_stderr); |  | 
| 1086 } | 1080 } | 
| 1087 | 1081 | 
| 1088 | 1082 | 
| 1089 static void WriteSnapshotFile(const char* filename, | 1083 static void WriteSnapshotFile(const char* filename, | 
| 1090                               const uint8_t* buffer, | 1084                               const uint8_t* buffer, | 
| 1091                               const intptr_t size) { | 1085                               const intptr_t size) { | 
| 1092   File* file = File::Open(filename, File::kWriteTruncate); | 1086   File* file = File::Open(filename, File::kWriteTruncate); | 
| 1093   ASSERT(file != NULL); | 1087   ASSERT(file != NULL); | 
| 1094   if (!file->WriteFully(buffer, size)) { | 1088   if (!file->WriteFully(buffer, size)) { | 
| 1095     ErrorExit(kErrorExitCode, | 1089     ErrorExit(kErrorExitCode, | 
| (...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1522   Platform::Exit(Process::GlobalExitCode()); | 1516   Platform::Exit(Process::GlobalExitCode()); | 
| 1523 } | 1517 } | 
| 1524 | 1518 | 
| 1525 }  // namespace bin | 1519 }  // namespace bin | 
| 1526 }  // namespace dart | 1520 }  // namespace dart | 
| 1527 | 1521 | 
| 1528 int main(int argc, char** argv) { | 1522 int main(int argc, char** argv) { | 
| 1529   dart::bin::main(argc, argv); | 1523   dart::bin::main(argc, argv); | 
| 1530   UNREACHABLE(); | 1524   UNREACHABLE(); | 
| 1531 } | 1525 } | 
| OLD | NEW | 
|---|