Skip to content

Commit ef661ef

Browse files
authored
Audit API from OpenSwiftUI usage (#163)
1 parent 62d1332 commit ef661ef

File tree

12 files changed

+46
-24
lines changed

12 files changed

+46
-24
lines changed

Package.resolved

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Sources/OpenGraph/Attribute/Attribute/External.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public struct External<Value> {
1515
extension External: _AttributeBody {
1616
public static var comparisonMode: ComparisonMode { .equatableAlways }
1717

18-
public static var flags: _AttributeType.Flags { [] }
18+
public static var flags: Flags { [] }
1919

2020
public static func _update(_: UnsafeMutableRawPointer, attribute _: AnyAttribute) {}
2121
}

Sources/OpenGraph/Attribute/Body/AttributeBody.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ public protocol _AttributeBody {
1212
static var _hasDestroySelf: Bool { get }
1313
static func _updateDefault(_ pointer: UnsafeMutableRawPointer)
1414
static var comparisonMode: ComparisonMode { get }
15-
static var flags: _AttributeType.Flags { get }
15+
typealias Flags = _AttributeType.Flags
16+
static var flags: Flags { get }
1617
}
1718

1819
// MARK: - Protocol Default implementation
@@ -22,7 +23,7 @@ extension _AttributeBody {
2223
public static var _hasDestroySelf: Bool { false }
2324
public static func _updateDefault(_ pointer: UnsafeMutableRawPointer) {}
2425
public static var comparisonMode: ComparisonMode { .equatableUnlessPOD }
25-
public static var flags: _AttributeType.Flags { .mainThread }
26+
public static var flags: Flags { .mainThread }
2627
}
2728

2829
extension _AttributeBody {

Sources/OpenGraph/Attribute/Rule/Focus.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public struct Focus<Root, Value>: Rule, CustomStringConvertible {
1717

1818
public var value: Value { root.value[keyPath: keyPath] }
1919

20-
public static var flags: _AttributeType.Flags { [] }
20+
public static var flags: Flags { [] }
2121

2222
public var description: String { "\(Metadata(Value.self).description)" }
2323
}

Sources/OpenGraph/Attribute/Rule/Map.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public struct Map<Source, Value>: Rule, CustomStringConvertible {
1919

2020
public var value: Value { body(arg.value) }
2121

22-
public static var flags: _AttributeType.Flags { [] }
22+
public static var flags: Flags { [] }
2323

2424
public var description: String { "λ \(Value.self)" }
2525
}

Sources/OpenGraph/Graph/Graph.swift

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,21 @@ extension Graph {
6565
}
6666

6767
extension Graph {
68+
@_transparent
69+
public func startProfiling() {
70+
__OGGraphStartProfiling(self)
71+
}
72+
73+
@_transparent
74+
public func stopProfiling() {
75+
__OGGraphStopProfiling(self)
76+
}
77+
78+
@_transparent
79+
public func resetProfile() {
80+
__OGGraphResetProfile(self)
81+
}
82+
6883
public static func startProfiling() {
6984
__OGGraphStartProfiling(nil)
7085
}
@@ -80,7 +95,6 @@ extension Graph {
8095

8196
extension Graph {
8297
@_transparent
83-
@inline(__always)
8498
public var mainUpdates: Int { numericCast(counter(for: .mainThreadUpdates)) }
8599
}
86100

Sources/OpenGraph/Graph/Subgraph.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@
77

88
public import OpenGraphCxx
99

10+
extension Subgraph {
11+
public typealias Flags = AnyAttribute.Flags
12+
13+
// FIXME
14+
public typealias ChildFlags = AnyAttribute.Flags
15+
}
16+
1017
extension Subgraph {
1118
public func addObserver(_ observer: () -> Void) -> Int {
1219
Subgraph.addObserver(self, observer: observer)

Sources/OpenGraphCxx/Graph/OGGraphTracing.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44

55
#include <OpenGraph/OGGraphTracing.h>
66

7-
void OGGraphStartTracing(_Nullable OGGraphRef graph, OGGraphTraceFlags options) {
7+
void OGGraphStartTracing(_Nullable OGGraphRef graph, OGGraphTraceOptions options) {
88
OGGraphStartTracing2(graph, options, NULL);
99
}
1010

11-
void OGGraphStartTracing2(_Nullable OGGraphRef graph, OGGraphTraceFlags options, _Nullable CFArrayRef array) {
11+
void OGGraphStartTracing2(_Nullable OGGraphRef graph, OGGraphTraceOptions options, _Nullable CFArrayRef array) {
1212
// TODO
1313
}
1414

Sources/OpenGraphCxx/Graph/OGSubgraph.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ void OGSubgraphUpdate(OGSubgraphRef cf_subgraph, OGAttributeFlags flags) {
154154
// subgraph->update(flags);
155155
}
156156

157-
bool OGSubgraphIsDirty(OGSubgraphRef cf_subgraph, uint32_t unknown) {
157+
bool OGSubgraphIsDirty(OGSubgraphRef cf_subgraph, OGAttributeFlags flags) {
158158
OG::Subgraph *subgraph = cf_subgraph->subgraph;
159159
if (subgraph == nullptr) {
160160
return false;

Sources/OpenGraphCxx/include/OpenGraph/OGAttributeFlags.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@
1414
typedef OG_OPTIONS(uint8_t, OGAttributeFlags) {
1515
OGAttributeFlagsNone = 0,
1616
OGAttributeFlagsAll = 0xFF,
17-
} OG_SWIFT_NAME(OGSubgraphRef.Flags);
17+
} OG_SWIFT_NAME(OGAttribute.Flags);
1818

1919
#endif /* OGAttributeFlags_h */

0 commit comments

Comments
 (0)