OLD | NEW |
1 // Copyright 2011, Google Inc. | 1 // Copyright 2011, Google Inc. |
2 // All rights reserved. | 2 // All rights reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
6 // met: | 6 // met: |
7 // | 7 // |
8 // * Redistributions of source code must retain the above copyright | 8 // * Redistributions of source code must retain the above copyright |
9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. |
10 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 | 164 |
165 static PassRefPtr<ScriptArguments> createScriptArguments(Dart_Handle argumen
t, Dart_Handle& exception); | 165 static PassRefPtr<ScriptArguments> createScriptArguments(Dart_Handle argumen
t, Dart_Handle& exception); |
166 static PassRefPtr<ScriptCallStack> createScriptCallStack(); | 166 static PassRefPtr<ScriptCallStack> createScriptCallStack(); |
167 | 167 |
168 static Dart_WeakPersistentHandle createPrologueWeakPersistentHandle(Dart_Han
dle, void* peer, Dart_WeakPersistentHandleFinalizer); | 168 static Dart_WeakPersistentHandle createPrologueWeakPersistentHandle(Dart_Han
dle, void* peer, Dart_WeakPersistentHandleFinalizer); |
169 | 169 |
170 static void disposeWeakPersistentHandles(); | 170 static void disposeWeakPersistentHandles(); |
171 | 171 |
172 static const uint8_t* fullSnapshot(Frame*); | 172 static const uint8_t* fullSnapshot(Frame*); |
173 | 173 |
| 174 static Dart_Handle canonicalizeUrl(Dart_Handle library, Dart_Handle urlHandl
e, String url); |
| 175 |
| 176 static void reportProblem(ScriptExecutionContext*, const String&); |
174 static void reportProblem(ScriptExecutionContext*, Dart_Handle); | 177 static void reportProblem(ScriptExecutionContext*, Dart_Handle); |
175 static void reportProblem(ScriptExecutionContext*, Dart_Handle, const String
& sourceURL); | 178 static void reportProblem(ScriptExecutionContext*, Dart_Handle, const String
& sourceURL); |
176 | 179 |
177 static Dart_Handle invalidNumberOfArgumentsException() | 180 static Dart_Handle invalidNumberOfArgumentsException() |
178 { | 181 { |
179 return Dart_NewStringFromCString("Invalid number of arguments"); | 182 return Dart_NewStringFromCString("Invalid number of arguments"); |
180 } | 183 } |
181 | 184 |
182 static Dart_Handle conditionalFunctionalityException() | 185 static Dart_Handle conditionalFunctionalityException() |
183 { | 186 { |
184 return Dart_NewStringFromCString("Ooops, this functionality is not enabl
ed in this browser"); | 187 return Dart_NewStringFromCString("Ooops, this functionality is not enabl
ed in this browser"); |
185 } | 188 } |
186 | 189 |
187 static Dart_Handle notImplementedException(const char* fileName, int lineNum
ber); | 190 static Dart_Handle notImplementedException(const char* fileName, int lineNum
ber); |
188 | 191 |
189 static Dart_Handle internalErrorException(const char* msg) | 192 static Dart_Handle internalErrorException(const char* msg) |
190 { | 193 { |
191 // FIXME: wrap into proper type. | 194 // FIXME: wrap into proper type. |
192 return Dart_NewStringFromCString(msg); | 195 return Dart_NewStringFromCString(msg); |
193 } | 196 } |
194 | 197 |
195 static Dart_Handle invokeUtilsMethod(const char* methodName, int argCount, D
art_Handle* args); | 198 static Dart_Handle invokeUtilsMethod(const char* methodName, int argCount, D
art_Handle* args); |
196 | 199 |
| 200 static Dart_Handle convertSourceString(const String& source) |
| 201 { |
| 202 // FIXME: Decide whether to externalize this here. |
| 203 const CString utf8encoded = source.utf8(); |
| 204 return Dart_NewStringFromCString(utf8encoded.data()); |
| 205 } |
| 206 |
197 static DartStringAdapter dartToString(Dart_Handle object, Dart_Handle& excep
tion) | 207 static DartStringAdapter dartToString(Dart_Handle object, Dart_Handle& excep
tion) |
198 { | 208 { |
199 // FIXME: [performance] need better treatment of String vs. AtomicString
, cf. v8 implementation. | 209 // FIXME: [performance] need better treatment of String vs. AtomicString
, cf. v8 implementation. |
200 intptr_t charsize = 0; | 210 intptr_t charsize = 0; |
201 intptr_t strlength = 0; | 211 intptr_t strlength = 0; |
202 void* peer = 0; | 212 void* peer = 0; |
203 Dart_Handle result = Dart_StringGetProperties(object, &charsize, &strlen
gth, &peer); | 213 Dart_Handle result = Dart_StringGetProperties(object, &charsize, &strlen
gth, &peer); |
204 if (!Dart_IsError(result)) { | 214 if (!Dart_IsError(result)) { |
205 if (peer) { | 215 if (peer) { |
206 return DartStringAdapter(reinterpret_cast<StringImpl*>(peer)); | 216 return DartStringAdapter(reinterpret_cast<StringImpl*>(peer)); |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 } | 650 } |
641 }; | 651 }; |
642 | 652 |
643 | 653 |
644 #define DART_UNIMPLEMENTED_EXCEPTION() DartUtilities::notImplementedException(__
FILE__, __LINE__) | 654 #define DART_UNIMPLEMENTED_EXCEPTION() DartUtilities::notImplementedException(__
FILE__, __LINE__) |
645 #define DART_UNIMPLEMENTED() Dart_ThrowException(DART_UNIMPLEMENTED_EXCEPTION())
; | 655 #define DART_UNIMPLEMENTED() Dart_ThrowException(DART_UNIMPLEMENTED_EXCEPTION())
; |
646 | 656 |
647 } // namespace WebCore | 657 } // namespace WebCore |
648 | 658 |
649 #endif // DartUtilities_h | 659 #endif // DartUtilities_h |
OLD | NEW |