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

Unified Diff: pkg/analyzer/lib/src/summary/package_bundle_reader.dart

Issue 2710193004: Fix SummaryDataStore to support using a ResourceProvider instead of dart:io (Closed)
Patch Set: Fix SummaryDataStore to support using a ResourceProvider instead of dart:io Created 3 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 | « pkg/analyzer/lib/src/dart/sdk/sdk.dart ('k') | pkg/analyzer/lib/src/summary/summary_sdk.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/summary/package_bundle_reader.dart
diff --git a/pkg/analyzer/lib/src/summary/package_bundle_reader.dart b/pkg/analyzer/lib/src/summary/package_bundle_reader.dart
index 31c392b5c43c435ecb0d2fd5a6727ca5694bfe9e..bf9361d635a98998ae98d5043308a59502c61d3e 100644
--- a/pkg/analyzer/lib/src/summary/package_bundle_reader.dart
+++ b/pkg/analyzer/lib/src/summary/package_bundle_reader.dart
@@ -348,10 +348,10 @@ class SummaryDataStore {
* [dependencies].
*/
SummaryDataStore(Iterable<String> summaryPaths,
- {bool recordDependencyInfo: false})
+ {bool recordDependencyInfo: false, ResourceProvider resourceProvider})
: dependencies =
recordDependencyInfo ? <PackageDependencyInfoBuilder>[] : null {
- summaryPaths.forEach(_fillMaps);
+ summaryPaths.forEach((String path) => _fillMaps(path, resourceProvider));
}
/**
@@ -412,6 +412,7 @@ class SummaryDataStore {
* the given [unitUriString], or `null` if no such library is in the store.
*/
List<String> getContainingLibraryUris(String unitUriString) {
+
// The unit is the defining unit of a library.
if (linkedMap.containsKey(unitUriString)) {
return <String>[unitUriString];
@@ -432,9 +433,15 @@ class SummaryDataStore {
return libraryUriStrings.isNotEmpty ? libraryUriStrings : null;
}
- void _fillMaps(String path) {
- io.File file = new io.File(path);
- List<int> buffer = file.readAsBytesSync();
+ void _fillMaps(String path, ResourceProvider resourceProvider) {
+ List<int> buffer;
+ if (resourceProvider != null) {
+ var file = resourceProvider.getFile(path);
+ buffer = file.readAsBytesSync();
+ } else {
+ io.File file = new io.File(path);
+ buffer = file.readAsBytesSync();
+ }
PackageBundle bundle = new PackageBundle.fromBuffer(buffer);
addBundle(path, bundle);
}
« no previous file with comments | « pkg/analyzer/lib/src/dart/sdk/sdk.dart ('k') | pkg/analyzer/lib/src/summary/summary_sdk.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698