 Chromium Code Reviews
 Chromium Code Reviews Issue 2808873002:
  [ObjC ARC] Converts ios/chrome/browser/ui/toolbar:toolbar to ARC.  (Closed)
    
  
    Issue 2808873002:
  [ObjC ARC] Converts ios/chrome/browser/ui/toolbar:toolbar to ARC.  (Closed) 
  | Index: ios/chrome/browser/ui/toolbar/toolbar_tools_menu_button.mm | 
| diff --git a/ios/chrome/browser/ui/toolbar/toolbar_tools_menu_button.mm b/ios/chrome/browser/ui/toolbar/toolbar_tools_menu_button.mm | 
| index dff031ab80643357197193bb048d398b746cf5e2..84e0c6756f1da270abc550f0fb01c34ac9fc87a3 100644 | 
| --- a/ios/chrome/browser/ui/toolbar/toolbar_tools_menu_button.mm | 
| +++ b/ios/chrome/browser/ui/toolbar/toolbar_tools_menu_button.mm | 
| @@ -9,6 +9,10 @@ | 
| #include "ios/chrome/browser/ui/toolbar/toolbar_button_tints.h" | 
| +#if !defined(__has_feature) || !__has_feature(objc_arc) | 
| +#error "This file requires ARC support." | 
| +#endif | 
| + | 
| namespace { | 
| // The number of dots drawn. | 
| const int kNumberOfDots = 3; | 
| @@ -48,7 +52,7 @@ const CGFloat kLineWidthAtApogee = 3; | 
| // Whether the reading list contains unseen items. | 
| BOOL readingListContainsUnseenItems_; | 
| // The CALayers containing the drawn dots. | 
| - base::scoped_nsobject<CAShapeLayer> pathLayers_[kNumberOfDots]; | 
| + CAShapeLayer* pathLayers_[kNumberOfDots]; | 
| 
stkhapugin
2017/04/10 15:57:51
You should use NSArray of CAShapeLayer and cast to
 
sdefresne
2017/04/10 16:09:45
If using CFArray, please use base::ScopedCFTypeRef
 | 
| // Whether the CALayers are being animated. | 
| BOOL animationOnGoing_; | 
| } | 
| @@ -113,7 +117,7 @@ const CGFloat kLineWidthAtApogee = 3; | 
| - (void)initializeShapeLayers { | 
| for (int i = 0; i < kNumberOfDots; i++) { | 
| - base::scoped_nsobject<CAShapeLayer>& pathLayer = pathLayers_[i]; | 
| + CAShapeLayer* pathLayer = pathLayers_[i]; | 
| if (pathLayer) { | 
| [pathLayer removeFromSuperlayer]; | 
| } | 
| @@ -125,7 +129,7 @@ const CGFloat kLineWidthAtApogee = 3; | 
| [path moveToPoint:CGPointMake(x - kMaxWidthOfSegment * 0.5, y)]; | 
| [path addLineToPoint:CGPointMake(x + kMaxWidthOfSegment * 0.5, y)]; | 
| - pathLayer.reset([[CAShapeLayer layer] retain]); | 
| + pathLayer = [CAShapeLayer layer]; | 
| [pathLayer setFrame:self.bounds]; | 
| [pathLayer setPath:path.CGPath]; | 
| [pathLayer setStrokeColor:[self.tintColor CGColor]]; | 
| @@ -134,7 +138,8 @@ const CGFloat kLineWidthAtApogee = 3; | 
| [pathLayer setLineCap:kCALineCapRound]; | 
| [pathLayer setStrokeStart:kStrokeStartAtRest]; | 
| [pathLayer setStrokeEnd:kStrokeEndAtRest]; | 
| - [self.layer addSublayer:pathLayer.get()]; | 
| + [self.layer addSublayer:pathLayer]; | 
| + pathLayers_[i] = pathLayer; | 
| } | 
| } | 
| @@ -206,8 +211,8 @@ const CGFloat kLineWidthAtApogee = 3; | 
| // Add four animations for each stroke. | 
| for (int i = 0; i < kNumberOfDots; i++) { | 
| - base::scoped_nsobject<CAShapeLayer>& pathLayer = pathLayers_[i]; | 
| - DCHECK(pathLayer.get()); | 
| + CAShapeLayer* pathLayer = pathLayers_[i]; | 
| + DCHECK(pathLayer); | 
| 
stkhapugin
2017/04/10 15:57:51
This is an odd DCHECK, but you shouldn't need it w
 | 
| const int frameStart = | 
| (kNumberOfDots - i) * kFramesBetweenAnimationOfEachDot; |