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

Side by Side Diff: ios/chrome/browser/tabs/tab.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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 #import "ios/chrome/browser/tabs/tab.h" 5 #import "ios/chrome/browser/tabs/tab.h"
6 6
7 #import <CoreLocation/CoreLocation.h> 7 #import <CoreLocation/CoreLocation.h>
8 #import <UIKit/UIKit.h> 8 #import <UIKit/UIKit.h>
9 9
10 #include <utility> 10 #include <utility>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/bind.h" 13 #include "base/bind.h"
14 #include "base/ios/block_types.h" 14 #include "base/ios/block_types.h"
15 #import "base/ios/weak_nsobject.h" 15 #import "base/ios/weak_nsobject.h"
16 #include "base/json/string_escape.h" 16 #include "base/json/string_escape.h"
17 #include "base/logging.h" 17 #include "base/logging.h"
18 #include "base/mac/bind_objc_block.h" 18 #include "base/mac/bind_objc_block.h"
19 #include "base/mac/foundation_util.h" 19 #include "base/mac/foundation_util.h"
20 #include "base/mac/objc_property_releaser.h" 20 #include "base/mac/objc_release_properties.h"
21 #include "base/mac/scoped_nsobject.h" 21 #include "base/mac/scoped_nsobject.h"
22 #include "base/metrics/histogram.h" 22 #include "base/metrics/histogram.h"
23 #include "base/metrics/user_metrics.h" 23 #include "base/metrics/user_metrics.h"
24 #include "base/metrics/user_metrics_action.h" 24 #include "base/metrics/user_metrics_action.h"
25 #include "base/scoped_observer.h" 25 #include "base/scoped_observer.h"
26 #include "base/strings/string_split.h" 26 #include "base/strings/string_split.h"
27 #include "base/strings/sys_string_conversions.h" 27 #include "base/strings/sys_string_conversions.h"
28 #include "base/strings/utf_string_conversions.h" 28 #include "base/strings/utf_string_conversions.h"
29 #include "base/time/time.h" 29 #include "base/time/time.h"
30 #include "components/content_settings/core/browser/host_content_settings_map.h" 30 #include "components/content_settings/core/browser/host_content_settings_map.h"
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 226
227 // YES if this Tab is being prerendered. 227 // YES if this Tab is being prerendered.
228 BOOL isPrerenderTab_; 228 BOOL isPrerenderTab_;
229 229
230 // YES if this Tab was initiated from a voice search. 230 // YES if this Tab was initiated from a voice search.
231 BOOL isVoiceSearchResultsTab_; 231 BOOL isVoiceSearchResultsTab_;
232 232
233 // YES if the Tab needs to be reloaded after the app becomes active. 233 // YES if the Tab needs to be reloaded after the app becomes active.
234 BOOL requireReloadAfterBecomingActive_; 234 BOOL requireReloadAfterBecomingActive_;
235 235
236 base::mac::ObjCPropertyReleaser propertyReleaser_Tab_;
237
238 id<TabDelegate> delegate_; // weak 236 id<TabDelegate> delegate_; // weak
239 base::WeakNSProtocol<id<TabDialogDelegate>> dialogDelegate_; 237 base::WeakNSProtocol<id<TabDialogDelegate>> dialogDelegate_;
240 base::WeakNSProtocol<id<SnapshotOverlayProvider>> snapshotOverlayProvider_; 238 base::WeakNSProtocol<id<SnapshotOverlayProvider>> snapshotOverlayProvider_;
241 239
242 // Delegate used for snapshotting geometry. 240 // Delegate used for snapshotting geometry.
243 id<TabSnapshottingDelegate> tabSnapshottingDelegate_; // weak 241 id<TabSnapshottingDelegate> tabSnapshottingDelegate_; // weak
244 242
245 // The Full Screen Controller responsible for hiding/showing the toolbar. 243 // The Full Screen Controller responsible for hiding/showing the toolbar.
246 base::scoped_nsobject<FullScreenController> fullScreenController_; 244 base::scoped_nsobject<FullScreenController> fullScreenController_;
247 245
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 windowName, [opener currentSessionID], openedByDOM, openerIndex); 542 windowName, [opener currentSessionID], openedByDOM, openerIndex);
545 543
546 return [self initWithWebState:std::move(webState) model:parentModel]; 544 return [self initWithWebState:std::move(webState) model:parentModel];
547 } 545 }
548 546
549 - (instancetype)initWithWebState:(std::unique_ptr<web::WebState>)webState 547 - (instancetype)initWithWebState:(std::unique_ptr<web::WebState>)webState
550 model:(TabModel*)parentModel { 548 model:(TabModel*)parentModel {
551 DCHECK(webState); 549 DCHECK(webState);
552 self = [super init]; 550 self = [super init];
553 if (self) { 551 if (self) {
554 propertyReleaser_Tab_.Init(self, [Tab class]);
555 tabHistoryContext_.reset(new TabHistoryContext()); 552 tabHistoryContext_.reset(new TabHistoryContext());
556 parentTabModel_ = parentModel; 553 parentTabModel_ = parentModel;
557 browserState_ = 554 browserState_ =
558 ios::ChromeBrowserState::FromBrowserState(webState->GetBrowserState()); 555 ios::ChromeBrowserState::FromBrowserState(webState->GetBrowserState());
559 556
560 webStateImpl_.reset(static_cast<web::WebStateImpl*>(webState.release())); 557 webStateImpl_.reset(static_cast<web::WebStateImpl*>(webState.release()));
561 [self.webController setDelegate:self]; 558 [self.webController setDelegate:self];
562 [self.webController setUIDelegate:self]; 559 [self.webController setUIDelegate:self];
563 560
564 NSString* sessionID = [self currentSessionID]; 561 NSString* sessionID = [self currentSessionID];
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
725 [[tab webController] loadWithParams:params]; 722 [[tab webController] loadWithParams:params];
726 723
727 return tab; 724 return tab;
728 } 725 }
729 726
730 - (void)dealloc { 727 - (void)dealloc {
731 DCHECK([NSThread isMainThread]); 728 DCHECK([NSThread isMainThread]);
732 // Note that -[CRWWebController close] has already been called, so nothing 729 // Note that -[CRWWebController close] has already been called, so nothing
733 // significant should be done with it in this method. 730 // significant should be done with it in this method.
734 DCHECK_NE(self.webController.delegate, self); 731 DCHECK_NE(self.webController.delegate, self);
732 base::mac::ReleaseProperties(self);
735 [super dealloc]; 733 [super dealloc];
736 } 734 }
737 735
738 - (void)setParentTabModel:(TabModel*)model { 736 - (void)setParentTabModel:(TabModel*)model {
739 DCHECK(!model || !parentTabModel_); 737 DCHECK(!model || !parentTabModel_);
740 parentTabModel_ = model; 738 parentTabModel_ = model;
741 739
742 if (parentTabModel_.syncedWindowDelegate) { 740 if (parentTabModel_.syncedWindowDelegate) {
743 IOSChromeSessionTabHelper::FromWebState(self.webState) 741 IOSChromeSessionTabHelper::FromWebState(self.webState)
744 ->SetWindowID(model.sessionID); 742 ->SetWindowID(model.sessionID);
(...skipping 1706 matching lines...) Expand 10 before | Expand all | Expand 10 after
2451 2449
2452 - (TabModel*)parentTabModel { 2450 - (TabModel*)parentTabModel {
2453 return parentTabModel_; 2451 return parentTabModel_;
2454 } 2452 }
2455 2453
2456 - (FormInputAccessoryViewController*)inputAccessoryViewController { 2454 - (FormInputAccessoryViewController*)inputAccessoryViewController {
2457 return inputAccessoryViewController_.get(); 2455 return inputAccessoryViewController_.get();
2458 } 2456 }
2459 2457
2460 @end 2458 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698