Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: ios/chrome/browser/ui/tab_switcher/tab_switcher_transition_context.mm

Issue 2610923005: Replace ObjCPropertyReleaser with ReleaseProperties() project-wide. (Closed)
Patch Set: weak -> assign Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ios/chrome/browser/ui/tab_switcher/tab_switcher_transition_context.h" 5 #include "ios/chrome/browser/ui/tab_switcher/tab_switcher_transition_context.h"
6 6
7 #include "base/mac/objc_property_releaser.h" 7 #include "base/mac/objc_release_properties.h"
8 #import "ios/chrome/browser/tabs/tab.h" 8 #import "ios/chrome/browser/tabs/tab.h"
9 #import "ios/chrome/browser/ui/browser_view_controller.h" 9 #import "ios/chrome/browser/ui/browser_view_controller.h"
10 #include "ios/chrome/browser/ui/tab_switcher/tab_switcher_transition_context.h" 10 #include "ios/chrome/browser/ui/tab_switcher/tab_switcher_transition_context.h"
11 #import "ios/chrome/browser/ui/tabs/tab_strip_controller+tab_switcher_animation. h" 11 #import "ios/chrome/browser/ui/tabs/tab_strip_controller+tab_switcher_animation. h"
12 #import "ios/chrome/browser/ui/tabs/tab_strip_controller.h" 12 #import "ios/chrome/browser/ui/tabs/tab_strip_controller.h"
13 #import "ios/chrome/browser/ui/uikit_ui_util.h" 13 #import "ios/chrome/browser/ui/uikit_ui_util.h"
14 14
15 @class BrowserViewController; 15 @class BrowserViewController;
16 16
17 @interface TabSwitcherTransitionContextContent () { 17 @interface TabSwitcherTransitionContextContent () {
18 base::scoped_nsobject<TabSwitcherTabStripPlaceholderView> 18 base::scoped_nsobject<TabSwitcherTabStripPlaceholderView>
19 _tabStripPlaceholderView; 19 _tabStripPlaceholderView;
20 base::WeakNSObject<BrowserViewController> _bvc; 20 base::WeakNSObject<BrowserViewController> _bvc;
21 } 21 }
22 22
23 @end 23 @end
24 24
25 @implementation TabSwitcherTransitionContextContent { 25 @implementation TabSwitcherTransitionContextContent
26 base::mac::ObjCPropertyReleaser
27 _propertyReleaser_tabSwitcherTransitionContextContent;
28 }
29 26
30 + (instancetype)tabSwitcherTransitionContextContentFromBVC: 27 + (instancetype)tabSwitcherTransitionContextContentFromBVC:
31 (BrowserViewController*)bvc { 28 (BrowserViewController*)bvc {
32 TabSwitcherTransitionContextContent* transitionContextContent = 29 TabSwitcherTransitionContextContent* transitionContextContent =
33 [[[TabSwitcherTransitionContextContent alloc] init] autorelease]; 30 [[[TabSwitcherTransitionContextContent alloc] init] autorelease];
34 31
35 Tab* currentTab = [[bvc tabModel] currentTab]; 32 Tab* currentTab = [[bvc tabModel] currentTab];
36 transitionContextContent.initialSelectedTabIndex = 33 transitionContextContent.initialSelectedTabIndex =
37 [[bvc tabModel] indexOfTab:currentTab]; 34 [[bvc tabModel] indexOfTab:currentTab];
38 35
(...skipping 18 matching lines...) Expand all
57 } 54 }
58 55
59 - (TabSwitcherTabStripPlaceholderView*)generateTabStripPlaceholderView { 56 - (TabSwitcherTabStripPlaceholderView*)generateTabStripPlaceholderView {
60 TabStripController* tsc = [_bvc tabStripController]; 57 TabStripController* tsc = [_bvc tabStripController];
61 return [tsc placeholderView]; 58 return [tsc placeholderView];
62 } 59 }
63 60
64 @synthesize toolbarSnapshotView = _toolbarSnapshotView; 61 @synthesize toolbarSnapshotView = _toolbarSnapshotView;
65 @synthesize initialSelectedTabIndex = _initialSelectedTabIndex; 62 @synthesize initialSelectedTabIndex = _initialSelectedTabIndex;
66 63
67 - (instancetype)init { 64 - (void)dealloc {
68 self = [super init]; 65 base::mac::ReleaseProperties(self);
69 if (self) { 66 [super dealloc];
70 _propertyReleaser_tabSwitcherTransitionContextContent.Init(
71 self, [TabSwitcherTransitionContextContent class]);
72 }
73 return self;
74 } 67 }
75 68
76 @end 69 @end
77 70
78 @implementation TabSwitcherTransitionContext { 71 @implementation TabSwitcherTransitionContext
79 base::mac::ObjCPropertyReleaser
80 _propertyReleaser_tabSwitcherTransitionContext;
81 }
82 72
83 + (instancetype) 73 + (instancetype)
84 tabSwitcherTransitionContextWithCurrent:(BrowserViewController*)currentBVC 74 tabSwitcherTransitionContextWithCurrent:(BrowserViewController*)currentBVC
85 mainBVC:(BrowserViewController*)mainBVC 75 mainBVC:(BrowserViewController*)mainBVC
86 otrBVC:(BrowserViewController*)otrBVC { 76 otrBVC:(BrowserViewController*)otrBVC {
87 TabSwitcherTransitionContext* transitionContext = 77 TabSwitcherTransitionContext* transitionContext =
88 [[[TabSwitcherTransitionContext alloc] init] autorelease]; 78 [[[TabSwitcherTransitionContext alloc] init] autorelease];
89 Tab* currentTab = [[currentBVC tabModel] currentTab]; 79 Tab* currentTab = [[currentBVC tabModel] currentTab];
90 UIImage* tabSnapshotImage = 80 UIImage* tabSnapshotImage =
91 [currentTab generateSnapshotWithOverlay:YES visibleFrameOnly:YES]; 81 [currentTab generateSnapshotWithOverlay:YES visibleFrameOnly:YES];
92 [transitionContext setTabSnapshotImage:tabSnapshotImage]; 82 [transitionContext setTabSnapshotImage:tabSnapshotImage];
93 [transitionContext 83 [transitionContext
94 setIncognitoContent: 84 setIncognitoContent:
95 [TabSwitcherTransitionContextContent 85 [TabSwitcherTransitionContextContent
96 tabSwitcherTransitionContextContentFromBVC:otrBVC]]; 86 tabSwitcherTransitionContextContentFromBVC:otrBVC]];
97 [transitionContext 87 [transitionContext
98 setRegularContent: 88 setRegularContent:
99 [TabSwitcherTransitionContextContent 89 [TabSwitcherTransitionContextContent
100 tabSwitcherTransitionContextContentFromBVC:mainBVC]]; 90 tabSwitcherTransitionContextContentFromBVC:mainBVC]];
101 [transitionContext setInitialTabModel:currentBVC.tabModel]; 91 [transitionContext setInitialTabModel:currentBVC.tabModel];
102 return transitionContext; 92 return transitionContext;
103 } 93 }
104 94
105 @synthesize tabSnapshotImage = _tabSnapshotImage; 95 @synthesize tabSnapshotImage = _tabSnapshotImage;
106 @synthesize incognitoContent = _incognitoContent; 96 @synthesize incognitoContent = _incognitoContent;
107 @synthesize regularContent = _regularContent; 97 @synthesize regularContent = _regularContent;
108 @synthesize initialTabModel = _initialTabModel; 98 @synthesize initialTabModel = _initialTabModel;
109 99
110 - (instancetype)init { 100 - (void)dealloc {
111 self = [super init]; 101 base::mac::ReleaseProperties(self);
112 if (self) { 102 [super dealloc];
113 _propertyReleaser_tabSwitcherTransitionContext.Init(
114 self, [TabSwitcherTransitionContext class]);
115 }
116 return self;
117 } 103 }
118 104
119 @end 105 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698