mirror of
https://github.com/dart-lang/sdk
synced 2024-10-06 14:07:57 +00:00
Rename methods of CiderByteStore.
Change-Id: Ief2d3308f1284a2c0529758beeb6776e3ef8bb8f Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247935 Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This commit is contained in:
parent
1b9554d481
commit
fb5884324a
|
@ -26,18 +26,18 @@ abstract class CiderByteStore {
|
||||||
/// count.
|
/// count.
|
||||||
///
|
///
|
||||||
/// Return `null` if the association does not exist.
|
/// Return `null` if the association does not exist.
|
||||||
Uint8List? get2(String key);
|
Uint8List? get(String key);
|
||||||
|
|
||||||
/// Associate [bytes] with [key].
|
/// Associate [bytes] with [key].
|
||||||
/// Return an internalized version of [bytes], the reference count is `1`.
|
/// Return an internalized version of [bytes], the reference count is `1`.
|
||||||
///
|
///
|
||||||
/// This method will throw an exception if there is already an association
|
/// This method will throw an exception if there is already an association
|
||||||
/// for the [key]. The client should either use [get2] to access data,
|
/// for the [key]. The client should either use [get] to access data,
|
||||||
/// or first [release2] it.
|
/// or first [release] it.
|
||||||
Uint8List putGet2(String key, Uint8List bytes);
|
Uint8List putGet(String key, Uint8List bytes);
|
||||||
|
|
||||||
/// Decrement the reference count for every key in [keys].
|
/// Decrement the reference count for every key in [keys].
|
||||||
void release2(Iterable<String> keys);
|
void release(Iterable<String> keys);
|
||||||
}
|
}
|
||||||
|
|
||||||
class CiderByteStoreTestView {
|
class CiderByteStoreTestView {
|
||||||
|
@ -53,7 +53,7 @@ class MemoryCiderByteStore implements CiderByteStore {
|
||||||
CiderByteStoreTestView? testView;
|
CiderByteStoreTestView? testView;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Uint8List? get2(String key) {
|
Uint8List? get(String key) {
|
||||||
final entry = map[key];
|
final entry = map[key];
|
||||||
if (entry == null) {
|
if (entry == null) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -64,7 +64,7 @@ class MemoryCiderByteStore implements CiderByteStore {
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Uint8List putGet2(String key, Uint8List bytes) {
|
Uint8List putGet(String key, Uint8List bytes) {
|
||||||
if (map.containsKey(key)) {
|
if (map.containsKey(key)) {
|
||||||
throw StateError('Overwriting is not allowed: $key');
|
throw StateError('Overwriting is not allowed: $key');
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ class MemoryCiderByteStore implements CiderByteStore {
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void release2(Iterable<String> keys) {
|
void release(Iterable<String> keys) {
|
||||||
for (final key in keys) {
|
for (final key in keys) {
|
||||||
final entry = map[key];
|
final entry = map[key];
|
||||||
if (entry != null) {
|
if (entry != null) {
|
||||||
|
|
|
@ -770,7 +770,7 @@ class _FileStateUnlinked {
|
||||||
// TODO(migration): should not be nullable
|
// TODO(migration): should not be nullable
|
||||||
Uint8List? unlinkedBytes;
|
Uint8List? unlinkedBytes;
|
||||||
{
|
{
|
||||||
unlinkedBytes = location._fsState._byteStore.get2(unlinkedKey);
|
unlinkedBytes = location._fsState._byteStore.get(unlinkedKey);
|
||||||
|
|
||||||
if (unlinkedBytes == null || unlinkedBytes.isEmpty) {
|
if (unlinkedBytes == null || unlinkedBytes.isEmpty) {
|
||||||
isUnlinkedFromCache = false;
|
isUnlinkedFromCache = false;
|
||||||
|
@ -792,7 +792,7 @@ class _FileStateUnlinked {
|
||||||
unlinkedBytes = unlinkedUnit.toBytes();
|
unlinkedBytes = unlinkedUnit.toBytes();
|
||||||
performance.getDataInt('length').add(unlinkedBytes!.length);
|
performance.getDataInt('length').add(unlinkedBytes!.length);
|
||||||
unlinkedBytes =
|
unlinkedBytes =
|
||||||
location._fsState._byteStore.putGet2(unlinkedKey, unlinkedBytes!);
|
location._fsState._byteStore.putGet(unlinkedKey, unlinkedBytes!);
|
||||||
testData?.unlinkedKeyPut.add(unlinkedKey);
|
testData?.unlinkedKeyPut.add(unlinkedKey);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -447,12 +447,12 @@ class FileResolver {
|
||||||
);
|
);
|
||||||
|
|
||||||
// Release the linked data, the reference count is `>= 1`.
|
// Release the linked data, the reference count is `>= 1`.
|
||||||
byteStore.release2(linkedKeysToRelease);
|
byteStore.release(linkedKeysToRelease);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Releases from the cache and clear [removedCacheKeys].
|
/// Releases from the cache and clear [removedCacheKeys].
|
||||||
void releaseAndClearRemovedIds() {
|
void releaseAndClearRemovedIds() {
|
||||||
byteStore.release2(removedCacheKeys);
|
byteStore.release(removedCacheKeys);
|
||||||
removedCacheKeys.clear();
|
removedCacheKeys.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -903,7 +903,7 @@ class LibraryContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
var resolutionKey = '${cycle.signatureStr}.resolution';
|
var resolutionKey = '${cycle.signatureStr}.resolution';
|
||||||
var resolutionBytes = byteStore.get2(resolutionKey);
|
var resolutionBytes = byteStore.get(resolutionKey);
|
||||||
|
|
||||||
var unitsInformativeBytes = <Uri, Uint8List>{};
|
var unitsInformativeBytes = <Uri, Uint8List>{};
|
||||||
for (var library in cycle.libraries) {
|
for (var library in cycle.libraries) {
|
||||||
|
@ -976,7 +976,7 @@ class LibraryContext {
|
||||||
librariesLinked += cycle.libraries.length;
|
librariesLinked += cycle.libraries.length;
|
||||||
|
|
||||||
resolutionBytes = linkResult.resolutionBytes;
|
resolutionBytes = linkResult.resolutionBytes;
|
||||||
resolutionBytes = byteStore.putGet2(resolutionKey, resolutionBytes);
|
resolutionBytes = byteStore.putGet(resolutionKey, resolutionBytes);
|
||||||
performance.getDataInt('bytesPut').add(resolutionBytes.length);
|
performance.getDataInt('bytesPut').add(resolutionBytes.length);
|
||||||
testData?.forCycle(cycle).putKeys.add(resolutionKey);
|
testData?.forCycle(cycle).putKeys.add(resolutionKey);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue