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

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

Issue 9657001: Start using Dart_PropagateError in the runtime/bin directory. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 9 months 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/bin/dartutils.h » ('j') | runtime/bin/dartutils.h » ('J')
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 #include "bin/builtin.h" 5 #include "bin/builtin.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 #include <string.h> 8 #include <string.h>
9 9
10 #include "bin/dartutils.h" 10 #include "bin/dartutils.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 } 94 }
95 95
96 96
97 // Implementation of native functions which are used for some 97 // Implementation of native functions which are used for some
98 // test/debug functionality in standalone dart mode. 98 // test/debug functionality in standalone dart mode.
99 99
100 void Builtin::PrintString(FILE* out, Dart_Handle str) { 100 void Builtin::PrintString(FILE* out, Dart_Handle str) {
101 const char* cstring = NULL; 101 const char* cstring = NULL;
102 Dart_Handle result = Dart_StringToCString(str, &cstring); 102 Dart_Handle result = Dart_StringToCString(str, &cstring);
103 if (Dart_IsError(result)) { 103 if (Dart_IsError(result)) {
104 cstring = Dart_GetError(result); 104 // TODO(turnidge): Consider propagating some errors here. What if
105 // an isolate gets interrupted by the embedder in the middle of
106 // Dart_StringToCString? We need to make sure not to swallow the
107 // interrupt.
108 cstring = Dart_GetError(result);
105 } 109 }
106 fprintf(out, "%s\n", cstring); 110 fprintf(out, "%s\n", cstring);
107 fflush(out); 111 fflush(out);
108 } 112 }
109 113
110 114
111 void FUNCTION_NAME(Logger_PrintString)(Dart_NativeArguments args) { 115 void FUNCTION_NAME(Logger_PrintString)(Dart_NativeArguments args) {
112 Dart_EnterScope(); 116 Dart_EnterScope();
113 Builtin::PrintString(stdout, Dart_GetNativeArgument(args, 0)); 117 Builtin::PrintString(stdout, Dart_GetNativeArgument(args, 0));
114 Dart_ExitScope(); 118 Dart_ExitScope();
(...skipping 14 matching lines...) Expand all
129 } else { 133 } else {
130 ASSERT(id == Builtin::kIOLibrary); 134 ASSERT(id == Builtin::kIOLibrary);
131 url = Dart_NewString(DartUtils::kIOLibURL); 135 url = Dart_NewString(DartUtils::kIOLibURL);
132 } 136 }
133 Dart_Handle builtin_lib = Dart_LookupLibrary(url); 137 Dart_Handle builtin_lib = Dart_LookupLibrary(url);
134 DART_CHECK_VALID(builtin_lib); 138 DART_CHECK_VALID(builtin_lib);
135 // Setup the native resolver for built in library functions. 139 // Setup the native resolver for built in library functions.
136 Dart_Handle result = Dart_SetNativeResolver(builtin_lib, NativeLookup); 140 Dart_Handle result = Dart_SetNativeResolver(builtin_lib, NativeLookup);
137 DART_CHECK_VALID(result); 141 DART_CHECK_VALID(result);
138 } 142 }
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/dartutils.h » ('j') | runtime/bin/dartutils.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698