-
Notifications
You must be signed in to change notification settings - Fork 1.6k
/
Copy pathFPRObjectInstrumentor.h
81 lines (63 loc) · 2.67 KB
/
FPRObjectInstrumentor.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#import "FirebasePerformance/Sources/Instrumentation/FPRInstrument.h"
#import "FirebasePerformance/Sources/ISASwizzler/FPRSwizzledObject.h"
@class FPRSelectorInstrumentor;
NS_ASSUME_NONNULL_BEGIN
/** Defines the interface that an instrumentor should implement if they are going to instrument
* objects.
*/
@protocol FPRObjectInstrumentorProtocol <NSObject>
@required
/** Registers an instance of the delegate class to be instrumented.
*
* @param object The instance to instrument.
*/
- (void)registerObject:(id)object;
/** Registers an instance of the delegate class to be instrumented.
*
* @param proxy The instance to instrument.
*/
- (void)registerProxy:(id)proxy;
@end
/** This class allows the instrumentation of specific objects by isa swizzling specific instances
* with a dynamically generated subclass of the object's original class and installing methods
* onto this new class.
*/
NS_EXTENSION_UNAVAILABLE("Firebase Performance is not supported for extensions.")
@interface FPRObjectInstrumentor : FPRInstrument
/** The instrumented object. */
@property(nonatomic, weak) id instrumentedObject;
/** YES if there is reason to swizzle, NO if swizzling is not needed. */
@property(nonatomic) BOOL hasModifications;
/** Please use the designated initializer. */
- (instancetype)init NS_UNAVAILABLE;
/** Instantiates an instance of this class. The designated initializer.
*
* @param object The object to be instrumented.
* @return An instance of this class.
*/
- (instancetype)initWithObject:(id)object NS_DESIGNATED_INITIALIZER;
/** Attempts to copy a selector from a donor class onto the dynamically generated subclass that the
* object will adopt when -swizzle is called.
*
* @param selector The selector to use.
* @param aClass The class to copy the selector from.
* @param isClassSelector YES if the selector is a class selector, NO otherwise.
*/
- (void)copySelector:(SEL)selector fromClass:(Class)aClass isClassSelector:(BOOL)isClassSelector;
/** Swizzles the isa of the object and sets its class to the dynamically created subclass. */
- (void)swizzle;
@end
NS_ASSUME_NONNULL_END