Chromium Code Reviews| Index: pkg/analyzer/lib/src/summary/incremental_cache.dart |
| diff --git a/pkg/analyzer/lib/src/summary/incremental_cache.dart b/pkg/analyzer/lib/src/summary/incremental_cache.dart |
| index 99007734f9e7283db55e13e525e26ed56e142ed2..5efc7ada3c0e4df44f9461fc56146fccafd5041a 100644 |
| --- a/pkg/analyzer/lib/src/summary/incremental_cache.dart |
| +++ b/pkg/analyzer/lib/src/summary/incremental_cache.dart |
| @@ -2,7 +2,7 @@ |
| // for details. All rights reserved. Use of this source code is governed by a |
| // BSD-style license that can be found in the LICENSE file. |
| -import 'dart:convert' show UTF8; |
| +import 'dart:convert' show ChunkedConversionSink, UTF8; |
| import 'dart:core' hide Resource; |
| import 'package:analyzer/dart/element/element.dart'; |
| @@ -12,6 +12,7 @@ import 'package:analyzer/src/generated/source.dart'; |
| import 'package:analyzer/src/summary/format.dart'; |
| import 'package:analyzer/src/summary/idl.dart'; |
| import 'package:analyzer/src/summary/summarize_elements.dart'; |
| +import 'package:convert/convert.dart'; |
| import 'package:crypto/crypto.dart'; |
| /** |
| @@ -242,7 +243,7 @@ class IncrementalCache { |
| */ |
| String _getCacheSourceContentKey(Source source) { |
| List<int> hash = _getSourceContentHash(source); |
| - String hashStr = CryptoUtils.bytesToHex(hash); |
| + String hashStr = hex.encode(hash); |
| return '$hashStr.content'; |
| } |
| @@ -267,7 +268,7 @@ class IncrementalCache { |
| */ |
| String _getLibraryBundleKey(Source librarySource) { |
| List<int> hash = _getLibraryClosureHash(librarySource); |
| - String hashStr = CryptoUtils.bytesToHex(hash); |
| + String hashStr = hex.encode(hash); |
| return '$hashStr.summary'; |
| } |
| @@ -291,13 +292,19 @@ class IncrementalCache { |
| List<int> _getLibraryClosureHash(Source librarySource) { |
| return _libraryClosureHashMap.putIfAbsent(librarySource, () { |
| List<Source> closure = _getLibraryClosure(librarySource); |
| - MD5 md5 = new MD5(); |
| + |
| + var digestList = <int>[]; |
| + |
| + var sink = new ChunkedConversionSink<List<int>>.withCallback((value) { |
| + digestList = value; |
| + }); |
| + |
| for (Source source in closure) { |
| List<int> sourceHash = _getSourceContentHash(source); |
| - md5.add(sourceHash); |
| + sink.add(sourceHash); |
| } |
| - md5.add(configSalt); |
| - return md5.close(); |
| + sink.add(configSalt); |
| + return md5.convert(digestList).bytes; |
|
nweiz
2016/04/14 21:53:09
All you're doing here is a very roundabout way of
kevmoo
2016/04/14 23:13:35
Done.
|
| }); |
| } |
| @@ -308,7 +315,7 @@ class IncrementalCache { |
| return _sourceContentHashMap.putIfAbsent(source, () { |
| String sourceText = source.contents.data; |
| List<int> sourceBytes = UTF8.encode(sourceText); |
| - return (new MD5()..add(sourceBytes)).close(); |
| + return md5.convert(sourceBytes).bytes; |
| }); |
| } |