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

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

Issue 983183003: Convert content cache to use file paths (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 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
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/source.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 analysis_server.src.get_handler; 5 library analysis_server.src.get_handler;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 import 'dart:convert'; 9 import 'dart:convert';
10 import 'dart:io'; 10 import 'dart:io';
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 } else { 679 } else {
680 implicitNames.add(sourceName); 680 implicitNames.add(sourceName);
681 } 681 }
682 links[sourceName] = link; 682 links[sourceName] = link;
683 } 683 }
684 }); 684 });
685 explicitNames.sort(); 685 explicitNames.sort();
686 implicitNames.sort(); 686 implicitNames.sort();
687 687
688 _overlayContents.clear(); 688 _overlayContents.clear();
689 context.visitContentCache((Source source, int stamp, String contents) { 689 context.visitContentCache((String fullName, int stamp, String contents) {
690 _overlayContents[source.fullName] = contents; 690 _overlayContents[fullName] = contents;
691 }); 691 });
692 692
693 void _writeFiles( 693 void _writeFiles(
694 StringBuffer buffer, String title, List<String> fileNames) { 694 StringBuffer buffer, String title, List<String> fileNames) {
695 buffer.write('<h3>$title</h3>'); 695 buffer.write('<h3>$title</h3>');
696 if (fileNames == null || fileNames.isEmpty) { 696 if (fileNames == null || fileNames.isEmpty) {
697 buffer.write('<p>None</p>'); 697 buffer.write('<p>None</p>');
698 } else { 698 } else {
699 buffer.write('<table style="width: 100%">'); 699 buffer.write('<table style="width: 100%">');
700 for (String fileName in fileNames) { 700 for (String fileName in fileNames) {
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
880 if (analysisServer == null) { 880 if (analysisServer == null) {
881 return _returnFailure(request, 'Analysis server is not running'); 881 return _returnFailure(request, 'Analysis server is not running');
882 } 882 }
883 883
884 _writeResponse(request, (StringBuffer buffer) { 884 _writeResponse(request, (StringBuffer buffer) {
885 _writePage(buffer, 'Analysis Server - Overlays', [], 885 _writePage(buffer, 'Analysis Server - Overlays', [],
886 (StringBuffer buffer) { 886 (StringBuffer buffer) {
887 buffer.write('<table border="1">'); 887 buffer.write('<table border="1">');
888 _overlayContents.clear(); 888 _overlayContents.clear();
889 ContentCache overlayState = analysisServer.overlayState; 889 ContentCache overlayState = analysisServer.overlayState;
890 overlayState.accept((Source source, int stamp, String contents) { 890 overlayState.accept((String fullName, int stamp, String contents) {
891 String fileName = source.fullName;
892 buffer.write('<tr>'); 891 buffer.write('<tr>');
893 String link = 892 String link =
894 makeLink(OVERLAY_PATH, {PATH_PARAM: fileName}, fileName); 893 makeLink(OVERLAY_PATH, {PATH_PARAM: fullName}, fullName);
895 DateTime time = new DateTime.fromMillisecondsSinceEpoch(stamp); 894 DateTime time = new DateTime.fromMillisecondsSinceEpoch(stamp);
896 _writeRow(buffer, [link, time]); 895 _writeRow(buffer, [link, time]);
897 _overlayContents[fileName] = contents; 896 _overlayContents[fullName] = contents;
898 }); 897 });
899 int count = _overlayContents.length; 898 int count = _overlayContents.length;
900 buffer.write('<tr><td colspan="2">Total: $count entries.</td></tr>'); 899 buffer.write('<tr><td colspan="2">Total: $count entries.</td></tr>');
901 buffer.write('</table>'); 900 buffer.write('</table>');
902 }); 901 });
903 }); 902 });
904 } 903 }
905 904
906 /** 905 /**
907 * Return a response indicating the status of the analysis server. 906 * Return a response indicating the status of the analysis server.
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after
1557 */ 1556 */
1558 static String makeLink( 1557 static String makeLink(
1559 String path, Map<String, String> params, String innerHtml, 1558 String path, Map<String, String> params, String innerHtml,
1560 [bool hasError = false]) { 1559 [bool hasError = false]) {
1561 Uri uri = new Uri(path: path, queryParameters: params); 1560 Uri uri = new Uri(path: path, queryParameters: params);
1562 String href = HTML_ESCAPE.convert(uri.toString()); 1561 String href = HTML_ESCAPE.convert(uri.toString());
1563 String classAttribute = hasError ? ' class="error"' : ''; 1562 String classAttribute = hasError ? ' class="error"' : '';
1564 return '<a href="$href"$classAttribute>$innerHtml</a>'; 1563 return '<a href="$href"$classAttribute>$innerHtml</a>';
1565 } 1564 }
1566 } 1565 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/source.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698