mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 00:13:50 +00:00
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:
parent
73abd61304
commit
fd27cc3435
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue