// Add h_X to the class table.
table.Insert(h_X.Get());
EXPECT_OBJ_PTR_EQ(table.LookupByDescriptor(h_X.Get()), h_X.Get());
EXPECT_OBJ_PTR_EQ(table.Lookup(descriptor_x, ComputeModifiedUtf8Hash(descriptor_x)), h_X.Get());
EXPECT_TRUE(table.Lookup("NOT_THERE", ComputeModifiedUtf8Hash("NOT_THERE")) == nullptr);
EXPECT_EQ(table.NumZygoteClasses(class_loader.Get()), 0u);
EXPECT_EQ(table.NumNonZygoteClasses(class_loader.Get()), 1u);
// Create the zygote snapshot and ensure the accounting is correct.
table.FreezeSnapshot();
EXPECT_EQ(table.NumZygoteClasses(class_loader.Get()), 1u);
EXPECT_EQ(table.NumNonZygoteClasses(class_loader.Get()), 0u);
// Test inserting and related lookup functions.
EXPECT_TRUE(table.LookupByDescriptor(h_Y.Get()) == nullptr);
table.Insert(h_Y.Get());
EXPECT_OBJ_PTR_EQ(table.LookupByDescriptor(h_X.Get()), h_X.Get());
EXPECT_OBJ_PTR_EQ(table.LookupByDescriptor(h_Y.Get()), h_Y.Get());
// Collect all the roots and make sure there is nothing missing.
CollectRootVisitor roots;
table.VisitRoots(roots);
EXPECT_TRUE(roots.roots_.find(h_X.Get()) != roots.roots_.end());
EXPECT_TRUE(roots.roots_.find(h_Y.Get()) != roots.roots_.end());
EXPECT_TRUE(roots.roots_.find(obj_X.Get()) != roots.roots_.end());
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.