Title: [173141] trunk/Source
Revision
173141
Author
[email protected]
Date
2014-08-30 15:43:33 -0700 (Sat, 30 Aug 2014)

Log Message

Use RetainPtr::autorelease in some places where it seems appropriate
https://bugs.webkit.org/show_bug.cgi?id=136280

Reviewed by Darin Adler.

Source/_javascript_Core:

* API/JSContext.mm:
(-[JSContext name]): Use RetainPtr::autorelease() in place of ObjC autorelease.
* API/JSValue.mm:
(valueToString): Make appropriate use of RetainPtr

Source/WebCore:

* platform/mac/URLMac.mm:
(WebCore::URL::operator NSURL *): Use autorelease() instead of
CFBridgingRelease(leakRef())

Source/WebKit/mac:

* WebView/WebHTMLView.mm:
(imageFromRect): Use RetainPtr in this function.
* WebView/WebPDFRepresentation.mm:
(-[WebPDFRepresentation convertPostScriptDataSourceToPDF:]): Use RetainPtr
in this method.

Source/WebKit2:

* Shared/Cocoa/WKNSURLExtras.mm:
(urlWithWTFString): Use autorelease() instead of CFBridgingRelease(leakRef())

Source/WTF:

* wtf/text/mac/StringImplMac.mm:
(WTF::StringImpl::operator NSString *): Use autorelease() instead of
CFBridgingRelease(leakRef())

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/API/JSContext.mm (173140 => 173141)


--- trunk/Source/_javascript_Core/API/JSContext.mm	2014-08-30 18:22:11 UTC (rev 173140)
+++ trunk/Source/_javascript_Core/API/JSContext.mm	2014-08-30 22:43:33 UTC (rev 173141)
@@ -192,7 +192,7 @@
     if (!name)
         return nil;
 
-    return [(NSString *)JSStringCopyCFString(kCFAllocatorDefault, name) autorelease];
+    return (NSString *)adoptCF(JSStringCopyCFString(kCFAllocatorDefault, name)).autorelease();
 }
 
 - (void)setName:(NSString *)name

Modified: trunk/Source/_javascript_Core/API/JSValue.mm (173140 => 173141)


--- trunk/Source/_javascript_Core/API/JSValue.mm	2014-08-30 18:22:11 UTC (rev 173140)
+++ trunk/Source/_javascript_Core/API/JSValue.mm	2014-08-30 22:43:33 UTC (rev 173141)
@@ -767,9 +767,9 @@
         return nil;
     }
 
-    NSString *stringNS = CFBridgingRelease(JSStringCopyCFString(kCFAllocatorDefault, jsstring));
+    RetainPtr<CFStringRef> stringCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, jsstring));
     JSStringRelease(jsstring);
-    return stringNS;
+    return (NSString *)stringCF.autorelease();
 }
 
 id valueToDate(JSGlobalContextRef context, JSValueRef value, JSValueRef* exception)

Modified: trunk/Source/_javascript_Core/ChangeLog (173140 => 173141)


--- trunk/Source/_javascript_Core/ChangeLog	2014-08-30 18:22:11 UTC (rev 173140)
+++ trunk/Source/_javascript_Core/ChangeLog	2014-08-30 22:43:33 UTC (rev 173141)
@@ -1,3 +1,15 @@
+2014-08-26  Maciej Stachowiak  <[email protected]>
+
+        Use RetainPtr::autorelease in some places where it seems appropriate
+        https://bugs.webkit.org/show_bug.cgi?id=136280
+
+        Reviewed by Darin Adler.
+
+        * API/JSContext.mm:
+        (-[JSContext name]): Use RetainPtr::autorelease() in place of ObjC autorelease.
+        * API/JSValue.mm:
+        (valueToString): Make appropriate use of RetainPtr
+
 2014-08-29  Akos Kiss  <[email protected]>
 
         Ensure that the call frame passed from doVMEntry to the called function always contains the valid scope chain.

Modified: trunk/Source/WTF/ChangeLog (173140 => 173141)


--- trunk/Source/WTF/ChangeLog	2014-08-30 18:22:11 UTC (rev 173140)
+++ trunk/Source/WTF/ChangeLog	2014-08-30 22:43:33 UTC (rev 173141)
@@ -1,3 +1,14 @@
+2014-08-26  Maciej Stachowiak  <[email protected]>
+
+        Use RetainPtr::autorelease in some places where it seems appropriate
+        https://bugs.webkit.org/show_bug.cgi?id=136280
+
+        Reviewed by Darin Adler.
+
+        * wtf/text/mac/StringImplMac.mm:
+        (WTF::StringImpl::operator NSString *): Use autorelease() instead of
+        CFBridgingRelease(leakRef())
+
 2014-08-29  Joseph Pecoraro  <[email protected]>
 
         _javascript_Core: Use ASCIILiteral where possible

Modified: trunk/Source/WTF/wtf/text/mac/StringImplMac.mm (173140 => 173141)


--- trunk/Source/WTF/wtf/text/mac/StringImplMac.mm	2014-08-30 18:22:11 UTC (rev 173140)
+++ trunk/Source/WTF/wtf/text/mac/StringImplMac.mm	2014-08-30 22:43:33 UTC (rev 173141)
@@ -28,7 +28,7 @@
 
 StringImpl::operator NSString *()
 {
-    return CFBridgingRelease(createCFString().leakRef());
+    return (NSString *)createCFString().autorelease();
 }
 
 }

Modified: trunk/Source/WebCore/ChangeLog (173140 => 173141)


--- trunk/Source/WebCore/ChangeLog	2014-08-30 18:22:11 UTC (rev 173140)
+++ trunk/Source/WebCore/ChangeLog	2014-08-30 22:43:33 UTC (rev 173141)
@@ -1,3 +1,14 @@
+2014-08-26  Maciej Stachowiak  <[email protected]>
+
+        Use RetainPtr::autorelease in some places where it seems appropriate
+        https://bugs.webkit.org/show_bug.cgi?id=136280
+
+        Reviewed by Darin Adler.
+
+        * platform/mac/URLMac.mm:
+        (WebCore::URL::operator NSURL *): Use autorelease() instead of
+        CFBridgingRelease(leakRef())
+
 2014-08-30  Yusuke Suzuki  <[email protected]>
 
         CSS: Refactor :visited handling in SelectorChecker

Modified: trunk/Source/WebCore/platform/mac/URLMac.mm (173140 => 173141)


--- trunk/Source/WebCore/platform/mac/URLMac.mm	2014-08-30 18:22:11 UTC (rev 173140)
+++ trunk/Source/WebCore/platform/mac/URLMac.mm	2014-08-30 22:43:33 UTC (rev 173141)
@@ -49,7 +49,7 @@
 {
     // Creating a toll-free bridged CFURL, because a real NSURL would not preserve the original string.
     // We'll need fidelity when round-tripping via CFURLGetBytes().
-    return CFBridgingRelease(createCFURL().leakRef());
+    return (NSURL *)createCFURL().autorelease();
 }
 
 RetainPtr<CFURLRef> URL::createCFURL() const

Modified: trunk/Source/WebKit/mac/ChangeLog (173140 => 173141)


--- trunk/Source/WebKit/mac/ChangeLog	2014-08-30 18:22:11 UTC (rev 173140)
+++ trunk/Source/WebKit/mac/ChangeLog	2014-08-30 22:43:33 UTC (rev 173141)
@@ -1,3 +1,16 @@
+2014-08-26  Maciej Stachowiak  <[email protected]>
+
+        Use RetainPtr::autorelease in some places where it seems appropriate
+        https://bugs.webkit.org/show_bug.cgi?id=136280
+
+        Reviewed by Darin Adler.
+
+        * WebView/WebHTMLView.mm:
+        (imageFromRect): Use RetainPtr in this function.
+        * WebView/WebPDFRepresentation.mm:
+        (-[WebPDFRepresentation convertPostScriptDataSourceToPDF:]): Use RetainPtr
+        in this method.
+
 2014-08-29  Csaba Osztrogonác  <[email protected]>
 
         Unreviwed, remove empty directories.

Modified: trunk/Source/WebKit/mac/WebView/WebHTMLView.mm (173140 => 173141)


--- trunk/Source/WebKit/mac/WebView/WebHTMLView.mm	2014-08-30 18:22:11 UTC (rev 173140)
+++ trunk/Source/WebKit/mac/WebView/WebHTMLView.mm	2014-08-30 22:43:33 UTC (rev 173141)
@@ -6631,12 +6631,12 @@
     
     CGContextRestoreGState(contextRef);
     
-    CGImageRef resultImage = CGBitmapContextCreateImage(contextRef);
+    RetainPtr<CGImageRef> resultImage = adoptCF(CGBitmapContextCreateImage(contextRef));
     
     WKSetCurrentGraphicsContext(oldContext);
     frame->view()->setPaintBehavior(oldPaintBehavior);
     
-    return (CGImageRef)CFBridgingRelease(resultImage);
+    return resultImage.autorelease();
     
     END_BLOCK_OBJC_EXCEPTIONS;
 

Modified: trunk/Source/WebKit/mac/WebView/WebPDFRepresentation.mm (173140 => 173141)


