Don't store bytes in the file cache.

We needed bytes only to get their length.
This CL replaces it to using the content (String) length.
This should help to fix heap usage regression.

R=paulberry@google.com

Change-Id: I4d58e91987db21233a71ca600eea8fae3fb38346
Reviewed-on: https://dart-review.googlesource.com/53243
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This commit is contained in:
Konstantin Shcheglov 2018-05-01 21:11:04 +00:00 committed by commit-bot@chromium.org
parent 73abd61304
commit fd27cc3435
2 changed files with 3 additions and 8 deletions

View file

@ -95,7 +95,7 @@ class AnalysisDriver implements AnalysisDriverGeneric {
/**
* The version of data format, should be incremented on every format change.
*/
static const int DATA_VERSION = 57;
static const int DATA_VERSION = 58;
/**
* The number of exception contexts allowed to write. Once this field is

View file

@ -403,12 +403,10 @@ class FileState {
* Return `true` if the API signature changed since the last refresh.
*/
bool refresh({bool allowCached: false}) {
List<int> contentBytes;
{
var rawFileState = _fsState._fileContentCache.get(path, allowCached);
_content = rawFileState.content;
_exists = rawFileState.exists;
contentBytes = rawFileState.contentBytes;
_contentHash = rawFileState.contentHash;
}
@ -416,7 +414,6 @@ class FileState {
{
ApiSignature signature = new ApiSignature();
signature.addUint32List(_fsState._salt);
signature.addInt(contentBytes.length);
signature.addString(_contentHash);
_unlinkedKey = '${signature.toHex()}.unlinked';
}
@ -974,11 +971,9 @@ class _FileContent {
final String path;
final bool exists;
final String content;
final List<int> contentBytes;
final String contentHash;
_FileContent(this.path, this.exists, this.content, this.contentBytes,
this.contentHash);
_FileContent(this.path, this.exists, this.content, this.contentHash);
}
/**
@ -1024,7 +1019,7 @@ class _FileContentCache {
List<int> contentHashBytes = md5.convert(contentBytes).bytes;
String contentHash = hex.encode(contentHashBytes);
file = new _FileContent(path, exists, content, contentBytes, contentHash);
file = new _FileContent(path, exists, content, contentHash);
_pathToFile[path] = file;
}
return file;