MCPcopy Create free account
hub / github.com/Snapchat/Valdi / createDeferredViewFactory

Method createDeferredViewFactory

valdi/src/valdi/runtime/Context/ViewNodeTree.cpp:234–251  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

232}
233
234Ref<ViewFactory> ViewNodeTree::createDeferredViewFactory() {
235 // For the deferred view factory, we create a ViewFactory that conforms to the default view class,
236 // but we pass it a no-op default attribute handler to skip attributes validation when they are set.
237 // This is done because attributes might be set on the view node before the view class or the viewFactory
238 // is provided.
239
240 SC_ASSERT_NOTNULL(_viewManager);
241 auto& viewManager = *_viewManager;
242 auto defaultViewClass = viewManager.getDefaultViewClass();
243 auto defaultViewFactory = getOrCreateViewFactory(defaultViewClass);
244
245 AttributeHandlerById attributes;
246 auto defaultHandler = makeShared<NoOpDefaultAttributeHandler>();
247
248 auto modifiedAttributes = defaultViewFactory->getBoundAttributes()->merge(
249 defaultViewClass, attributes, defaultHandler, nullptr, false, false);
250 return viewManager.createViewFactory(defaultViewClass, modifiedAttributes);
251}
252
253void ViewNodeTree::performUpdates() {
254 // This does the following:

Callers

nothing calls this directly

Calls 3

getDefaultViewClassMethod · 0.45
mergeMethod · 0.45
createViewFactoryMethod · 0.45

Tested by

no test coverage detected