Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PLAT-10049] Added view_load_phase spans #143

Merged
merged 7 commits into from May 30, 2023

Conversation

robert-smartbear
Copy link
Contributor

No description provided.

@github-actions
Copy link

github-actions bot commented May 19, 2023

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +3.3% +2.52Ki  +3.3% +2.52Ki    __TEXT,__text
  +1.5% +1.89Ki  +1.5% +1.89Ki    String Table
  +1.7% +1.12Ki  +1.7% +1.12Ki    Symbol Table
  +5.2%    +320  +5.2%    +320    __DATA,__cfstring
  +3.4%    +248  +3.4%    +248    __TEXT,__gcc_except_tab
  +3.4%    +163  +3.4%    +163    __TEXT,__cstring
  +3.5%    +112  +3.5%    +112    __TEXT,__unwind_info
  +0.9%     +73  +0.9%     +73    __TEXT,__objc_methname
  +1.6%     +32  +1.6%     +32    __DATA,__objc_selrefs
  +2.2%     +16  +2.2%     +16    Function Start Addresses
  +0.4%      +8  +0.4%      +8    __TEXT,__const
  -3.8%    -352  -3.8%    -352    [__DATA]
  [ = ]       0 -40.5% -3.03Ki    [__LINKEDIT]
  -7.4% -3.11Ki  -7.4% -3.11Ki    [__TEXT]
  +0.8% +3.03Ki  [ = ]       0    TOTAL

Generated by 🚫 Danger


controller = [MyTestViewController new];
[controller loadView];
[controller viewDidLoad];
XCTAssertEqual(1U, perf->testing_getBatchCount());
XCTAssertEqual(6U, perf->testing_getBatchCount());
// Temporarily disabled to stop crashes while we build a more complete solution
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh could you uncomment these 2 disabled lines again? I forgot to do it after the refactor.


selector = @selector(viewWillLayoutSubviews);
IMP viewWillLayoutSubviews __block = nullptr;
viewWillLayoutSubviews = ObjCSwizzle::replaceInstanceMethodOverride(cls, selector, ^(id self, BOOL animated){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

viewWillLayoutSubviews is type void, so it won't have BOOL animated.

Trace(@"%@ -[%s %s]", self, class_getName(cls), sel_getName(selector));
}
BugsnagPerformanceSpan *span = startViewLoadPhaseSpan(self, @"viewWillLayoutSubviews");
reinterpret_cast<void (*)(id, SEL, BOOL)>(viewWillLayoutSubviews)(self, selector, animated);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be reinterpret_cast<void (*)(id, SEL)>


selector = @selector(viewDidLayoutSubviews);
IMP viewDidLayoutSubviews __block = nullptr;
viewDidLayoutSubviews = ObjCSwizzle::replaceInstanceMethodOverride(cls, selector, ^(id self, BOOL animated){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar here:viewDidLayoutSubviews is a void method.


selector = @selector(viewWillAppear:);
IMP viewWillAppear __block = nullptr;
viewWillAppear = ObjCSwizzle::replaceInstanceMethodOverride(cls, selector, ^(id self){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

viewWillAppear takes a BOOL parameter, so this must be ^(id self, BOOL animated)

Trace(@"%@ -[%s %s]", self, class_getName(cls), sel_getName(selector));
}
BugsnagPerformanceSpan *span = startViewLoadPhaseSpan(self, @"viewWillAppear");
reinterpret_cast<void (*)(id, SEL)>(viewWillAppear)(self, selector);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This must be reinterpret_cast<void (*)(id, SEL, BOOL)>

@robert-smartbear robert-smartbear merged commit ed3c227 into next May 30, 2023
16 checks passed
@robert-smartbear robert-smartbear deleted the robert/plat-10049_view_load_phases branch May 30, 2023 11:45
@robert-smartbear robert-smartbear mentioned this pull request May 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants