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

Unified Diff: runtime/bin/dartutils.cc

Issue 2468993002: Delete builtins that became unused after source loading was refactored. (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/builtin_natives.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/dartutils.cc
diff --git a/runtime/bin/dartutils.cc b/runtime/bin/dartutils.cc
index dd13e6d16c5a9dc068a2c6bc07526edb87bacd54..ff8b53d48d260f7ca00dd1cd6746e623291a670d 100644
--- a/runtime/bin/dartutils.cc
+++ b/runtime/bin/dartutils.cc
@@ -545,122 +545,6 @@ Dart_Handle DartUtils::LoadScript(const char* script_uri) {
}
-// Callback function, gets called from asynchronous script and library
-// reading code when there is an i/o error.
-void FUNCTION_NAME(Builtin_AsyncLoadError)(Dart_NativeArguments args) {
- // Dart_Handle source_uri = Dart_GetNativeArgument(args, 0);
- Dart_Handle library_uri = Dart_GetNativeArgument(args, 1);
- Dart_Handle error = Dart_GetNativeArgument(args, 2);
-
- Dart_Handle library = Dart_LookupLibrary(library_uri);
- // If a library with the given uri exists, give it a chance to handle
- // the error. If the load requests stems from a deferred library load,
- // an IO error is not fatal.
- if (!Dart_IsError(library)) {
- ASSERT(Dart_IsLibrary(library));
- Dart_Handle res = Dart_LibraryHandleError(library, error);
- if (Dart_IsNull(res)) {
- return;
- }
- }
- // The error was not handled above. Propagate an unhandled exception.
- error = Dart_NewUnhandledExceptionError(error);
- Dart_PropagateError(error);
-}
-
-
-// Callback function that gets called from dartutils when the library
-// source has been read. Loads the library or part into the VM.
-void FUNCTION_NAME(Builtin_LoadSource)(Dart_NativeArguments args) {
- Dart_Handle tag_in = Dart_GetNativeArgument(args, 0);
- Dart_Handle resolved_script_uri = Dart_GetNativeArgument(args, 1);
- Dart_Handle library_uri = Dart_GetNativeArgument(args, 2);
- Dart_Handle source_data = Dart_GetNativeArgument(args, 3);
-
- Dart_TypedData_Type type = Dart_GetTypeOfExternalTypedData(source_data);
- bool external = type == Dart_TypedData_kUint8;
- uint8_t* data = NULL;
- intptr_t num_bytes;
- Dart_Handle result = Dart_TypedDataAcquireData(
- source_data, &type, reinterpret_cast<void**>(&data), &num_bytes);
- if (Dart_IsError(result)) Dart_PropagateError(result);
-
- uint8_t* buffer_copy = NULL;
- if (!external) {
- // If the buffer is not external, take a copy.
- buffer_copy = reinterpret_cast<uint8_t*>(malloc(num_bytes));
- memmove(buffer_copy, data, num_bytes);
- data = buffer_copy;
- }
-
- Dart_TypedDataReleaseData(source_data);
-
- if (Dart_IsNull(tag_in) && Dart_IsNull(library_uri)) {
- // Entry file. Check for payload and load accordingly.
- const uint8_t* payload = data;
- const DartUtils::MagicNumber payload_type =
- DartUtils::SniffForMagicNumber(&payload, &num_bytes);
-
- if (payload_type == DartUtils::kSnapshotMagicNumber) {
- result = Dart_LoadScriptFromSnapshot(payload, num_bytes);
- } else if (payload_type == DartUtils::kKernelMagicNumber) {
- UNREACHABLE();
- } else {
- Dart_Handle source = Dart_NewStringFromUTF8(data, num_bytes);
- if (Dart_IsError(source)) {
- result = DartUtils::NewError("%s is not a valid UTF-8 script",
- resolved_script_uri);
- } else {
- result = Dart_LoadScript(resolved_script_uri, Dart_Null(),
- source, 0, 0);
- }
- }
- } else {
- int64_t tag = DartUtils::GetIntegerValue(tag_in);
-
- Dart_Handle source = Dart_NewStringFromUTF8(data, num_bytes);
- if (Dart_IsError(source)) {
- result = DartUtils::NewError("%s is not a valid UTF-8 script",
- resolved_script_uri);
- } else {
- if (tag == Dart_kImportTag) {
- result = Dart_LoadLibrary(resolved_script_uri, Dart_Null(),
- source, 0, 0);
- } else {
- ASSERT(tag == Dart_kSourceTag);
- Dart_Handle library = Dart_LookupLibrary(library_uri);
- if (Dart_IsError(library)) {
- Dart_PropagateError(library);
- }
- result = Dart_LoadSource(library, resolved_script_uri, Dart_Null(),
- source, 0, 0);
- }
- }
- }
-
- if (buffer_copy != NULL) {
- free(buffer_copy);
- }
-
- if (Dart_IsError(result)) {
- Dart_PropagateError(result);
- }
-}
-
-
-// Callback function that gets called from dartutils when there are
-// no more outstanding load requests.
-void FUNCTION_NAME(Builtin_DoneLoading)(Dart_NativeArguments args) {
- Dart_Handle res = Dart_FinalizeLoading(true);
- if (Dart_IsError(res)) {
- // TODO(hausner): If compilation/loading errors are supposed to
- // be observable by the program, we need to mark the bad library
- // with the error instead of propagating it.
- Dart_PropagateError(res);
- }
-}
-
-
void FUNCTION_NAME(Builtin_GetCurrentDirectory)(Dart_NativeArguments args) {
const char* current = Directory::Current();
if (current != NULL) {
« no previous file with comments | « runtime/bin/builtin_natives.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698