MCPcopy Index your code
hub / github.com/google/gvisor / NewViewWithData

Function NewViewWithData

pkg/buffer/view.go:78–84  ·  view source on GitHub ↗

NewViewWithData creates a new view and initializes it with data. This function should be used with caution to avoid unnecessary []byte allocations. When in doubt use NewWithView to maximize chunk reuse in production environments.

(data []byte)

Source from the content-addressed store, hash-verified

76// When in doubt use NewWithView to maximize chunk reuse in production
77// environments.
78func NewViewWithData(data []byte) *View {
79 c := newChunk(len(data))
80 v := viewPool.Get().(*View)
81 *v = View{chunk: c}
82 v.Write(data)
83 return v
84}
85
86// Clone creates a shallow clone of v where the underlying chunk is shared.
87//

Callers 15

readMMappedPacketsMethod · 0.92
TestV4UnknownDestinationFunction · 0.92
TestV6UnknownDestinationFunction · 0.92
TestPathMTUDiscoveryFunction · 0.92
TestICMPInclusionSizeFunction · 0.92
handleICMPInIPv6Function · 0.92
TestReceiveIPv6FragmentsFunction · 0.92
TestNDPValidationFunction · 0.92
bufFunction · 0.92

Calls 3

newChunkFunction · 0.70
GetMethod · 0.65
WriteMethod · 0.65

Tested by 15

TestV4UnknownDestinationFunction · 0.74
TestV6UnknownDestinationFunction · 0.74
TestPathMTUDiscoveryFunction · 0.74
TestICMPInclusionSizeFunction · 0.74
handleICMPInIPv6Function · 0.74
TestReceiveIPv6FragmentsFunction · 0.74
TestNDPValidationFunction · 0.74
bufFunction · 0.74

Used in the wild real call sites across dependent graphs

searching dependent graphs…