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

Unified Diff: runtime/bin/directory_impl.dart

Issue 9568010: Use a pool of native ports for directory operations (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 10 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/directory.cc ('k') | tests/standalone/src/ManyDirectoryOperationsTest.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/directory_impl.dart
diff --git a/runtime/bin/directory_impl.dart b/runtime/bin/directory_impl.dart
index f3efa6aeb3a56b5f0bd10dc4048152a8ee1df6d1..e1e46ebcbe2975f7650695753fa5797ac55f65a0 100644
--- a/runtime/bin/directory_impl.dart
+++ b/runtime/bin/directory_impl.dart
@@ -27,9 +27,7 @@ class _Directory implements Directory {
static SendPort _newServicePort() native "Directory_NewServicePort";
void exists(void callback(bool exists)) {
- if (_directoryService == null) {
- _directoryService = _newServicePort();
- }
+ _ensureDirectoryService();
List request = new List(2);
request[0] = kExistsRequest;
request[1] = _path;
@@ -53,9 +51,7 @@ class _Directory implements Directory {
}
void create(void callback()) {
- if (_directoryService == null) {
- _directoryService = _newServicePort();
- }
+ _ensureDirectoryService();
List request = new List(2);
request[0] = kCreateRequest;
request[1] = _path;
@@ -75,9 +71,7 @@ class _Directory implements Directory {
}
void createTemp(void callback()) {
- if (_directoryService == null) {
- _directoryService = _newServicePort();
- }
+ _ensureDirectoryService();
List request = new List(2);
request[0] = kCreateTempRequest;
request[1] = _path;
@@ -106,9 +100,7 @@ class _Directory implements Directory {
}
void _deleteHelper(bool recursive, String errorMsg, void callback()) {
- if (_directoryService == null) {
- _directoryService = _newServicePort();
- }
+ _ensureDirectoryService();
List request = new List(3);
request[0] = kDeleteRequest;
request[1] = _path;
@@ -199,14 +191,14 @@ class _Directory implements Directory {
_onError = onError;
}
- void _closePort(ReceivePort port) {
- if (port !== null) {
- port.close();
+ String get path() { return _path; }
+
+ void _ensureDirectoryService() {
+ if (_directoryService == null) {
+ _directoryService = _newServicePort();
}
}
- String get path() { return _path; }
-
var _onDir;
var _onFile;
var _onDone;
« no previous file with comments | « runtime/bin/directory.cc ('k') | tests/standalone/src/ManyDirectoryOperationsTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698