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

Unified Diff: runtime/bin/dartutils.cc

Issue 3001963002: [dart:io] Namespaces for file IO (Closed)
Patch Set: Fuchsia fix Created 3 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/dartutils.h ('k') | runtime/bin/directory.h » ('j') | 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 abb6dd9efaf4aa41675a1ffca8da74db3e0f4cdb..6a1fccc9e42a4d6774aa5db5c219cb541f567a87 100644
--- a/runtime/bin/dartutils.cc
+++ b/runtime/bin/dartutils.cc
@@ -9,6 +9,7 @@
#include "bin/extensions.h"
#include "bin/file.h"
#include "bin/io_buffer.h"
+#include "bin/namespace.h"
#include "bin/platform.h"
#include "bin/utils.h"
@@ -195,7 +196,8 @@ char* DartUtils::DirName(const char* url) {
}
void* DartUtils::OpenFile(const char* name, bool write) {
- File* file = File::Open(name, write ? File::kWriteTruncate : File::kRead);
+ File* file = File::Open(
+ NULL, name, write ? File::kWriteTruncate : File::kRead);
return reinterpret_cast<void*>(file);
}
@@ -528,11 +530,24 @@ Dart_Handle DartUtils::PrepareForScriptLoading(bool is_service_isolate,
return result;
}
-Dart_Handle DartUtils::SetupIOLibrary(const char* script_uri) {
+Dart_Handle DartUtils::SetupIOLibrary(const char* namespc_path,
+ const char* script_uri) {
Dart_Handle io_lib_url = NewString(kIOLibURL);
RETURN_IF_ERROR(io_lib_url);
Dart_Handle io_lib = Dart_LookupLibrary(io_lib_url);
RETURN_IF_ERROR(io_lib);
+
+ if (namespc_path != NULL) {
+ Dart_Handle namespc_type = GetDartType(DartUtils::kIOLibURL, "_Namespace");
+ RETURN_IF_ERROR(namespc_type);
+ Dart_Handle args[1];
+ args[0] = NewString(namespc_path);
+ RETURN_IF_ERROR(args[0]);
+ Dart_Handle result = Dart_Invoke(
+ namespc_type, NewString("_setupNamespace"), 1, args);
+ RETURN_IF_ERROR(result);
+ }
+
Dart_Handle platform_type = GetDartType(DartUtils::kIOLibURL, "_Platform");
RETURN_IF_ERROR(platform_type);
Dart_Handle script_name = NewString("_nativeScript");
« no previous file with comments | « runtime/bin/dartutils.h ('k') | runtime/bin/directory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698