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

Side by Side Diff: runtime/bin/file_patch.dart

Issue 1006683002: Avoid race in _FileSystemWatcher if subscription closed while event queued. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 patch class _File { 5 patch class _File {
6 /* patch */ static _exists(String path) native "File_Exists"; 6 /* patch */ static _exists(String path) native "File_Exists";
7 /* patch */ static _create(String path) native "File_Create"; 7 /* patch */ static _create(String path) native "File_Create";
8 /* patch */ static _createLink(String path, String target) 8 /* patch */ static _createLink(String path, String target)
9 native "File_CreateLink"; 9 native "File_CreateLink";
10 /* patch */ static _linkTarget(String path) native "File_LinkTarget"; 10 /* patch */ static _linkTarget(String path) native "File_LinkTarget";
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 add(event[4], new FileSystemDeleteEvent._(getPath(event), isDir)); 186 add(event[4], new FileSystemDeleteEvent._(getPath(event), isDir));
187 } 187 }
188 } 188 }
189 int eventCount; 189 int eventCount;
190 do { 190 do {
191 eventCount = 0; 191 eventCount = 0;
192 for (var event in _readEvents(id, pathId)) { 192 for (var event in _readEvents(id, pathId)) {
193 if (event == null) continue; 193 if (event == null) continue;
194 eventCount++; 194 eventCount++;
195 int pathId = event[4]; 195 int pathId = event[4];
196 if (!_idMap.containsKey(pathId)) {
Søren Gjesse 2015/03/13 12:18:00 I am not sure this is 100% safe, but I have not sc
197 // Path is no longer being wathed.
198 continue;
199 }
196 bool isDir = getIsDir(event); 200 bool isDir = getIsDir(event);
197 var path = getPath(event); 201 var path = getPath(event);
198 if ((event[0] & FileSystemEvent.CREATE) != 0) { 202 if ((event[0] & FileSystemEvent.CREATE) != 0) {
199 add(event[4], new FileSystemCreateEvent._(path, isDir)); 203 add(event[4], new FileSystemCreateEvent._(path, isDir));
200 } 204 }
201 if ((event[0] & FileSystemEvent.MODIFY) != 0) { 205 if ((event[0] & FileSystemEvent.MODIFY) != 0) {
202 add(event[4], new FileSystemModifyEvent._(path, isDir, true)); 206 add(event[4], new FileSystemModifyEvent._(path, isDir, true));
203 } 207 }
204 if ((event[0] & FileSystemEvent._MODIFY_ATTRIBUTES) != 0) { 208 if ((event[0] & FileSystemEvent._MODIFY_ATTRIBUTES) != 0) {
205 add(event[4], new FileSystemModifyEvent._(path, isDir, false)); 209 add(event[4], new FileSystemModifyEvent._(path, isDir, false));
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 void _pathWatchedEnd() { 365 void _pathWatchedEnd() {
362 _subscription.cancel(); 366 _subscription.cancel();
363 _controller.close(); 367 _controller.close();
364 } 368 }
365 } 369 }
366 370
367 371
368 Uint8List _makeUint8ListView(Uint8List source, int offsetInBytes, int length) { 372 Uint8List _makeUint8ListView(Uint8List source, int offsetInBytes, int length) {
369 return new Uint8List.view(source.buffer, offsetInBytes, length); 373 return new Uint8List.view(source.buffer, offsetInBytes, length);
370 } 374 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698