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

Unified Diff: pkg/analyzer_cli/lib/src/driver.dart

Issue 2696083002: Reapply "Switch to the new analysis driver in analyzer_cli." (Closed)
Patch Set: 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
Index: pkg/analyzer_cli/lib/src/driver.dart
diff --git a/pkg/analyzer_cli/lib/src/driver.dart b/pkg/analyzer_cli/lib/src/driver.dart
index 067491fde610dc26c6e1269fe12c13bf61cd5b1d..0c4f86d073d665ab0213fd718a289a4aa57a6366 100644
--- a/pkg/analyzer_cli/lib/src/driver.dart
+++ b/pkg/analyzer_cli/lib/src/driver.dart
@@ -21,6 +21,7 @@ import 'package:analyzer/source/sdk_ext.dart';
import 'package:analyzer/src/context/builder.dart';
import 'package:analyzer/src/dart/analysis/byte_store.dart';
import 'package:analyzer/src/dart/analysis/driver.dart';
+import 'package:analyzer/src/dart/analysis/file_byte_store.dart';
import 'package:analyzer/src/dart/analysis/file_state.dart';
import 'package:analyzer/src/dart/sdk/sdk.dart';
import 'package:analyzer/src/generated/constant.dart';
@@ -76,7 +77,14 @@ class Driver implements CommandLineStarter {
static final PerformanceTag _analyzeAllTag =
new PerformanceTag("Driver._analyzeAll");
- static ByteStore analysisDriverByteStore = new MemoryByteStore();
+ static ByteStore analysisDriverMemoryByteStore = new MemoryByteStore();
+ static ByteStore analysisDriverFileByteStore = new MemoryCachingByteStore(
+ new EvictingFileByteStore(
+ PhysicalResourceProvider.INSTANCE
+ .getStateLocation('.analysis-driver')
+ .path,
+ 1024 * 1024 * 1024 /*1 GiB*/),
+ 64 * 1024 * 1024 /*64 MiB*/);
/// The plugins that are defined outside the `analyzer_cli` package.
List<Plugin> _userDefinedPlugins = <Plugin>[];
@@ -579,7 +587,9 @@ class Driver implements CommandLineStarter {
scheduler,
log,
resourceProvider,
- analysisDriverByteStore,
+ options.useAnalysisDriverMemoryByteStore
+ ? analysisDriverMemoryByteStore
+ : analysisDriverFileByteStore,
new FileContentOverlay(),
'test',
context.sourceFactory,
@@ -723,6 +733,20 @@ class Driver implements CommandLineStarter {
}
}
+ static AnalysisOptionsImpl createAnalysisOptions(
+ file_system.ResourceProvider resourceProvider,
+ SourceFactory sourceFactory,
+ CommandLineOptions options) {
+ // Prepare context options.
+ AnalysisOptionsImpl analysisOptions =
+ createAnalysisOptionsForCommandLineOptions(options);
+
+ // Process analysis options file (and notify all interested parties).
+ _processAnalysisOptions(
+ resourceProvider, sourceFactory, analysisOptions, options);
+ return analysisOptions;
+ }
+
static AnalysisOptionsImpl createAnalysisOptionsForCommandLineOptions(
CommandLineOptions options) {
AnalysisOptionsImpl contextOptions = new AnalysisOptionsImpl();
@@ -740,20 +764,6 @@ class Driver implements CommandLineStarter {
return contextOptions;
}
- static AnalysisOptionsImpl createAnalysisOptions(
- file_system.ResourceProvider resourceProvider,
- SourceFactory sourceFactory,
- CommandLineOptions options) {
- // Prepare context options.
- AnalysisOptionsImpl analysisOptions =
- createAnalysisOptionsForCommandLineOptions(options);
-
- // Process analysis options file (and notify all interested parties).
- _processAnalysisOptions(
- resourceProvider, sourceFactory, analysisOptions, options);
- return analysisOptions;
- }
-
static void setAnalysisContextOptions(
file_system.ResourceProvider resourceProvider,
SourceFactory sourceFactory,

Powered by Google App Engine
This is Rietveld 408576698