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

Function LoadSlice

gapis/memory/load.go:27–40  ·  view source on GitHub ↗

LoadSlice loads the slice elements from s into a go-slice of the slice type.

(ctx context.Context, s Slice, pools Pools, l *device.MemoryLayout)

Source from the content-addressed store, hash-verified

25
26// LoadSlice loads the slice elements from s into a go-slice of the slice type.
27func LoadSlice(ctx context.Context, s Slice, pools Pools, l *device.MemoryLayout) (interface{}, error) {
28 pool := pools.MustGet(s.Pool())
29 rng := Range{s.Base(), s.Size()}
30 ioR := pool.Slice(rng).NewReader(ctx)
31 binR := endian.Reader(ioR, l.GetEndian())
32 d := NewDecoder(binR, l)
33 count := int(s.Count())
34 sli := slice.New(reflect.SliceOf(s.ElementType()), count, count)
35 Read(d, sli.Addr().Interface())
36 if err := binR.Error(); err != nil {
37 return nil, err
38 }
39 return sli.Interface(), nil
40}
41
42// LoadPointer loads the element from p.
43func LoadPointer(ctx context.Context, p Pointer, pools Pools, l *device.MemoryLayout) (interface{}, error) {

Callers

nothing calls this directly

Calls 15

NewDecoderFunction · 0.85
MustGetMethod · 0.80
InterfaceMethod · 0.80
AddrMethod · 0.80
ReadFunction · 0.70
PoolMethod · 0.65
BaseMethod · 0.65
SizeMethod · 0.65
NewReaderMethod · 0.65
SliceMethod · 0.65
ReaderMethod · 0.65
CountMethod · 0.65

Tested by

no test coverage detected