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

Side by Side Diff: pkg/analysis_server/lib/src/resource.dart

Issue 366463002: Change Maps to HashMaps to save in performance, index and generated directories not touched (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 5 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
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 library resource; 5 library resource;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 import 'dart:io' as io; 9 import 'dart:io' as io;
10 10
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 return streamController.stream; 275 return streamController.stream;
276 } 276 }
277 } 277 }
278 278
279 279
280 /** 280 /**
281 * An in-memory implementation of [ResourceProvider]. 281 * An in-memory implementation of [ResourceProvider].
282 * Use `/` as a path separator. 282 * Use `/` as a path separator.
283 */ 283 */
284 class MemoryResourceProvider implements ResourceProvider { 284 class MemoryResourceProvider implements ResourceProvider {
285 final Map<String, _MemoryResource> _pathToResource = 285 final HashMap<String, _MemoryResource> _pathToResource =
286 new HashMap<String, _MemoryResource>(); 286 new HashMap<String, _MemoryResource>();
287 final Map<String, String> _pathToContent = new HashMap<String, String>(); 287 final HashMap<String, String> _pathToContent = new HashMap<String, String>();
288 final Map<String, int> _pathToTimestamp = new HashMap<String, int>(); 288 final HashMap<String, int> _pathToTimestamp = new HashMap<String, int>();
289 final Map<String, List<StreamController<WatchEvent>>> _pathToWatchers = 289 final HashMap<String, List<StreamController<WatchEvent>>> _pathToWatchers =
290 new HashMap<String, List<StreamController<WatchEvent>>>(); 290 new HashMap<String, List<StreamController<WatchEvent>>>();
291 int nextStamp = 0; 291 int nextStamp = 0;
292 292
293 @override 293 @override
294 Resource getResource(String path) { 294 Resource getResource(String path) {
295 path = posix.normalize(path); 295 path = posix.normalize(path);
296 Resource resource = _pathToResource[path]; 296 Resource resource = _pathToResource[path];
297 if (resource == null) { 297 if (resource == null) {
298 resource = new _MemoryFile(this, path); 298 resource = new _MemoryFile(this, path);
299 } 299 }
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 } 518 }
519 519
520 /** 520 /**
521 * Return `true` if the given URI is a `file` URI. 521 * Return `true` if the given URI is a `file` URI.
522 * 522 *
523 * @param uri the URI being tested 523 * @param uri the URI being tested
524 * @return `true` if the given URI is a `file` URI 524 * @return `true` if the given URI is a `file` URI
525 */ 525 */
526 static bool _isFileUri(Uri uri) => uri.scheme == _FILE_SCHEME; 526 static bool _isFileUri(Uri uri) => uri.scheme == _FILE_SCHEME;
527 } 527 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/protocol.dart ('k') | pkg/analysis_server/test/package_uri_resolver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698