MCPcopy Create free account
hub / github.com/NativeScript/android / Assign

Function Assign

test-app/runtime/src/main/cpp/include/cppgc/persistent.h:236–252  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

234 }
235
236 void Assign(T* ptr) {
237 if (IsValid()) {
238 if (ptr && ptr != kSentinelPointer) {
239 // Simply assign the pointer reusing the existing node.
240 SetValue(ptr);
241 this->CheckPointer(ptr);
242 return;
243 }
244 WeaknessPolicy::GetPersistentRegion(GetValue()).FreeNode(GetNode());
245 SetNode(nullptr);
246 }
247 SetValue(ptr);
248 if (!IsValid()) return;
249 SetNode(WeaknessPolicy::GetPersistentRegion(GetValue())
250 .AllocateNode(this, &BasicPersistent::Trace));
251 this->CheckPointer(Get());
252 }
253
254 void ClearFromGC() const {
255 if (IsValid()) {

Callers 1

persistent.hFile · 0.85

Calls 2

IsValidFunction · 0.85
CheckPointerMethod · 0.80

Tested by

no test coverage detected