- Revision
- 149768
- Author
- [email protected]
- Date
- 2013-05-08 15:02:31 -0700 (Wed, 08 May 2013)
Log Message
Assert at compile time that we don't pass Objective-C object pointers to adoptCF
https://bugs.webkit.org/show_bug.cgi?id=115823
Reviewed by Geoffrey Garen.
Source/WebCore:
* platform/graphics/ca/mac/TileController.mm:
(WebCore::TileController::TileController):
Use adoptNS for CALayer.
Source/WebKit2:
Fix adoptNS/adoptCF mismatches. For the adopt(leakRef()) case we'd ideally want a static_pointer_cast overload for RetainPtr,
but this will do for now.
* Shared/mac/ArgumentCodersMac.mm:
(CoreIPC::decode):
Source/WTF:
static_assert in adoptCF that the object passed in is not an Objective-C object.
* wtf/RetainPtr.h:
Modified Paths
Diff
Modified: trunk/Source/WTF/ChangeLog (149767 => 149768)
--- trunk/Source/WTF/ChangeLog 2013-05-08 21:56:08 UTC (rev 149767)
+++ trunk/Source/WTF/ChangeLog 2013-05-08 22:02:31 UTC (rev 149768)
@@ -1,5 +1,15 @@
2013-05-08 Anders Carlsson <[email protected]>
+ Assert at compile time that we don't pass Objective-C object pointers to adoptCF
+ https://bugs.webkit.org/show_bug.cgi?id=115823
+
+ Reviewed by Geoffrey Garen.
+
+ static_assert in adoptCF that the object passed in is not an Objective-C object.
+ * wtf/RetainPtr.h:
+
+2013-05-08 Anders Carlsson <[email protected]>
+
Remove RetainPtr::adoptNS and RetainPtr::adoptCF
https://bugs.webkit.org/show_bug.cgi?id=115817
Modified: trunk/Source/WTF/wtf/RetainPtr.h (149767 => 149768)
--- trunk/Source/WTF/wtf/RetainPtr.h 2013-05-08 21:56:08 UTC (rev 149767)
+++ trunk/Source/WTF/wtf/RetainPtr.h 2013-05-08 22:02:31 UTC (rev 149768)
@@ -74,8 +74,19 @@
RetainPtr() : m_ptr(0) {}
RetainPtr(PtrType ptr) : m_ptr(ptr) { if (ptr) CFRetain(ptr); }
- RetainPtr(AdoptCFTag, PtrType ptr) : m_ptr(ptr) { }
- RetainPtr(AdoptNSTag, PtrType ptr) : m_ptr(ptr) { adoptNSReference(ptr); }
+ RetainPtr(AdoptCFTag, PtrType ptr)
+ : m_ptr(ptr)
+ {
+#ifdef __OBJC__
+ static_assert(!std::is_convertible<T, id>::value, "Don't use adoptCF with Objective-C pointer types, use adoptNS.");
+#endif
+ }
+
+ RetainPtr(AdoptNSTag, PtrType ptr)
+ : m_ptr(ptr)
+ {
+ adoptNSReference(ptr);
+ }
RetainPtr(const RetainPtr& o) : m_ptr(o.m_ptr) { if (PtrType ptr = m_ptr) CFRetain(ptr); }
Modified: trunk/Source/WebCore/ChangeLog (149767 => 149768)
--- trunk/Source/WebCore/ChangeLog 2013-05-08 21:56:08 UTC (rev 149767)
+++ trunk/Source/WebCore/ChangeLog 2013-05-08 22:02:31 UTC (rev 149768)
@@ -1,3 +1,14 @@
+2013-05-08 Anders Carlsson <[email protected]>
+
+ Assert at compile time that we don't pass Objective-C object pointers to adoptCF
+ https://bugs.webkit.org/show_bug.cgi?id=115823
+
+ Reviewed by Geoffrey Garen.
+
+ * platform/graphics/ca/mac/TileController.mm:
+ (WebCore::TileController::TileController):
+ Use adoptNS for CALayer.
+
2013-05-08 Eric Carlson <[email protected]>
TextTrackCue should support empty content
Modified: trunk/Source/WebCore/platform/graphics/ca/mac/TileController.mm (149767 => 149768)
--- trunk/Source/WebCore/platform/graphics/ca/mac/TileController.mm 2013-05-08 21:56:08 UTC (rev 149767)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/TileController.mm 2013-05-08 22:02:31 UTC (rev 149768)
@@ -96,7 +96,7 @@
TileController::TileController(WebTiledBackingLayer* tileCacheLayer)
: m_tileCacheLayer(tileCacheLayer)
- , m_tileContainerLayer(adoptCF([[CALayer alloc] init]))
+ , m_tileContainerLayer(adoptNS([[CALayer alloc] init]))
, m_tileSize(defaultTileWidth, defaultTileHeight)
, m_tileRevalidationTimer(this, &TileController::tileRevalidationTimerFired)
, m_cohortRemovalTimer(this, &TileController::cohortRemovalTimerFired)
Modified: trunk/Source/WebKit2/ChangeLog (149767 => 149768)
--- trunk/Source/WebKit2/ChangeLog 2013-05-08 21:56:08 UTC (rev 149767)
+++ trunk/Source/WebKit2/ChangeLog 2013-05-08 22:02:31 UTC (rev 149768)
@@ -1,3 +1,16 @@
+2013-05-08 Anders Carlsson <[email protected]>
+
+ Assert at compile time that we don't pass Objective-C object pointers to adoptCF
+ https://bugs.webkit.org/show_bug.cgi?id=115823
+
+ Reviewed by Geoffrey Garen.
+
+ Fix adoptNS/adoptCF mismatches. For the adopt(leakRef()) case we'd ideally want a static_pointer_cast overload for RetainPtr,
+ but this will do for now.
+
+ * Shared/mac/ArgumentCodersMac.mm:
+ (CoreIPC::decode):
+
2013-05-08 Sam Weinig <[email protected]>
Add SPI to determine if a plugin is sandboxed
Modified: trunk/Source/WebKit2/Shared/mac/ArgumentCodersMac.mm (149767 => 149768)
--- trunk/Source/WebKit2/Shared/mac/ArgumentCodersMac.mm 2013-05-08 21:56:08 UTC (rev 149767)
+++ trunk/Source/WebKit2/Shared/mac/ArgumentCodersMac.mm 2013-05-08 22:02:31 UTC (rev 149768)
@@ -277,7 +277,7 @@
[resultString.get() addAttributes:attributes.get() range:NSMakeRange(rangeLocation, rangeLength)];
}
- result = adoptCF(resultString.leakRef());
+ result = adoptNS(resultString.leakRef());
return true;
}
@@ -344,7 +344,7 @@
[dictionary.get() setObject:value.get() forKey:key.get()];
}
- result = adoptCF(dictionary.leakRef());
+ result = adoptNS(dictionary.leakRef());
return true;
}
@@ -379,7 +379,7 @@
if (!decode(decoder, number))
return false;
- result = adoptCF((NSNumber *)number.leakRef());
+ result = adoptNS((NSNumber *)number.leakRef());
return true;
}
@@ -394,7 +394,7 @@
if (!decode(decoder, string))
return false;
- result = adoptCF((NSString *)string.leakRef());
+ result = adoptNS((NSString *)string.leakRef());
return true;
}
@@ -444,7 +444,7 @@
if (!decode(decoder, date))
return false;
- result = adoptCF((NSDate *)date.leakRef());
+ result = adoptNS((NSDate *)date.leakRef());
return true;
}
@@ -459,7 +459,7 @@
if (!decode(decoder, data))
return false;
- result = adoptCF((NSData *)data.leakRef());
+ result = adoptNS((NSData *)data.leakRef());
return true;
}