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

Method bridgeViewFactory

valdi/src/valdi/snap_drawing/SnapDrawingViewManager.cpp:402–425  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

400 auto hostViewFactory = _hostViewManager->createViewFactory(className, nullptr);
401 if (hostViewFactory.get() != nullptr) {
402 return Valdi::makeShared<BridgeLayerFactory>(
403 _resources, hostViewFactory, *this, *_hostViewManager, boundAttributes);
404 }
405 // Host doesn't actually provide this class (e.g. "Layout" on macOS); use layer fallback
406 }
407 {
408 auto layerClass = getLayerClass(className);
409 if (layerClass == nullptr) {
410 VALDI_ERROR(_logger,
411 "Unable to resolve view factory for class {}, falling back to {}",
412 className,
413 getDefaultViewClass());
414 layerClass = getBaseLayerClass();
415 SC_ASSERT(layerClass != nullptr);
416 }
417
418 return Valdi::makeShared<SnapDrawingViewFactory>(className, *this, boundAttributes, layerClass);
419 }
420}
421
422Valdi::Ref<Valdi::ViewFactory> SnapDrawingViewManager::bridgeViewFactory(
423 const Valdi::Ref<Valdi::ViewFactory>& viewFactory, const Valdi::Ref<Valdi::BoundAttributes>& startingAttributes) {
424 Valdi::AttributeHandlerById handlers;
425
426 for (const auto& boundAttribute : viewFactory->getBoundAttributes()->getHandlers()) {
427 if (boundAttribute.second.isCompositePart()) {
428 handlers[boundAttribute.first] = boundAttribute.second;

Callers

nothing calls this directly

Calls 6

withDelegateMethod · 0.80
getViewManagerMethod · 0.80
isCompositePartMethod · 0.45
mergeMethod · 0.45
getViewClassNameMethod · 0.45

Tested by

no test coverage detected