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 <stdio.h> | 5 #include <stdio.h> |
6 #include <stdlib.h> | 6 #include <stdlib.h> |
7 #include <string.h> | 7 #include <string.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 1338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1349 } | 1349 } |
1350 int64_t data[File::kStatSize]; | 1350 int64_t data[File::kStatSize]; |
1351 File::Stat(url + 7, data); | 1351 File::Stat(url + 7, data); |
1352 if (data[File::kType] == File::kDoesNotExist) { | 1352 if (data[File::kType] == File::kDoesNotExist) { |
1353 return true; | 1353 return true; |
1354 } | 1354 } |
1355 bool modified = data[File::kModifiedTime] > since; | 1355 bool modified = data[File::kModifiedTime] > since; |
1356 return modified; | 1356 return modified; |
1357 } | 1357 } |
1358 | 1358 |
1359 static const Dart_EmbedderInformation* GetEmbedderInformationCallback() { | |
1360 static Dart_EmbedderInformation information = { | |
zra
2017/08/10 22:19:50
The VM could pass in a pointer to a Dart_EmbedderI
cbernaschina
2017/08/10 22:40:28
That was the first idea, the main problem is relat
zra
2017/08/10 22:49:46
I'm not sure this simple call is the right API for
cbernaschina
2017/08/12 00:29:41
Done.
| |
1361 "Dart VM", // name | |
1362 0, // current_rss | |
1363 0 // max_rss | |
1364 }; | |
1365 | |
1366 int64_t max_rss = Process::MaxRSS(); | |
1367 int64_t current_rss = Process::CurrentRSS(); | |
1368 | |
1369 information.max_rss = max_rss >= 0 ? max_rss : 0; | |
1370 information.current_rss = current_rss >= 0 ? current_rss : 0; | |
1371 | |
1372 return &information; | |
1373 } | |
1374 | |
1359 static void GenerateAppAOTSnapshot() { | 1375 static void GenerateAppAOTSnapshot() { |
1360 if (use_blobs) { | 1376 if (use_blobs) { |
1361 Snapshot::GenerateAppAOTAsBlobs(snapshot_filename); | 1377 Snapshot::GenerateAppAOTAsBlobs(snapshot_filename); |
1362 } else { | 1378 } else { |
1363 Snapshot::GenerateAppAOTAsAssembly(snapshot_filename); | 1379 Snapshot::GenerateAppAOTAsAssembly(snapshot_filename); |
1364 } | 1380 } |
1365 } | 1381 } |
1366 | 1382 |
1367 #define CHECK_RESULT(result) \ | 1383 #define CHECK_RESULT(result) \ |
1368 if (Dart_IsError(result)) { \ | 1384 if (Dart_IsError(result)) { \ |
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1857 if (error != NULL) { | 1873 if (error != NULL) { |
1858 EventHandler::Stop(); | 1874 EventHandler::Stop(); |
1859 Log::PrintErr("VM initialization failed: %s\n", error); | 1875 Log::PrintErr("VM initialization failed: %s\n", error); |
1860 free(error); | 1876 free(error); |
1861 Platform::Exit(kErrorExitCode); | 1877 Platform::Exit(kErrorExitCode); |
1862 } | 1878 } |
1863 | 1879 |
1864 Dart_SetServiceStreamCallbacks(&ServiceStreamListenCallback, | 1880 Dart_SetServiceStreamCallbacks(&ServiceStreamListenCallback, |
1865 &ServiceStreamCancelCallback); | 1881 &ServiceStreamCancelCallback); |
1866 Dart_SetFileModifiedCallback(&FileModifiedCallback); | 1882 Dart_SetFileModifiedCallback(&FileModifiedCallback); |
1883 Dart_SetGetEmbedderInformationCallback(&GetEmbedderInformationCallback); | |
1867 | 1884 |
1868 // Run the main isolate until we aren't told to restart. | 1885 // Run the main isolate until we aren't told to restart. |
1869 while (RunMainIsolate(script_name, &dart_options)) { | 1886 while (RunMainIsolate(script_name, &dart_options)) { |
1870 Log::PrintErr("Restarting VM\n"); | 1887 Log::PrintErr("Restarting VM\n"); |
1871 } | 1888 } |
1872 | 1889 |
1873 // Terminate process exit-code handler. | 1890 // Terminate process exit-code handler. |
1874 Process::TerminateExitCodeHandler(); | 1891 Process::TerminateExitCodeHandler(); |
1875 | 1892 |
1876 error = Dart_Cleanup(); | 1893 error = Dart_Cleanup(); |
(...skipping 27 matching lines...) Expand all Loading... | |
1904 Platform::Exit(Process::GlobalExitCode()); | 1921 Platform::Exit(Process::GlobalExitCode()); |
1905 } | 1922 } |
1906 | 1923 |
1907 } // namespace bin | 1924 } // namespace bin |
1908 } // namespace dart | 1925 } // namespace dart |
1909 | 1926 |
1910 int main(int argc, char** argv) { | 1927 int main(int argc, char** argv) { |
1911 dart::bin::main(argc, argv); | 1928 dart::bin::main(argc, argv); |
1912 UNREACHABLE(); | 1929 UNREACHABLE(); |
1913 } | 1930 } |
OLD | NEW |