1
0
mirror of https://github.com/dart-lang/sdk synced 2024-07-05 09:20:04 +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:
Konstantin Shcheglov 2022-06-13 05:04:16 +00:00 committed by Commit Bot
parent 1b9554d481
commit fb5884324a
3 changed files with 14 additions and 14 deletions

View File

@ -26,18 +26,18 @@ abstract class CiderByteStore {
/// count.
///
/// Return `null` if the association does not exist.
Uint8List? get2(String key);
Uint8List? get(String key);
/// Associate [bytes] with [key].
/// Return an internalized version of [bytes], the reference count is `1`.
///
/// This method will throw an exception if there is already an association
/// for the [key]. The client should either use [get2] to access data,
/// or first [release2] it.
Uint8List putGet2(String key, Uint8List bytes);
/// for the [key]. The client should either use [get] to access data,
/// or first [release] it.
Uint8List putGet(String key, Uint8List bytes);
/// Decrement the reference count for every key in [keys].
void release2(Iterable<String> keys);
void release(Iterable<String> keys);
}
class CiderByteStoreTestView {
@ -53,7 +53,7 @@ class MemoryCiderByteStore implements CiderByteStore {
CiderByteStoreTestView? testView;
@override
Uint8List? get2(String key) {
Uint8List? get(String key) {
final entry = map[key];
if (entry == null) {
return null;
@ -64,7 +64,7 @@ class MemoryCiderByteStore implements CiderByteStore {
}
@override
Uint8List putGet2(String key, Uint8List bytes) {
Uint8List putGet(String key, Uint8List bytes) {
if (map.containsKey(key)) {
throw StateError('Overwriting is not allowed: $key');
}
@ -75,7 +75,7 @@ class MemoryCiderByteStore implements CiderByteStore {
}
@override
void release2(Iterable<String> keys) {
void release(Iterable<String> keys) {
for (final key in keys) {
final entry = map[key];
if (entry != null) {

View File

@ -770,7 +770,7 @@ class _FileStateUnlinked {
// TODO(migration): should not be nullable
Uint8List? unlinkedBytes;
{
unlinkedBytes = location._fsState._byteStore.get2(unlinkedKey);
unlinkedBytes = location._fsState._byteStore.get(unlinkedKey);
if (unlinkedBytes == null || unlinkedBytes.isEmpty) {
isUnlinkedFromCache = false;
@ -792,7 +792,7 @@ class _FileStateUnlinked {
unlinkedBytes = unlinkedUnit.toBytes();
performance.getDataInt('length').add(unlinkedBytes!.length);
unlinkedBytes =
location._fsState._byteStore.putGet2(unlinkedKey, unlinkedBytes!);
location._fsState._byteStore.putGet(unlinkedKey, unlinkedBytes!);
testData?.unlinkedKeyPut.add(unlinkedKey);
});

View File

@ -447,12 +447,12 @@ class FileResolver {
);
// Release the linked data, the reference count is `>= 1`.
byteStore.release2(linkedKeysToRelease);
byteStore.release(linkedKeysToRelease);
}
/// Releases from the cache and clear [removedCacheKeys].
void releaseAndClearRemovedIds() {
byteStore.release2(removedCacheKeys);
byteStore.release(removedCacheKeys);
removedCacheKeys.clear();
}
@ -903,7 +903,7 @@ class LibraryContext {
}
var resolutionKey = '${cycle.signatureStr}.resolution';
var resolutionBytes = byteStore.get2(resolutionKey);
var resolutionBytes = byteStore.get(resolutionKey);
var unitsInformativeBytes = <Uri, Uint8List>{};
for (var library in cycle.libraries) {
@ -976,7 +976,7 @@ class LibraryContext {
librariesLinked += cycle.libraries.length;
resolutionBytes = linkResult.resolutionBytes;
resolutionBytes = byteStore.putGet2(resolutionKey, resolutionBytes);
resolutionBytes = byteStore.putGet(resolutionKey, resolutionBytes);
performance.getDataInt('bytesPut').add(resolutionBytes.length);
testData?.forCycle(cycle).putKeys.add(resolutionKey);