MCPcopy Create free account
hub / github.com/google/gapid / Slice

Method Slice

gapis/memory/pool.go:88–105  ·  view source on GitHub ↗

Slice returns a Data referencing the subset of the Pool range.

(rng Range)

Source from the content-addressed store, hash-verified

86
87// Slice returns a Data referencing the subset of the Pool range.
88func (m *Pool) Slice(rng Range) Data {
89 i, c := interval.Intersect(&m.writes, rng.Span())
90 if c == 1 {
91 w := m.writes[i]
92 if rng == w.dst {
93 // Exact hit
94 return w.src
95 }
96 if rng.First() >= w.dst.First() && rng.Last() <= w.dst.Last() {
97 // Subset of a write.
98 rng.Base -= w.dst.First()
99 return w.src.Slice(rng)
100 }
101 }
102 writes := make(poolWriteList, c)
103 copy(writes, m.writes[i:i+c])
104 return poolSlice{rng: rng, writes: writes}
105}
106
107// TempSlice returns a slice that is only valid until the next
108// Read/Write operation on this pool.

Callers 6

AtMethod · 0.95
TestPoolBlobWriteReadFunction · 0.95
TestSliceNestingFunction · 0.95

Calls 5

IntersectMethod · 0.65
SliceMethod · 0.65
SpanMethod · 0.45
FirstMethod · 0.45
LastMethod · 0.45