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

Side by Side Diff: runtime/bin/platform.cc

Issue 2466363003: Allow Platform.executable for JIT app snapshots. (Closed)
Patch Set: . Created 4 years, 1 month 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
« no previous file with comments | « no previous file | runtime/include/dart_api.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #if !defined(DART_IO_DISABLED) 5 #if !defined(DART_IO_DISABLED)
6 6
7 #include "bin/platform.h" 7 #include "bin/platform.h"
8 8
9 #include "bin/file.h" 9 #include "bin/file.h"
10 #include "bin/utils.h" 10 #include "bin/utils.h"
(...skipping 22 matching lines...) Expand all
33 char hostname[HOSTNAME_LENGTH]; 33 char hostname[HOSTNAME_LENGTH];
34 if (Platform::LocalHostname(hostname, HOSTNAME_LENGTH)) { 34 if (Platform::LocalHostname(hostname, HOSTNAME_LENGTH)) {
35 Dart_SetReturnValue(args, DartUtils::NewString(hostname)); 35 Dart_SetReturnValue(args, DartUtils::NewString(hostname));
36 } else { 36 } else {
37 Dart_SetReturnValue(args, DartUtils::NewDartOSError()); 37 Dart_SetReturnValue(args, DartUtils::NewDartOSError());
38 } 38 }
39 } 39 }
40 40
41 41
42 void FUNCTION_NAME(Platform_ExecutableName)(Dart_NativeArguments args) { 42 void FUNCTION_NAME(Platform_ExecutableName)(Dart_NativeArguments args) {
43 if (Dart_IsRunningPrecompiledCode()) { 43 if (Dart_IsPrecompiledRuntime()) {
44 // This is a work-around to be able to use most of the existing test suite 44 // This is a work-around to be able to use most of the existing test suite
45 // for precompilation. Many tests do something like Process.run( 45 // for precompilation. Many tests do something like Process.run(
46 // Platform.executable, some_other_script.dart). But with precompilation 46 // Platform.executable, some_other_script.dart). But with precompilation
47 // the script is already fixed, so the spawned process runs the same script 47 // the script is already fixed, so the spawned process runs the same script
48 // again and we have a fork-bomb. 48 // again and we have a fork-bomb.
49 Dart_ThrowException(Dart_NewStringFromCString( 49 Dart_ThrowException(Dart_NewStringFromCString(
50 "Platform.executable not supported under precompilation")); 50 "Platform.executable not supported under precompilation"));
51 UNREACHABLE(); 51 UNREACHABLE();
52 } 52 }
53 if (Platform::GetExecutableName() != NULL) { 53 if (Platform::GetExecutableName() != NULL) {
54 Dart_SetReturnValue( 54 Dart_SetReturnValue(
55 args, Dart_NewStringFromCString(Platform::GetExecutableName())); 55 args, Dart_NewStringFromCString(Platform::GetExecutableName()));
56 } else { 56 } else {
57 Dart_SetReturnValue(args, Dart_Null()); 57 Dart_SetReturnValue(args, Dart_Null());
58 } 58 }
59 } 59 }
60 60
61 61
62 void FUNCTION_NAME(Platform_ResolvedExecutableName)(Dart_NativeArguments args) { 62 void FUNCTION_NAME(Platform_ResolvedExecutableName)(Dart_NativeArguments args) {
63 if (Dart_IsRunningPrecompiledCode()) { 63 if (Dart_IsPrecompiledRuntime()) {
64 Dart_ThrowException(Dart_NewStringFromCString( 64 Dart_ThrowException(Dart_NewStringFromCString(
65 "Platform.resolvedExecutable not supported under precompilation")); 65 "Platform.resolvedExecutable not supported under precompilation"));
66 UNREACHABLE(); 66 UNREACHABLE();
67 } 67 }
68 68
69 if (Platform::GetResolvedExecutableName() != NULL) { 69 if (Platform::GetResolvedExecutableName() != NULL) {
70 Dart_SetReturnValue( 70 Dart_SetReturnValue(
71 args, Dart_NewStringFromCString(Platform::GetResolvedExecutableName())); 71 args, Dart_NewStringFromCString(Platform::GetResolvedExecutableName()));
72 } else { 72 } else {
73 Dart_SetReturnValue(args, Dart_Null()); 73 Dart_SetReturnValue(args, Dart_Null());
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 123
124 124
125 void FUNCTION_NAME(Platform_GetVersion)(Dart_NativeArguments args) { 125 void FUNCTION_NAME(Platform_GetVersion)(Dart_NativeArguments args) {
126 Dart_SetReturnValue(args, Dart_NewStringFromCString(Dart_VersionString())); 126 Dart_SetReturnValue(args, Dart_NewStringFromCString(Dart_VersionString()));
127 } 127 }
128 128
129 } // namespace bin 129 } // namespace bin
130 } // namespace dart 130 } // namespace dart
131 131
132 #endif // !defined(DART_IO_DISABLED) 132 #endif // !defined(DART_IO_DISABLED)
OLDNEW
« no previous file with comments | « no previous file | runtime/include/dart_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698