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

Unified Diff: sdk/lib/io/file_system_entity.dart

Issue 24395013: Merge services into a shared IOService in dart:io, and use a native port. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Finish off native_service Created 7 years, 3 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 | « sdk/lib/io/file_impl.dart ('k') | sdk/lib/io/link.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/file_system_entity.dart
diff --git a/sdk/lib/io/file_system_entity.dart b/sdk/lib/io/file_system_entity.dart
index 10d632bb15940232edd5e1d2a87dcfd9410fb893..520046012ed36f16dce87975d988f71cf1f9adc1 100644
--- a/sdk/lib/io/file_system_entity.dart
+++ b/sdk/lib/io/file_system_entity.dart
@@ -71,12 +71,7 @@ class FileStat {
* .type set to FileSystemEntityType.NOT_FOUND and the other fields invalid.
*/
static Future<FileStat> stat(String path) {
- // Get a new file service port for each request. We could also cache one.
- var service = _FileUtils._newServicePort();
- List request = new List(2);
- request[0] = _STAT_REQUEST;
- request[1] = path;
- return service.call(request).then((response) {
+ return IOService.dispatch(FILE_STAT, [path]).then((response) {
if (_isErrorResponse(response)) {
throw _exceptionFromResponse(response,
"Error getting stat",
@@ -241,19 +236,15 @@ abstract class FileSystemEntity {
* since [resolve] removes '..' segments.
*/
Future<String> resolveSymbolicLinks() {
- // Get a new file service port for each request. We could also cache one.
- var service = _FileUtils._newServicePort();
- List request = new List(2);
- request[0] = _RESOLVE_SYMBOLIC_LINKS_REQUEST;
- request[1] = path;
- return service.call(request).then((response) {
- if (_isErrorResponse(response)) {
- throw _exceptionFromResponse(response,
- "Cannot resolve symbolic links",
- path);
- }
- return response;
- });
+ return IOService.dispatch(FILE_RESOLVE_SYMBOLIC_LINKS, [path])
+ .then((response) {
+ if (_isErrorResponse(response)) {
+ throw _exceptionFromResponse(response,
+ "Cannot resolve symbolic links",
+ path);
+ }
+ return response;
+ });
}
/**
@@ -390,13 +381,7 @@ abstract class FileSystemEntity {
* to an object that does not exist.
*/
static Future<bool> identical(String path1, String path2) {
- // Get a new file service port for each request. We could also cache one.
- var service = _FileUtils._newServicePort();
- List request = new List(3);
- request[0] = _IDENTICAL_REQUEST;
- request[1] = path1;
- request[2] = path2;
- return service.call(request).then((response) {
+ return IOService.dispatch(FILE_IDENTICAL, [path1, path2]).then((response) {
if (_isErrorResponse(response)) {
throw _exceptionFromResponse(response,
"Error in FileSystemEntity.identical($path1, $path2)", "");
@@ -552,13 +537,7 @@ abstract class FileSystemEntity {
}
static Future<int> _getTypeAsync(String path, bool followLinks) {
- // Get a new file service port for each request. We could also cache one.
- var service = _FileUtils._newServicePort();
- List request = new List(3);
- request[0] = _TYPE_REQUEST;
- request[1] = path;
- request[2] = followLinks;
- return service.call(request).then((response) {
+ return IOService.dispatch(FILE_TYPE, [path, followLinks]).then((response) {
if (_isErrorResponse(response)) {
throw _exceptionFromResponse(response, "Error getting type", path);
}
« no previous file with comments | « sdk/lib/io/file_impl.dart ('k') | sdk/lib/io/link.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698