Title: [171240] trunk/Source/WebKit2
Revision
171240
Author
[email protected]
Date
2014-07-18 13:50:11 -0700 (Fri, 18 Jul 2014)

Log Message

[Cocoa] Use RetainPtr in _WKRemoteObjectInterface
https://bugs.webkit.org/show_bug.cgi?id=135062

Patch by Joseph Pecoraro <[email protected]> on 2014-07-18
Reviewed by Anders Carlsson.

Switch to RetainPtr instead of manual memory management of ivars.

* Shared/API/Cocoa/_WKRemoteObjectInterface.h:
* Shared/API/Cocoa/_WKRemoteObjectInterface.mm:
(-[_WKRemoteObjectInterface initWithProtocol:identifier:]):
(-[_WKRemoteObjectInterface identifier]):
(-[_WKRemoteObjectInterface description]):
(-[_WKRemoteObjectInterface dealloc]): Deleted.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (171239 => 171240)


--- trunk/Source/WebKit2/ChangeLog	2014-07-18 20:34:36 UTC (rev 171239)
+++ trunk/Source/WebKit2/ChangeLog	2014-07-18 20:50:11 UTC (rev 171240)
@@ -1,3 +1,19 @@
+2014-07-18  Joseph Pecoraro  <[email protected]>
+
+        [Cocoa] Use RetainPtr in _WKRemoteObjectInterface
+        https://bugs.webkit.org/show_bug.cgi?id=135062
+
+        Reviewed by Anders Carlsson.
+
+        Switch to RetainPtr instead of manual memory management of ivars.
+
+        * Shared/API/Cocoa/_WKRemoteObjectInterface.h:
+        * Shared/API/Cocoa/_WKRemoteObjectInterface.mm:
+        (-[_WKRemoteObjectInterface initWithProtocol:identifier:]):
+        (-[_WKRemoteObjectInterface identifier]):
+        (-[_WKRemoteObjectInterface description]):
+        (-[_WKRemoteObjectInterface dealloc]): Deleted.
+
 2014-07-18  Tim Horton  <[email protected]>
 
         Take navigation snapshots whenever the current back-forward item is going to change

Modified: trunk/Source/WebKit2/Shared/API/Cocoa/_WKRemoteObjectInterface.h (171239 => 171240)


--- trunk/Source/WebKit2/Shared/API/Cocoa/_WKRemoteObjectInterface.h	2014-07-18 20:34:36 UTC (rev 171239)
+++ trunk/Source/WebKit2/Shared/API/Cocoa/_WKRemoteObjectInterface.h	2014-07-18 20:50:11 UTC (rev 171240)
@@ -36,8 +36,8 @@
 
 - (id)initWithProtocol:(Protocol *)protocol identifier:(NSString *)identifier;
 
-@property (readonly) Protocol *protocol;
-@property (readonly) NSString *identifier;
+@property (readonly, nonatomic) Protocol *protocol;
+@property (readonly, nonatomic) NSString *identifier;
 
 - (NSSet *)classesForSelector:(SEL)selector argumentIndex:(NSUInteger)argumentIndex;
 - (void)setClasses:(NSSet *)classes forSelector:(SEL)selector argumentIndex:(NSUInteger)argumentIndex;

Modified: trunk/Source/WebKit2/Shared/API/Cocoa/_WKRemoteObjectInterface.mm (171239 => 171240)


--- trunk/Source/WebKit2/Shared/API/Cocoa/_WKRemoteObjectInterface.mm	2014-07-18 20:34:36 UTC (rev 171239)
+++ trunk/Source/WebKit2/Shared/API/Cocoa/_WKRemoteObjectInterface.mm	2014-07-18 20:50:11 UTC (rev 171240)
@@ -42,6 +42,7 @@
 
 @implementation _WKRemoteObjectInterface {
     HashMap<SEL, Vector<RetainPtr<NSSet>>> _allowedArgumentClasses;
+    RetainPtr<NSString> _identifier;
 }
 
 static bool isContainerClass(Class objectClass)
@@ -129,7 +130,7 @@
         return nil;
 
     _protocol = protocol;
-    _identifier = [identifier copy];
+    _identifier = adoptNS([identifier copy]);
 
     initializeAllowedArgumentClasses(self);
 
@@ -141,15 +142,14 @@
     return [[[self alloc] initWithProtocol:protocol identifier:NSStringFromProtocol(protocol)] autorelease];
 }
 
-- (void)dealloc
+- (NSString *)identifier
 {
-    [_identifier release];
-    [super dealloc];
+    return _identifier.get();
 }
 
 - (NSString *)description
 {
-    return [NSString stringWithFormat:@"<%@: %p; protocol = \"%@\"; identifier = \"%@\">", NSStringFromClass(self.class), self, _identifier, NSStringFromProtocol(_protocol)];
+    return [NSString stringWithFormat:@"<%@: %p; protocol = \"%@\"; identifier = \"%@\">", NSStringFromClass(self.class), self, _identifier.get(), NSStringFromProtocol(_protocol)];
 }
 
 static RetainPtr<NSSet>& classesForSelectorArgument(_WKRemoteObjectInterface *interface, SEL selector, NSUInteger argumentIndex)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to