--- trunk/Source/WebKit/mac/WebView/WebPDFRepresentation.mm	2014-08-30 18:22:11 UTC (rev 173140)
+++ trunk/Source/WebKit/mac/WebView/WebPDFRepresentation.mm	2014-08-30 22:43:33 UTC (rev 173141)
@@ -36,11 +36,12 @@
 #import "WebPDFDocumentExtras.h"
 #import "WebPDFView.h"
 #import "WebTypesInternal.h"
-#import <wtf/Assertions.h>
-#import <wtf/ObjcRuntimeExtras.h>
 #import <_javascript_Core/JSContextRef.h>
 #import <_javascript_Core/JSStringRef.h>
 #import <_javascript_Core/JSStringRefCF.h>
+#import <wtf/Assertions.h>
+#import <wtf/ObjcRuntimeExtras.h>
+#import <wtf/RetainPtr.h>
 
 @implementation WebPDFRepresentation
 
@@ -90,26 +91,22 @@
     // http://developer.apple.com/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/dq_ps_convert/chapter_16_section_1.html
 
     CGPSConverterCallbacks callbacks = { 0, 0, 0, 0, 0, 0, 0, 0 };    
-    CGPSConverterRef converter = CGPSConverterCreate(0, &callbacks, 0);
-    ASSERT(converter);
+    RetainPtr<CGPSConverterRef> converter = adoptCF(CGPSConverterCreate(0, &callbacks, 0));
+    ASSERT(converter.get());
 
-    CGDataProviderRef provider = CGDataProviderCreateWithCFData((CFDataRef)data);
-    ASSERT(provider);
+    RetainPtr<CGDataProviderRef> provider = adoptCF(CGDataProviderCreateWithCFData((CFDataRef)data));
+    ASSERT(provider.get());
 
-    CFMutableDataRef result = CFDataCreateMutable(kCFAllocatorDefault, 0);
-    ASSERT(result);
+    RetainPtr<CFMutableDataRef> result = adoptCF(CFDataCreateMutable(kCFAllocatorDefault, 0));
+    ASSERT(result.get());
 
-    CGDataConsumerRef consumer = CGDataConsumerCreateWithCFData(result);
-    ASSERT(consumer);
+    RetainPtr<CGDataConsumerRef> consumer = adoptCF(CGDataConsumerCreateWithCFData(result.get()));
+    ASSERT(consumer.get());
 
     // Error handled by detecting zero-length 'result' in caller
-    CGPSConverterConvert(converter, provider, consumer, 0);
+    CGPSConverterConvert(converter.get(), provider.get(), consumer.get(), 0);
 
-    CFRelease(converter);
-    CFRelease(provider);
-    CFRelease(consumer);
-
-    return CFBridgingRelease(result);
+    return (NSData *)result.autorelease();
 }
 
 - (void)finishedLoadingWithDataSource:(WebDataSource *)dataSource

Modified: trunk/Source/WebKit2/ChangeLog (173140 => 173141)


--- trunk/Source/WebKit2/ChangeLog	2014-08-30 18:22:11 UTC (rev 173140)
+++ trunk/Source/WebKit2/ChangeLog	2014-08-30 22:43:33 UTC (rev 173141)
@@ -1,3 +1,13 @@
+2014-08-26  Maciej Stachowiak  <[email protected]>
+
+        Use RetainPtr::autorelease in some places where it seems appropriate
+        https://bugs.webkit.org/show_bug.cgi?id=136280
+
+        Reviewed by Darin Adler.
+
+        * Shared/Cocoa/WKNSURLExtras.mm:
+        (urlWithWTFString): Use autorelease() instead of CFBridgingRelease(leakRef())
+
 2014-08-29  Tim Horton  <[email protected]>
 
         More occasional crashes in ServicesController::resfreshExistingServices

Modified: trunk/Source/WebKit2/Shared/Cocoa/WKNSURLExtras.mm (173140 => 173141)


--- trunk/Source/WebKit2/Shared/Cocoa/WKNSURLExtras.mm	2014-08-30 18:22:11 UTC (rev 173140)
+++ trunk/Source/WebKit2/Shared/Cocoa/WKNSURLExtras.mm	2014-08-30 22:43:33 UTC (rev 173141)
@@ -40,7 +40,7 @@
         return nil;
 
     CString buffer = string.utf8();
-    return CFBridgingRelease(createCFURLFromBuffer(buffer.data(), buffer.length(), (CFURLRef)baseURL).leakRef());
+    return (NSURL *)createCFURLFromBuffer(buffer.data(), buffer.length(), (CFURLRef)baseURL).autorelease();
 }
 
 + (instancetype)_web_URLWithWTFString:(const String&)string
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to