Data types for marker API
Summary: @public Adds types for a marker API in Yoga. This will allow us to register callbacks that Yoga can use to log performance data without hard-coding the backend system for that. Reviewed By: SidharthGuglani Differential Revision: D13118830 fbshipit-source-id: b42a42c609f0cf66212186f7f20ee572522d59e3
This commit is contained in:
committed by
Facebook Github Bot
parent
02a2309b2a
commit
89394a2dd6
@@ -6,6 +6,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
#include "YGMarker.h"
|
||||||
#include "Yoga-internal.h"
|
#include "Yoga-internal.h"
|
||||||
#include "Yoga.h"
|
#include "Yoga.h"
|
||||||
|
|
||||||
@@ -14,11 +15,12 @@ struct YGConfig {
|
|||||||
bool useWebDefaults = false;
|
bool useWebDefaults = false;
|
||||||
bool useLegacyStretchBehaviour = false;
|
bool useLegacyStretchBehaviour = false;
|
||||||
bool shouldDiffLayoutWithoutLegacyStretchBehaviour = false;
|
bool shouldDiffLayoutWithoutLegacyStretchBehaviour = false;
|
||||||
|
bool printTree = false;
|
||||||
float pointScaleFactor = 1.0f;
|
float pointScaleFactor = 1.0f;
|
||||||
YGLogger logger;
|
YGLogger logger;
|
||||||
YGCloneNodeFunc cloneNodeCallback = nullptr;
|
YGCloneNodeFunc cloneNodeCallback = nullptr;
|
||||||
void* context = nullptr;
|
void* context = nullptr;
|
||||||
bool printTree = false;
|
YGMarkerCallbacks markerCallbacks = {nullptr, nullptr};
|
||||||
|
|
||||||
YGConfig(YGLogger logger);
|
YGConfig(YGLogger logger);
|
||||||
};
|
};
|
||||||
|
32
yoga/YGMarker.h
Normal file
32
yoga/YGMarker.h
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the MIT license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "YGMacros.h"
|
||||||
|
|
||||||
|
YG_EXTERN_C_BEGIN
|
||||||
|
|
||||||
|
typedef struct YGNode* YGNodeRef;
|
||||||
|
|
||||||
|
typedef YG_ENUM_BEGIN(YGMarkerType) {}
|
||||||
|
YG_ENUM_END(YGMarkerType);
|
||||||
|
|
||||||
|
typedef union {
|
||||||
|
int unused;
|
||||||
|
} YGMarkerData;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
// accepts marker type, a node ref, and marker data (depends on marker type)
|
||||||
|
// can return a handle or id that Yoga will pass to endMarker
|
||||||
|
void* (*startMarker)(YGMarkerType, YGNodeRef, YGMarkerData);
|
||||||
|
// accepts marker type, a node ref, marker data, and marker id as returned
|
||||||
|
// by startMarker
|
||||||
|
void (*endMarker)(YGMarkerType, YGNodeRef, YGMarkerData, void* id);
|
||||||
|
} YGMarkerCallbacks;
|
||||||
|
|
||||||
|
YG_EXTERN_C_END
|
Reference in New Issue
Block a user