OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * The track map is a simple wrapper around a map that keeps track | 6 * The track map is a simple wrapper around a map that keeps track |
7 * of the 'final' size of maps grouped by description. It allows | 7 * of the 'final' size of maps grouped by description. It allows |
8 * determining the distribution of sizes for a specific allocation | 8 * determining the distribution of sizes for a specific allocation |
9 * site and it can be used like this: | 9 * site and it can be used like this: |
10 * | 10 * |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 }); | 50 }); |
51 } | 51 } |
52 | 52 |
53 int get length => _map.length; | 53 int get length => _map.length; |
54 bool get isEmpty => _map.isEmpty; | 54 bool get isEmpty => _map.isEmpty; |
55 bool get isNotEmpty => _map.isNotEmpty; | 55 bool get isNotEmpty => _map.isNotEmpty; |
56 | 56 |
57 Iterable<K> get keys => _map.keys; | 57 Iterable<K> get keys => _map.keys; |
58 Iterable<V> get values => _map.values; | 58 Iterable<V> get values => _map.values; |
59 | 59 |
60 bool containsKey(K key) => _map.containsKey(key); | 60 bool containsKey(Object key) => _map.containsKey(key); |
61 bool containsValue(V value) => _map.containsValue(value); | 61 bool containsValue(Object value) => _map.containsValue(value); |
62 | 62 |
63 V operator [](K key) => _map[key]; | 63 V operator [](Object key) => _map[key]; |
64 String toString() => _map.toString(); | 64 String toString() => _map.toString(); |
65 | 65 |
66 void forEach(void action(K key, V value)) { | 66 void forEach(void action(K key, V value)) { |
67 _map.forEach(action); | 67 _map.forEach(action); |
68 } | 68 } |
69 | 69 |
70 void operator []=(K key, V value) { | 70 void operator []=(K key, V value) { |
71 if (!_map.containsKey(key)) { | 71 if (!_map.containsKey(key)) { |
72 _notifyLengthChanged(1); | 72 _notifyLengthChanged(1); |
73 _map[key] = value; | 73 _map[key] = value; |
(...skipping 28 matching lines...) Expand all Loading... |
102 int newLength = oldLength + delta; | 102 int newLength = oldLength + delta; |
103 _counts[oldLength]--; | 103 _counts[oldLength]--; |
104 if (newLength < _counts.length) { | 104 if (newLength < _counts.length) { |
105 _counts[newLength]++; | 105 _counts[newLength]++; |
106 } else { | 106 } else { |
107 _counts.add(1); | 107 _counts.add(1); |
108 assert(newLength == _counts.length - 1); | 108 assert(newLength == _counts.length - 1); |
109 } | 109 } |
110 } | 110 } |
111 } | 111 } |
OLD | NEW |