Commit fc2e2e83 authored by gambard's avatar gambard Committed by Commit bot

[ObjC ARC] Converts ios/chrome/browser/ui/stack_view:perf_tests to ARC.

Automatically generated ARCMigrate commit
Notable issues:None
BUG=624363
TEST=None

Review-Url: https://codereview.chromium.org/2827253003
Cr-Commit-Position: refs/heads/master@{#468124}
parent cfaad89a
...@@ -152,6 +152,7 @@ source_set("eg_tests") { ...@@ -152,6 +152,7 @@ source_set("eg_tests") {
} }
source_set("perf_tests") { source_set("perf_tests") {
configs += [ "//build/config/compiler:enable_arc" ]
testonly = true testonly = true
sources = [ sources = [
"stack_view_controller_perftest.mm", "stack_view_controller_perftest.mm",
......
...@@ -20,6 +20,10 @@ ...@@ -20,6 +20,10 @@
#include "ios/web/public/referrer.h" #include "ios/web/public/referrer.h"
#import "net/base/mac/url_conversions.h" #import "net/base/mac/url_conversions.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
// These tests measure the performance of opening the stack view controller on // These tests measure the performance of opening the stack view controller on
// an iPhone. On an iPad, the tests do not run, as the iPad does not use the // an iPhone. On an iPad, the tests do not run, as the iPad does not use the
// stack view controller. // stack view controller.
...@@ -53,7 +57,7 @@ ...@@ -53,7 +57,7 @@
BOOL dismissAnimationEnded_; BOOL dismissAnimationEnded_;
BOOL preloadCardViewsEnded_; BOOL preloadCardViewsEnded_;
@public @public
BrowserViewController* bvc_; // weak __weak BrowserViewController* bvc_;
} }
- (void)reinitialize; - (void)reinitialize;
...@@ -166,8 +170,8 @@ class StackViewControllerPerfTest : public PerfTestWithBVC { ...@@ -166,8 +170,8 @@ class StackViewControllerPerfTest : public PerfTestWithBVC {
reuse_svc_ = false; reuse_svc_ = false;
// The testing delegate will receive stack view animation notifications. // The testing delegate will receive stack view animation notifications.
delegate_.reset([[StackViewControllerPerfTestDelegate alloc] delegate_ = [[StackViewControllerPerfTestDelegate alloc]
initWithBrowserViewController:bvc_]); initWithBrowserViewController:bvc_];
} }
void TearDown() override { void TearDown() override {
// Opening a StackViewController is done only on iPhones, not on iPads. // Opening a StackViewController is done only on iPhones, not on iPads.
...@@ -180,8 +184,8 @@ class StackViewControllerPerfTest : public PerfTestWithBVC { ...@@ -180,8 +184,8 @@ class StackViewControllerPerfTest : public PerfTestWithBVC {
protected: protected:
// Stack view controller & delegate. // Stack view controller & delegate.
base::scoped_nsobject<StackViewControllerPerfTestDelegate> delegate_; StackViewControllerPerfTestDelegate* delegate_;
base::scoped_nsobject<StackViewController> view_controller_; StackViewController* view_controller_;
int current_url_index_; int current_url_index_;
BOOL reuse_svc_; BOOL reuse_svc_;
...@@ -286,15 +290,15 @@ void StackViewControllerPerfTest::MainControllerShowTabSwitcher() { ...@@ -286,15 +290,15 @@ void StackViewControllerPerfTest::MainControllerShowTabSwitcher() {
// which will cache the first snapshot for the tab and reuse it instead of // which will cache the first snapshot for the tab and reuse it instead of
// regenerating a new one each time. // regenerating a new one each time.
[currentTab setSnapshotCoalescingEnabled:YES]; [currentTab setSnapshotCoalescingEnabled:YES];
base::ScopedClosureRunner runner(base::BindBlock(^{ base::ScopedClosureRunner runner(base::BindBlockArc(^{
[currentTab setSnapshotCoalescingEnabled:NO]; [currentTab setSnapshotCoalescingEnabled:NO];
})); }));
if (!view_controller_) { if (!view_controller_) {
view_controller_.reset([[StackViewController alloc] view_controller_ =
initWithMainTabModel:tab_model_ [[StackViewController alloc] initWithMainTabModel:tab_model_
otrTabModel:otr_tab_model_ otrTabModel:otr_tab_model_
activeTabModel:tab_model_]); activeTabModel:tab_model_];
} else { } else {
[view_controller_ restoreInternalStateWithMainTabModel:tab_model_ [view_controller_ restoreInternalStateWithMainTabModel:tab_model_
otrTabModel:otr_tab_model_ otrTabModel:otr_tab_model_
...@@ -305,7 +309,7 @@ void StackViewControllerPerfTest::MainControllerShowTabSwitcher() { ...@@ -305,7 +309,7 @@ void StackViewControllerPerfTest::MainControllerShowTabSwitcher() {
// The only addition to the function for testing. // The only addition to the function for testing.
[view_controller_ setTestDelegate:delegate_]; [view_controller_ setTestDelegate:delegate_];
[bvc_ presentViewController:view_controller_.get() [bvc_ presentViewController:view_controller_
animated:NO animated:NO
completion:^{ completion:^{
[view_controller_ showWithSelectedTabAnimation]; [view_controller_ showWithSelectedTabAnimation];
...@@ -330,7 +334,7 @@ base::TimeDelta StackViewControllerPerfTest::CloseStackView() { ...@@ -330,7 +334,7 @@ base::TimeDelta StackViewControllerPerfTest::CloseStackView() {
[view_controller_ dismissViewControllerAnimated:NO completion:nil]; [view_controller_ dismissViewControllerAnimated:NO completion:nil];
if (!reuse_svc_) if (!reuse_svc_)
view_controller_.reset(); view_controller_ = nil;
base::TimeDelta closeTime = base::Time::NowFromSystemTime() - startTime; base::TimeDelta closeTime = base::Time::NowFromSystemTime() - startTime;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment