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

Unified Diff: pkg/analysis_server/lib/src/analysis_server.dart

Issue 2473473002: Use FileContentOverlay instead of ContentCache in the new driver. (Closed)
Patch Set: Created 4 years, 1 month 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/analysis_server/lib/src/analysis_server.dart
diff --git a/pkg/analysis_server/lib/src/analysis_server.dart b/pkg/analysis_server/lib/src/analysis_server.dart
index 292043a493a7e7de772790378db2056090967a3f..46ea3341e0115cfd28e9ac21e3e61095f2bb9b2a 100644
--- a/pkg/analysis_server/lib/src/analysis_server.dart
+++ b/pkg/analysis_server/lib/src/analysis_server.dart
@@ -38,6 +38,7 @@ import 'package:analyzer/src/context/builder.dart';
import 'package:analyzer/src/dart/analysis/byte_store.dart';
import 'package:analyzer/src/dart/analysis/driver.dart' as nd;
import 'package:analyzer/src/dart/analysis/file_byte_store.dart';
+import 'package:analyzer/src/dart/analysis/file_state.dart' as nd;
import 'package:analyzer/src/dart/ast/utilities.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:analyzer/src/generated/sdk.dart';
@@ -265,6 +266,11 @@ class AnalysisServer {
new DateTime.now().millisecondsSinceEpoch + 1000;
/**
+ * The content overlay for all analysis drivers.
+ */
+ final nd.FileContentOverlay fileContentOverlay = new nd.FileContentOverlay();
+
+ /**
* The current state of overlays from the client. This is used as the
* content cache for all contexts.
*/
@@ -1338,9 +1344,8 @@ class AnalysisServer {
void updateContent(String id, Map<String, dynamic> changes) {
if (options.enableNewAnalysisDriver) {
changes.forEach((file, change) {
- Source source = resourceProvider.getFile(file).createSource();
// Prepare the new contents.
- String oldContents = overlayState.getContents(source);
+ String oldContents = fileContentOverlay[file];
String newContents;
if (change is AddContentOverlay) {
newContents = change.content;
@@ -1366,7 +1371,7 @@ class AnalysisServer {
throw new AnalysisException('Illegal change type');
}
- overlayState.setContents(source, newContents);
+ fileContentOverlay[file] = newContents;
driverMap.values.forEach((driver) {
driver.changeFile(file);
@@ -1702,7 +1707,7 @@ class ServerContextManagerCallbacks extends ContextManagerCallbacks {
new nd.PerformanceLog(io.stdout),
resourceProvider,
analysisServer.byteStore,
- analysisServer.overlayState,
+ analysisServer.fileContentOverlay,
sourceFactory,
analysisOptions);
analysisDriver.name = folder.shortName;
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/dart/analysis/driver.dart » ('j') | pkg/analyzer/lib/src/dart/analysis/file_state.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698