OLD | NEW |
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 analysis.server; | 5 library analysis.server; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:collection'; | 8 import 'dart:collection'; |
9 import 'dart:core'; | 9 import 'dart:core'; |
10 import 'dart:io' as io; | 10 import 'dart:io' as io; |
(...skipping 1800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1811 | 1811 |
1812 /** | 1812 /** |
1813 * The [ResourceProvider] by which paths are converted into [Resource]s. | 1813 * The [ResourceProvider] by which paths are converted into [Resource]s. |
1814 */ | 1814 */ |
1815 final ResourceProvider resourceProvider; | 1815 final ResourceProvider resourceProvider; |
1816 | 1816 |
1817 ServerContextManagerCallbacks(this.analysisServer, this.resourceProvider); | 1817 ServerContextManagerCallbacks(this.analysisServer, this.resourceProvider); |
1818 | 1818 |
1819 @override | 1819 @override |
1820 nd.AnalysisDriver addAnalysisDriver(Folder folder, AnalysisOptions options) { | 1820 nd.AnalysisDriver addAnalysisDriver(Folder folder, AnalysisOptions options) { |
1821 SourceFactory sourceFactory; | 1821 ContextBuilder builder = createContextBuilder(folder, options); |
1822 AnalysisOptions analysisOptions; | 1822 nd.AnalysisDriver analysisDriver = builder.buildDriver(folder.path); |
1823 { | |
1824 ContextBuilder builder = createContextBuilder(folder, options); | |
1825 AnalysisContext context = builder.buildContext(folder.path); | |
1826 sourceFactory = context.sourceFactory; | |
1827 analysisOptions = context.analysisOptions; | |
1828 context.dispose(); | |
1829 } | |
1830 nd.AnalysisDriver analysisDriver = new nd.AnalysisDriver( | |
1831 analysisServer.analysisDriverScheduler, | |
1832 analysisServer._analysisPerformanceLogger, | |
1833 resourceProvider, | |
1834 analysisServer.byteStore, | |
1835 analysisServer.fileContentOverlay, | |
1836 folder.path, | |
1837 sourceFactory, | |
1838 analysisOptions); | |
1839 analysisDriver.status.listen((status) { | 1823 analysisDriver.status.listen((status) { |
1840 // TODO(scheglov) send server status | 1824 // TODO(scheglov) send server status |
1841 }); | 1825 }); |
1842 analysisDriver.results.listen((result) { | 1826 analysisDriver.results.listen((result) { |
1843 new_sendErrorNotification(analysisServer, result); | 1827 new_sendErrorNotification(analysisServer, result); |
1844 String path = result.path; | 1828 String path = result.path; |
1845 CompilationUnit unit = result.unit; | 1829 CompilationUnit unit = result.unit; |
1846 if (unit != null) { | 1830 if (unit != null) { |
1847 if (analysisServer._hasAnalysisServiceSubscription( | 1831 if (analysisServer._hasAnalysisServiceSubscription( |
1848 AnalysisService.HIGHLIGHTS, path)) { | 1832 AnalysisService.HIGHLIGHTS, path)) { |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1966 builderOptions.defaultPackageFilePath = defaultPackageFilePath; | 1950 builderOptions.defaultPackageFilePath = defaultPackageFilePath; |
1967 builderOptions.defaultPackagesDirectoryPath = defaultPackagesDirectoryPath; | 1951 builderOptions.defaultPackagesDirectoryPath = defaultPackagesDirectoryPath; |
1968 if (analysisServer.options.enablePubSummaryManager) { | 1952 if (analysisServer.options.enablePubSummaryManager) { |
1969 builderOptions.pubSummaryManager = analysisServer.pubSummaryManager; | 1953 builderOptions.pubSummaryManager = analysisServer.pubSummaryManager; |
1970 } | 1954 } |
1971 ContextBuilder builder = new ContextBuilder(resourceProvider, | 1955 ContextBuilder builder = new ContextBuilder(resourceProvider, |
1972 analysisServer.sdkManager, analysisServer.overlayState, | 1956 analysisServer.sdkManager, analysisServer.overlayState, |
1973 options: builderOptions); | 1957 options: builderOptions); |
1974 builder.fileResolverProvider = analysisServer.fileResolverProvider; | 1958 builder.fileResolverProvider = analysisServer.fileResolverProvider; |
1975 builder.packageResolverProvider = analysisServer.packageResolverProvider; | 1959 builder.packageResolverProvider = analysisServer.packageResolverProvider; |
| 1960 builder.analysisDriverScheduler = analysisServer.analysisDriverScheduler; |
| 1961 builder.performanceLog = analysisServer._analysisPerformanceLogger; |
| 1962 builder.byteStore = analysisServer.byteStore; |
| 1963 builder.fileContentOverlay = analysisServer.fileContentOverlay; |
1976 return builder; | 1964 return builder; |
1977 } | 1965 } |
1978 | 1966 |
1979 @override | 1967 @override |
1980 void moveContext(Folder from, Folder to) { | 1968 void moveContext(Folder from, Folder to) { |
1981 // There is nothing to do. | 1969 // There is nothing to do. |
1982 // This method is mostly for tests. | 1970 // This method is mostly for tests. |
1983 // Context managers manage folders and contexts themselves. | 1971 // Context managers manage folders and contexts themselves. |
1984 } | 1972 } |
1985 | 1973 |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2123 /** | 2111 /** |
2124 * The [PerformanceTag] for time spent in server request handlers. | 2112 * The [PerformanceTag] for time spent in server request handlers. |
2125 */ | 2113 */ |
2126 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); | 2114 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); |
2127 | 2115 |
2128 /** | 2116 /** |
2129 * The [PerformanceTag] for time spent in split store microtasks. | 2117 * The [PerformanceTag] for time spent in split store microtasks. |
2130 */ | 2118 */ |
2131 static PerformanceTag splitStore = new PerformanceTag('splitStore'); | 2119 static PerformanceTag splitStore = new PerformanceTag('splitStore'); |
2132 } | 2120 } |
OLD | NEW |