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

Side by Side Diff: ios/web/alloc_with_zone_interceptor.mm

Issue 2577353003: [ios] Removed alloc_with_zone_interceptor as unused. (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « ios/web/alloc_with_zone_interceptor.h ('k') | ios/web/alloc_with_zone_interceptor_unittest.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #import "ios/web/alloc_with_zone_interceptor.h"
6
7 #import <objc/runtime.h>
8
9 #include "base/logging.h"
10
11 #if !defined(__has_feature) || !__has_feature(objc_arc)
12 #error "This file requires ARC support."
13 #endif
14
15 namespace web {
16
17 void AddAllocWithZoneMethod(Class target, id (^impl_block)(Class, NSZone*)) {
18 // Make sure |allocWithZone:| is not already implemented in the target class.
19 Class meta_class = object_getClass(target);
20 DCHECK_EQ(
21 class_getMethodImplementation(meta_class, @selector(allocWithZone:)),
22 class_getMethodImplementation(object_getClass([NSObject class]),
23 @selector(allocWithZone:)));
24
25 IMP new_impl = imp_implementationWithBlock(^(id self, NSZone* zone) {
26 return impl_block(self, zone);
27 });
28 class_addMethod(meta_class, @selector(allocWithZone:), new_impl, "v@:@");
29 }
30
31 } // namespace web
OLDNEW
« no previous file with comments | « ios/web/alloc_with_zone_interceptor.h ('k') | ios/web/alloc_with_zone_interceptor_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698