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

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

Issue 426773002: Issue 20240. Use a FileManager that manages its own temporary directory. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 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 socket.server; 5 library socket.server;
6 6
7 import 'dart:io' as io;
8
9 import 'package:analysis_server/src/analysis_server.dart'; 7 import 'package:analysis_server/src/analysis_server.dart';
10 import 'package:analysis_server/src/channel.dart'; 8 import 'package:analysis_server/src/channel.dart';
11 import 'package:analysis_server/src/domain_analysis.dart'; 9 import 'package:analysis_server/src/domain_analysis.dart';
12 import 'package:analysis_server/src/domain_completion.dart'; 10 import 'package:analysis_server/src/domain_completion.dart';
13 import 'package:analysis_server/src/edit/edit_domain.dart'; 11 import 'package:analysis_server/src/edit/edit_domain.dart';
14 import 'package:analysis_server/src/search/search_domain.dart'; 12 import 'package:analysis_server/src/search/search_domain.dart';
15 import 'package:analysis_server/src/domain_server.dart'; 13 import 'package:analysis_server/src/domain_server.dart';
16 import 'package:analysis_server/src/package_map_provider.dart'; 14 import 'package:analysis_server/src/package_map_provider.dart';
17 import 'package:analysis_server/src/protocol.dart'; 15 import 'package:analysis_server/src/protocol.dart';
18 import 'package:analyzer/file_system/physical_file_system.dart'; 16 import 'package:analyzer/file_system/physical_file_system.dart';
19 import 'package:analyzer/src/generated/sdk_io.dart'; 17 import 'package:analyzer/src/generated/sdk_io.dart';
20 import 'package:path/path.dart' as pathos;
21 import 'package:analysis_services/index/index.dart'; 18 import 'package:analysis_services/index/index.dart';
22 import 'package:analysis_services/index/local_file_index.dart'; 19 import 'package:analysis_services/index/local_file_index.dart';
23 20
24 21
25 /** 22 /**
26 * Creates and runs an [Index]. 23 * Creates and runs an [Index].
27 */ 24 */
28 Index _createIndex() { 25 Index _createIndex() {
29 String tempPath = io.Directory.systemTemp.path; 26 Index index = createLocalFileIndex();
30 String indexPath = pathos.join(tempPath, 'AnalysisServer_index');
31 io.Directory indexDirectory = new io.Directory(indexPath);
32 if (indexDirectory.existsSync()) {
33 indexDirectory.deleteSync(recursive: true);
34 }
35 if (!indexDirectory.existsSync()) {
36 indexDirectory.createSync();
37 }
38 Index index = createLocalFileIndex(indexDirectory);
39 index.run(); 27 index.run();
40 return index; 28 return index;
41 } 29 }
42 30
43 31
44 /** 32 /**
45 * Instances of the class [SocketServer] implement the common parts of 33 * Instances of the class [SocketServer] implement the common parts of
46 * http-based and stdio-based analysis servers. The primary responsibility of 34 * http-based and stdio-based analysis servers. The primary responsibility of
47 * the SocketServer is to manage the lifetime of the AnalysisServer and to 35 * the SocketServer is to manage the lifetime of the AnalysisServer and to
48 * encode and decode the JSON messages exchanged with the client. 36 * encode and decode the JSON messages exchanged with the client.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 void _initializeHandlers(AnalysisServer server) { 76 void _initializeHandlers(AnalysisServer server) {
89 server.handlers = [ 77 server.handlers = [
90 new ServerDomainHandler(server), 78 new ServerDomainHandler(server),
91 new AnalysisDomainHandler(server), 79 new AnalysisDomainHandler(server),
92 new EditDomainHandler(server), 80 new EditDomainHandler(server),
93 new SearchDomainHandler(server), 81 new SearchDomainHandler(server),
94 new CompletionDomainHandler(server), 82 new CompletionDomainHandler(server),
95 ]; 83 ];
96 } 84 }
97 } 85 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698