Commit 71e211b2 authored by aroben@apple.com's avatar aroben@apple.com

Allow implicit conversion from nullptr_t to PassOwnPtr

This makes it a lot easier to write code that just wants a null PassOwnPtr, especially in
strict PassOwnPtr mode.

Fixes <http://webkit.org/b/59964> Implicit conversion from std::nullptr_t to PassOwnPtr
doesn't work, but should

Reviewed by Adam Barth.

Source/JavaScriptCore:

* wtf/PassOwnPtr.h:
(WTF::PassOwnPtr::PassOwnPtr): Added a non-explicit constructor that takes a nullptr_t.

* wtf/MessageQueue.h:
(WTF::::waitForMessageFilteredWithTimeout):
(WTF::::tryGetMessage):
Use the new implicit conversion.

Source/WebCore:

Take advantage of implicit conversion from nullptr_t to PassOwnPtr

* bindings/js/ScheduledAction.cpp:
* css/CSSStyleSelector.cpp:
* css/MediaList.cpp:
* css/MediaQueryMatcher.cpp:
* css/SVGCSSStyleSelector.cpp:
* dom/MessagePort.cpp:
* html/InputType.cpp:
* html/canvas/WebGLRenderingContext.cpp:
* inspector/InspectorStyleSheet.cpp:
* page/ContextMenuController.cpp:
* page/Page.cpp:
* platform/PlatformGestureRecognizer.cpp:
* platform/PurgeableBuffer.h:
* platform/graphics/ImageBuffer.h:
* platform/leveldb/LevelDBDatabase.cpp:
* platform/mac/PurgeableBufferMac.cpp:
* platform/text/RegularExpression.cpp:
* rendering/RenderTheme.cpp:
* rendering/RenderThemeMac.mm:
* rendering/style/RenderStyle.h:
* rendering/style/SVGRenderStyleDefs.cpp:
* rendering/style/ShadowData.cpp:
* rendering/style/StyleRareInheritedData.cpp:
* rendering/style/StyleRareNonInheritedData.cpp:
* rendering/svg/RenderSVGResourcePattern.cpp:

Source/WebKit/chromium:

Take advantage of implicit conversion from nullptr_t to PassOwnPtr

* src/WebMediaPlayerClientImpl.cpp:

Source/WebKit/mac:

Take advantage of implicit conversion from nullptr_t to PassOwnPtr

* History/WebHistory.mm:
* Plugins/WebNetscapePluginEventHandler.mm:
* WebView/WebView.mm:

Source/WebKit2:

Take advantage of implicit conversion from nullptr_t to PassOwnPtr

* Platform/CoreIPC/Connection.cpp:
* UIProcess/qt/WebContextMenuProxyQt.cpp:
* WebProcess/InjectedBundle/InjectedBundle.cpp:
* WebProcess/WebPage/DrawingArea.cpp:

Tools:

Take advantage of implicit nullptr_t -> PassOwnPtr conversion

* DumpRenderTree/chromium/CppBoundClass.h:
* DumpRenderTree/chromium/WebViewHost.cpp:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@85603 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 5c6b7b07
2011-05-02 Adam Roben <aroben@apple.com>
Allow implicit conversion from nullptr_t to PassOwnPtr
This makes it a lot easier to write code that just wants a null PassOwnPtr, especially in
strict PassOwnPtr mode.
Fixes <http://webkit.org/b/59964> Implicit conversion from std::nullptr_t to PassOwnPtr
doesn't work, but should
Reviewed by Adam Barth.
* wtf/PassOwnPtr.h:
(WTF::PassOwnPtr::PassOwnPtr): Added a non-explicit constructor that takes a nullptr_t.
* wtf/MessageQueue.h:
(WTF::::waitForMessageFilteredWithTimeout):
(WTF::::tryGetMessage):
Use the new implicit conversion.
2011-05-02 Jessie Berlin <jberlin@apple.com>
Rubber-stamped by Oliver Hunt.
......
......@@ -140,12 +140,12 @@ namespace WTF {
if (m_killed) {
result = MessageQueueTerminated;
return PassOwnPtr<DataType>();
return nullptr;
}
if (timedOut) {
result = MessageQueueTimeout;
return PassOwnPtr<DataType>();
return nullptr;
}
ASSERT(found != m_queue.end());
......@@ -160,9 +160,9 @@ namespace WTF {
{
MutexLocker lock(m_mutex);
if (m_killed)
return PassOwnPtr<DataType>();
return nullptr;
if (m_queue.isEmpty())
return PassOwnPtr<DataType>();
return nullptr;
return adoptPtr(m_queue.takeFirst());
}
......
......@@ -48,6 +48,7 @@ namespace WTF {
typedef ValueType* PtrType;
PassOwnPtr() : m_ptr(0) { }
PassOwnPtr(std::nullptr_t) : m_ptr(0) { }
// It somewhat breaks the type system to allow transfer of ownership out of
// a const PassOwnPtr. However, it makes it much easier to work with PassOwnPtr
......
2011-05-02 Adam Roben <aroben@apple.com>
Take advantage of implicit conversion from nullptr_t to PassOwnPtr
Fixes <http://webkit.org/b/59964> Implicit conversion from std::nullptr_t to PassOwnPtr
doesn't work, but should
Reviewed by Adam Barth.
* bindings/js/ScheduledAction.cpp:
* css/CSSStyleSelector.cpp:
* css/MediaList.cpp:
* css/MediaQueryMatcher.cpp:
* css/SVGCSSStyleSelector.cpp:
* dom/MessagePort.cpp:
* html/InputType.cpp:
* html/canvas/WebGLRenderingContext.cpp:
* inspector/InspectorStyleSheet.cpp:
* page/ContextMenuController.cpp:
* page/Page.cpp:
* platform/PlatformGestureRecognizer.cpp:
* platform/PurgeableBuffer.h:
* platform/graphics/ImageBuffer.h:
* platform/leveldb/LevelDBDatabase.cpp:
* platform/mac/PurgeableBufferMac.cpp:
* platform/text/RegularExpression.cpp:
* rendering/RenderTheme.cpp:
* rendering/RenderThemeMac.mm:
* rendering/style/RenderStyle.h:
* rendering/style/SVGRenderStyleDefs.cpp:
* rendering/style/ShadowData.cpp:
* rendering/style/StyleRareInheritedData.cpp:
* rendering/style/StyleRareNonInheritedData.cpp:
* rendering/svg/RenderSVGResourcePattern.cpp:
2011-05-03 Pavel Feldman <pfeldman@google.com>
Not reviewed: fix inspector status bar image glyph reference in network panel.
......@@ -54,10 +54,10 @@ PassOwnPtr<ScheduledAction> ScheduledAction::create(ExecState* exec, DOMWrapperW
CallData callData;
if (getCallData(v, callData) == CallTypeNone) {
if (policy && !policy->allowEval())
return PassOwnPtr<ScheduledAction>();
return nullptr;
UString string = v.toString(exec);
if (exec->hadException())
return PassOwnPtr<ScheduledAction>();
return nullptr;
return adoptPtr(new ScheduledAction(ustringToString(string), isolatedWorld));
}
......
......@@ -4827,11 +4827,11 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
case CSSPropertyWebkitBoxShadow: {
if (isInherit) {
if (id == CSSPropertyTextShadow)
return m_style->setTextShadow(m_parentStyle->textShadow() ? adoptPtr(new ShadowData(*m_parentStyle->textShadow())) : PassOwnPtr<ShadowData>());
return m_style->setBoxShadow(m_parentStyle->boxShadow() ? adoptPtr(new ShadowData(*m_parentStyle->boxShadow())) : PassOwnPtr<ShadowData>());
return m_style->setTextShadow(m_parentStyle->textShadow() ? adoptPtr(new ShadowData(*m_parentStyle->textShadow())) : nullptr);
return m_style->setBoxShadow(m_parentStyle->boxShadow() ? adoptPtr(new ShadowData(*m_parentStyle->boxShadow())) : nullptr);
}
if (isInitial || primitiveValue) // initial | none
return id == CSSPropertyTextShadow ? m_style->setTextShadow(PassOwnPtr<ShadowData>()) : m_style->setBoxShadow(PassOwnPtr<ShadowData>());
return id == CSSPropertyTextShadow ? m_style->setTextShadow(nullptr) : m_style->setBoxShadow(nullptr);
if (!value->isValueList())
return;
......
......@@ -131,7 +131,7 @@ void MediaList::deleteMedium(const String& oldMedium, ExceptionCode& ec)
} else if (m_fallback) {
String medium = parseMediaDescriptor(oldMedium);
if (!medium.isNull()) {
createdQuery = adoptPtr(new MediaQuery(MediaQuery::None, medium, PassOwnPtr<MediaQuery::ExpressionVector>()));
createdQuery = adoptPtr(new MediaQuery(MediaQuery::None, medium, nullptr));
oldQuery = createdQuery.get();
}
}
......@@ -186,7 +186,7 @@ void MediaList::setMediaText(const String& value, ExceptionCode& ec)
if (m_fallback) {
String mediaDescriptor = parseMediaDescriptor(medium);
if (!mediaDescriptor.isNull())
tempMediaList->m_queries.append(new MediaQuery(MediaQuery::None, mediaDescriptor, PassOwnPtr<MediaQuery::ExpressionVector>()));
tempMediaList->m_queries.append(new MediaQuery(MediaQuery::None, mediaDescriptor, nullptr));
} else {
ec = SYNTAX_ERR;
return;
......@@ -232,7 +232,7 @@ void MediaList::appendMedium(const String& newMedium, ExceptionCode& ec)
} else if (m_fallback) {
String medium = parseMediaDescriptor(newMedium);
if (!medium.isNull()) {
m_queries.append(new MediaQuery(MediaQuery::None, medium, PassOwnPtr<MediaQuery::ExpressionVector>()));
m_queries.append(new MediaQuery(MediaQuery::None, medium, nullptr));
ec = 0;
}
}
......
......@@ -77,15 +77,15 @@ String MediaQueryMatcher::mediaType() const
PassOwnPtr<MediaQueryEvaluator> MediaQueryMatcher::prepareEvaluator() const
{
if (!m_document || !m_document->frame())
return PassOwnPtr<MediaQueryEvaluator>();
return nullptr;
Element* documentElement = m_document->documentElement();
if (!documentElement)
return PassOwnPtr<MediaQueryEvaluator>();
return nullptr;
CSSStyleSelector* styleSelector = m_document->styleSelector();
if (!styleSelector)
return PassOwnPtr<MediaQueryEvaluator>();
return nullptr;
RefPtr<RenderStyle> rootStyle = styleSelector->styleForElement(documentElement, 0 /*defaultParent*/, false /*allowSharing*/, true /*resolveForRootDefault*/);
......
......@@ -564,7 +564,7 @@ void CSSStyleSelector::applySVGProperty(int id, CSSValue* value)
if (isInherit)
return svgstyle->setShadow(adoptPtr(m_parentStyle->svgStyle()->shadow() ? new ShadowData(*m_parentStyle->svgStyle()->shadow()) : 0));
if (isInitial || primitiveValue) // initial | none
return svgstyle->setShadow(PassOwnPtr<ShadowData>());
return svgstyle->setShadow(nullptr);
if (!value->isValueList())
return;
......
......@@ -206,7 +206,7 @@ MessagePort* MessagePort::locallyEntangledPort()
PassOwnPtr<MessagePortChannelArray> MessagePort::disentanglePorts(const MessagePortArray* ports, ExceptionCode& ec)
{
if (!ports || !ports->size())
return PassOwnPtr<MessagePortChannelArray>();
return nullptr;
// HashSet used to efficiently check for duplicates in the passed-in array.
HashSet<MessagePort*> portSet;
......@@ -216,7 +216,7 @@ PassOwnPtr<MessagePortChannelArray> MessagePort::disentanglePorts(const MessageP
MessagePort* port = (*ports)[i].get();
if (!port || port->isCloned() || portSet.contains(port)) {
ec = INVALID_STATE_ERR;
return PassOwnPtr<MessagePortChannelArray>();
return nullptr;
}
portSet.add(port);
}
......@@ -234,7 +234,7 @@ PassOwnPtr<MessagePortChannelArray> MessagePort::disentanglePorts(const MessageP
PassOwnPtr<MessagePortArray> MessagePort::entanglePorts(ScriptExecutionContext& context, PassOwnPtr<MessagePortChannelArray> channels)
{
if (!channels || !channels->size())
return PassOwnPtr<MessagePortArray>();
return nullptr;
OwnPtr<MessagePortArray> portArray = adoptPtr(new MessagePortArray(channels->size()));
for (unsigned int i = 0; i < channels->size(); ++i) {
......
......@@ -504,7 +504,7 @@ bool InputType::canSetValue(const String&)
PassOwnPtr<ClickHandlingState> InputType::willDispatchClick()
{
return PassOwnPtr<ClickHandlingState>();
return nullptr;
}
void InputType::didDispatchClick(Event*, const ClickHandlingState&)
......
......@@ -371,7 +371,7 @@ PassOwnPtr<WebGLRenderingContext> WebGLRenderingContext::create(HTMLCanvasElemen
if (!context) {
canvas->dispatchEvent(WebGLContextEvent::create(eventNames().webglcontextcreationerrorEvent, false, true, "Could not create a WebGL context."));
return PassOwnPtr<WebGLRenderingContext>();
return nullptr;
}
return adoptPtr(new WebGLRenderingContext(canvas, context, attributes));
......@@ -473,7 +473,7 @@ void WebGLRenderingContext::setupFlags()
WebGLRenderingContext::~WebGLRenderingContext()
{
detachAndRemoveAllObjects();
m_context->setContextLostCallback(PassOwnPtr<GraphicsContext3D::ContextLostCallback>());
m_context->setContextLostCallback(nullptr);
}
void WebGLRenderingContext::markContextChanged()
......
......@@ -84,7 +84,7 @@ void ParsedStyleSheet::setText(const String& text)
{
m_hasText = true;
m_text = text;
setSourceData(PassOwnPtr<SourceData>());
setSourceData(nullptr);
}
void ParsedStyleSheet::setSourceData(PassOwnPtr<SourceData> sourceData)
......
......@@ -122,7 +122,7 @@ void ContextMenuController::showContextMenu(Event* event, PassRefPtr<ContextMenu
PassOwnPtr<ContextMenu> ContextMenuController::createContextMenu(Event* event)
{
if (!event->isMouseEvent())
return PassOwnPtr<ContextMenu>();
return nullptr;
MouseEvent* mouseEvent = static_cast<MouseEvent*>(event);
HitTestResult result(mouseEvent->absoluteLocation());
......@@ -131,7 +131,7 @@ PassOwnPtr<ContextMenu> ContextMenuController::createContextMenu(Event* event)
result = frame->eventHandler()->hitTestResultAtPoint(mouseEvent->absoluteLocation(), false);
if (!result.innerNonSharedNode())
return PassOwnPtr<ContextMenu>();
return nullptr;
m_hitTestResult = result;
......
......@@ -128,8 +128,8 @@ Page::Page(const PageClients& pageClients)
, m_geolocationController(adoptPtr(new GeolocationController(this, pageClients.geolocationClient)))
#endif
#if ENABLE(DEVICE_ORIENTATION)
, m_deviceMotionController(RuntimeEnabledFeatures::deviceMotionEnabled() ? adoptPtr(new DeviceMotionController(pageClients.deviceMotionClient)) : PassOwnPtr<DeviceMotionController>())
, m_deviceOrientationController(RuntimeEnabledFeatures::deviceOrientationEnabled() ? adoptPtr(new DeviceOrientationController(this, pageClients.deviceOrientationClient)) : PassOwnPtr<DeviceOrientationController>())
, m_deviceMotionController(RuntimeEnabledFeatures::deviceMotionEnabled() ? adoptPtr(new DeviceMotionController(pageClients.deviceMotionClient)) : nullptr)
, m_deviceOrientationController(RuntimeEnabledFeatures::deviceOrientationEnabled() ? adoptPtr(new DeviceOrientationController(this, pageClients.deviceOrientationClient)) : nullptr)
#endif
#if ENABLE(INPUT_SPEECH)
, m_speechInputClient(pageClients.speechInputClient)
......
......@@ -40,7 +40,7 @@ PlatformGestureRecognizer::~PlatformGestureRecognizer() { }
// here that meets its needs. EventHandler will ignore null GestureRecognizers.
PassOwnPtr<PlatformGestureRecognizer> PlatformGestureRecognizer::create()
{
return PassOwnPtr<PlatformGestureRecognizer>();
return nullptr;
}
} // namespace WebCore
......@@ -63,7 +63,7 @@ namespace WebCore {
};
#if !ENABLE(PURGEABLE_MEMORY)
inline PassOwnPtr<PurgeableBuffer> PurgeableBuffer::create(const char*, size_t) { return PassOwnPtr<PurgeableBuffer>(); }
inline PassOwnPtr<PurgeableBuffer> PurgeableBuffer::create(const char*, size_t) { return nullptr; }
inline PurgeableBuffer::~PurgeableBuffer() { }
inline const char* PurgeableBuffer::data() const { return 0; }
inline bool PurgeableBuffer::wasPurged() const { return false; }
......
......@@ -69,7 +69,7 @@ namespace WebCore {
OwnPtr<ImageBuffer> buf = adoptPtr(new ImageBuffer(size, colorSpace, renderingMode, success));
if (success)
return buf.release();
return PassOwnPtr<ImageBuffer>();
return nullptr;
}
~ImageBuffer();
......
......@@ -106,7 +106,7 @@ PassOwnPtr<LevelDBDatabase> LevelDBDatabase::open(const String& fileName, const
leveldb::Status s = leveldb::DB::Open(options, fileName.utf8().data(), &db);
if (!s.ok())
return PassOwnPtr<LevelDBDatabase>();
return nullptr;
result->m_db = adoptPtr(db);
result->m_comparatorAdapter = comparatorAdapter.release();
......
......@@ -55,21 +55,21 @@ PurgeableBuffer::~PurgeableBuffer()
PassOwnPtr<PurgeableBuffer> PurgeableBuffer::create(const char* data, size_t size)
{
if (size < minPurgeableBufferSize)
return PassOwnPtr<PurgeableBuffer>();
return nullptr;
vm_address_t buffer = 0;
kern_return_t ret = vm_allocate(mach_task_self(), &buffer, size, VM_FLAGS_PURGABLE | VM_FLAGS_ANYWHERE | VM_TAG_FOR_WEBCORE_PURGEABLE_MEMORY);
ASSERT(ret == KERN_SUCCESS);
if (ret != KERN_SUCCESS)
return PassOwnPtr<PurgeableBuffer>();
return nullptr;
ret = vm_copy(mach_task_self(), reinterpret_cast<vm_address_t>(data), size, buffer);
ASSERT(ret == KERN_SUCCESS);
if (ret != KERN_SUCCESS) {
vm_deallocate(mach_task_self(), buffer, size);
return PassOwnPtr<PurgeableBuffer>();
return nullptr;
}
return adoptPtr(new PurgeableBuffer(reinterpret_cast<char*>(buffer), size));
......
......@@ -59,7 +59,7 @@ private:
JSC::Yarr::YarrPattern pattern(JSC::UString(patternString.impl()), (caseSensitivity == TextCaseInsensitive), false, &m_constructionError);
if (m_constructionError) {
LOG_ERROR("RegularExpression: YARR compile failed with '%s'", m_constructionError);
return PassOwnPtr<JSC::Yarr::BytecodePattern>();
return nullptr;
}
m_numSubpatterns = pattern.m_numSubpatterns;
......
......@@ -93,7 +93,7 @@ void RenderTheme::adjustStyle(CSSStyleSelector* selector, RenderStyle* style, El
return;
// Never support box-shadow on native controls.
style->setBoxShadow(PassOwnPtr<ShadowData>());
style->setBoxShadow(nullptr);
#if USE(NEW_THEME)
switch (part) {
......@@ -929,7 +929,7 @@ bool RenderTheme::paintInputFieldSpeechButton(RenderObject* object, const PaintI
#if ENABLE(METER_TAG)
void RenderTheme::adjustMeterStyle(CSSStyleSelector*, RenderStyle* style, Element*) const
{
style->setBoxShadow(PassOwnPtr<ShadowData>());
style->setBoxShadow(nullptr);
}
IntSize RenderTheme::meterSizeForBounds(const RenderMeter*, const IntRect& bounds) const
......
......@@ -1164,7 +1164,7 @@ void RenderThemeMac::adjustMenuListStyle(CSSStyleSelector* selector, RenderStyle
// system font for the control size instead.
setFontFromControlSize(selector, style, controlSize);
style->setBoxShadow(PassOwnPtr<ShadowData>());
style->setBoxShadow(nullptr);
}
int RenderThemeMac::popupInternalPaddingLeft(RenderStyle* style) const
......@@ -1250,7 +1250,7 @@ const int trackRadius = 2;
void RenderThemeMac::adjustSliderTrackStyle(CSSStyleSelector*, RenderStyle* style, Element*) const
{
style->setBoxShadow(PassOwnPtr<ShadowData>());
style->setBoxShadow(nullptr);
}
bool RenderThemeMac::paintSliderTrack(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r)
......@@ -1291,7 +1291,7 @@ bool RenderThemeMac::paintSliderTrack(RenderObject* o, const PaintInfo& paintInf
void RenderThemeMac::adjustSliderThumbStyle(CSSStyleSelector*, RenderStyle* style, Element*) const
{
style->setBoxShadow(PassOwnPtr<ShadowData>());
style->setBoxShadow(nullptr);
}
const float verticalSliderHeightPadding = 0.1f;
......@@ -1443,7 +1443,7 @@ void RenderThemeMac::adjustSearchFieldStyle(CSSStyleSelector* selector, RenderSt
NSControlSize controlSize = controlSizeForFont(style);
setFontFromControlSize(selector, style, controlSize);
style->setBoxShadow(PassOwnPtr<ShadowData>());
style->setBoxShadow(nullptr);
}
bool RenderThemeMac::paintSearchFieldCancelButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r)
......@@ -1502,7 +1502,7 @@ void RenderThemeMac::adjustSearchFieldCancelButtonStyle(CSSStyleSelector*, Rende
IntSize size = sizeForSystemFont(style, cancelButtonSizes());
style->setWidth(Length(size.width(), Fixed));
style->setHeight(Length(size.height(), Fixed));
style->setBoxShadow(PassOwnPtr<ShadowData>());
style->setBoxShadow(nullptr);
}
const IntSize* RenderThemeMac::resultsButtonSizes() const
......@@ -1517,7 +1517,7 @@ void RenderThemeMac::adjustSearchFieldDecorationStyle(CSSStyleSelector*, RenderS
IntSize size = sizeForSystemFont(style, resultsButtonSizes());
style->setWidth(Length(size.width() - emptyResultsOffset, Fixed));
style->setHeight(Length(size.height(), Fixed));
style->setBoxShadow(PassOwnPtr<ShadowData>());
style->setBoxShadow(nullptr);
}
bool RenderThemeMac::paintSearchFieldDecoration(RenderObject*, const PaintInfo&, const IntRect&)
......@@ -1530,7 +1530,7 @@ void RenderThemeMac::adjustSearchFieldResultsDecorationStyle(CSSStyleSelector*,
IntSize size = sizeForSystemFont(style, resultsButtonSizes());
style->setWidth(Length(size.width(), Fixed));
style->setHeight(Length(size.height(), Fixed));
style->setBoxShadow(PassOwnPtr<ShadowData>());
style->setBoxShadow(nullptr);
}
bool RenderThemeMac::paintSearchFieldResultsDecoration(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r)
......@@ -1563,7 +1563,7 @@ void RenderThemeMac::adjustSearchFieldResultsButtonStyle(CSSStyleSelector*, Rend
IntSize size = sizeForSystemFont(style, resultsButtonSizes());
style->setWidth(Length(size.width() + resultsArrowWidth, Fixed));
style->setHeight(Length(size.height(), Fixed));
style->setBoxShadow(PassOwnPtr<ShadowData>());
style->setBoxShadow(nullptr);
}
bool RenderThemeMac::paintSearchFieldResultsButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r)
......
......@@ -1102,8 +1102,8 @@ public:
rareNonInheritedData.access()->m_transitions.clear();
}
void inheritAnimations(const AnimationList* parent) { rareNonInheritedData.access()->m_animations = parent ? adoptPtr(new AnimationList(*parent)) : PassOwnPtr<AnimationList>(); }
void inheritTransitions(const AnimationList* parent) { rareNonInheritedData.access()->m_transitions = parent ? adoptPtr(new AnimationList(*parent)) : PassOwnPtr<AnimationList>(); }
void inheritAnimations(const AnimationList* parent) { rareNonInheritedData.access()->m_animations = parent ? adoptPtr(new AnimationList(*parent)) : nullptr; }
void inheritTransitions(const AnimationList* parent) { rareNonInheritedData.access()->m_transitions = parent ? adoptPtr(new AnimationList(*parent)) : nullptr; }
void adjustAnimations();
void adjustTransitions();
......
......@@ -163,7 +163,7 @@ StyleShadowSVGData::StyleShadowSVGData()
StyleShadowSVGData::StyleShadowSVGData(const StyleShadowSVGData& other)
: RefCounted<StyleShadowSVGData>()
, shadow(other.shadow ? adoptPtr(new ShadowData(*other.shadow)) : PassOwnPtr<ShadowData>())
, shadow(other.shadow ? adoptPtr(new ShadowData(*other.shadow)) : nullptr)
{
}
......
......@@ -37,7 +37,7 @@ ShadowData::ShadowData(const ShadowData& o)
, m_color(o.m_color)
, m_style(o.m_style)
, m_isWebkitBoxShadow(o.m_isWebkitBoxShadow)
, m_next(o.m_next ? adoptPtr(new ShadowData(*o.m_next)) : PassOwnPtr<ShadowData>())
, m_next(o.m_next ? adoptPtr(new ShadowData(*o.m_next)) : nullptr)
{
}
......
......@@ -63,7 +63,7 @@ StyleRareInheritedData::StyleRareInheritedData(const StyleRareInheritedData& o)
, textStrokeWidth(o.textStrokeWidth)
, textFillColor(o.textFillColor)
, textEmphasisColor(o.textEmphasisColor)
, textShadow(o.textShadow ? adoptPtr(new ShadowData(*o.textShadow)) : PassOwnPtr<ShadowData>())
, textShadow(o.textShadow ? adoptPtr(new ShadowData(*o.textShadow)) : nullptr)
, highlight(o.highlight)
, cursorData(o.cursorData)
, indent(o.indent)
......
......@@ -79,10 +79,10 @@ StyleRareNonInheritedData::StyleRareNonInheritedData(const StyleRareNonInherited
#if USE(ACCELERATED_COMPOSITING)
, m_runningAcceleratedAnimation(o.m_runningAcceleratedAnimation)
#endif
, m_boxShadow(o.m_boxShadow ? adoptPtr(new ShadowData(*o.m_boxShadow)) : PassOwnPtr<ShadowData>())
, m_boxShadow(o.m_boxShadow ? adoptPtr(new ShadowData(*o.m_boxShadow)) : nullptr)
, m_boxReflect(o.m_boxReflect)
, m_animations(o.m_animations ? adoptPtr(new AnimationList(*o.m_animations)) : PassOwnPtr<AnimationList>())
, m_transitions(o.m_transitions ? adoptPtr(new AnimationList(*o.m_transitions)) : PassOwnPtr<AnimationList>())
, m_animations(o.m_animations ? adoptPtr(new AnimationList(*o.m_animations)) : nullptr)
, m_transitions(o.m_transitions ? adoptPtr(new AnimationList(*o.m_transitions)) : nullptr)
, m_mask(o.m_mask)
, m_maskBoxImage(o.m_maskBoxImage)
, m_transformStyle3D(o.m_transformStyle3D)
......
......@@ -260,7 +260,7 @@ PassOwnPtr<ImageBuffer> RenderSVGResourcePattern::createTileImage(RenderObject*
OwnPtr<ImageBuffer> tileImage;
if (!SVGImageBufferTools::createImageBuffer(absoluteTileBoundaries, clampedAbsoluteTileBoundaries, tileImage, ColorSpaceDeviceRGB))
return PassOwnPtr<ImageBuffer>();
return nullptr;
GraphicsContext* tileImageContext = tileImage->context();
ASSERT(tileImageContext);
......
2011-05-02 Adam Roben <aroben@apple.com>
Take advantage of implicit conversion from nullptr_t to PassOwnPtr
Fixes <http://webkit.org/b/59964> Implicit conversion from std::nullptr_t to PassOwnPtr
doesn't work, but should
Reviewed by Adam Barth.
* src/WebMediaPlayerClientImpl.cpp:
2011-05-03 Pavel Feldman <pfeldman@google.com>
Not reviewed: re-applied r85589.
......
......@@ -56,7 +56,7 @@ static PassOwnPtr<WebMediaPlayer> createWebMediaPlayer(WebMediaPlayerClient* cli
WebFrameImpl* webFrame = WebFrameImpl::fromFrame(frame);
if (!webFrame->client())
return PassOwnPtr<WebMediaPlayer>();
return nullptr;
return adoptPtr(webFrame->client()->createMediaPlayer(webFrame, client));
}
......
2011-05-02 Adam Roben <aroben@apple.com>
Take advantage of implicit conversion from nullptr_t to PassOwnPtr
Fixes <http://webkit.org/b/59964> Implicit conversion from std::nullptr_t to PassOwnPtr
doesn't work, but should
Reviewed by Adam Barth.
* History/WebHistory.mm:
* Plugins/WebNetscapePluginEventHandler.mm:
* WebView/WebView.mm:
2011-05-02 Brady Eidson <beidson@apple.com>
Reviewed by Anders Carlsson.
......
......@@ -826,7 +826,7 @@ static inline WebHistoryDateKey dateKey(NSTimeInterval date)
if ([method length])
item->setLastVisitWasHTTPNonGet([method caseInsensitiveCompare:@"GET"] && (![[url scheme] caseInsensitiveCompare:@"http"] || ![[url scheme] caseInsensitiveCompare:@"https"]));
item->setRedirectURLs(PassOwnPtr<Vector<String> >());
item->setRedirectURLs(nullptr);
NSArray *entries = [[NSArray alloc] initWithObjects:entry, nil];
[self _sendNotification:WebHistoryItemsAddedNotification entries:entries];
......
......@@ -44,7 +44,7 @@ PassOwnPtr<WebNetscapePluginEventHandler> WebNetscapePluginEventHandler::create(
return adoptPtr(new WebNetscapePluginEventHandlerCocoa(pluginView));
default:
ASSERT_NOT_REACHED();
return PassOwnPtr<WebNetscapePluginEventHandler>();
return nullptr;
}
}
......
......@@ -642,7 +642,7 @@ static NSString *leakMailQuirksUserScriptContents()
{
static NSString *mailQuirksScriptContents = leakMailQuirksUserScriptContents();
core(self)->group().addUserScriptToWorld(core([WebScriptWorld world]),
mailQuirksScriptContents, KURL(), PassOwnPtr<Vector<String> >(), PassOwnPtr<Vector<String> >(), InjectAtDocumentEnd, InjectInAllFrames);
mailQuirksScriptContents, KURL(), nullptr, nullptr, InjectAtDocumentEnd, InjectInAllFrames);
}
static bool needsOutlookQuirksScript()
......@@ -663,7 +663,7 @@ static NSString *leakOutlookQuirksUserScriptContents()
{
static NSString *outlookQuirksScriptContents = leakOutlookQuirksUserScriptContents();
core(self)->group().addUserScriptToWorld(core([WebScriptWorld world]),
outlookQuirksScriptContents, KURL(), PassOwnPtr<Vector<String> >(), PassOwnPtr<Vector<String> >(), InjectAtDocumentEnd, InjectInAllFrames);
outlookQuirksScriptContents, KURL(), nullptr, nullptr, InjectAtDocumentEnd, InjectInAllFrames);
}
- (void)_commonInitializationWithFrameName:(NSString *)frameName groupName:(NSString *)groupName usesDocumentViews:(BOOL)usesDocumentViews
......@@ -2580,7 +2580,7 @@ static PassOwnPtr<Vector<String> > toStringVector(NSArray* patterns)
// Convert the patterns into Vectors.
NSUInteger count = [patterns count];
if (count == 0)
return PassOwnPtr<Vector<String> >();
return nullptr;
OwnPtr<Vector<String> > patternsVector = adoptPtr(new Vector<String>);
for (NSUInteger i = 0; i < count; ++i) {
id entry = [patterns objectAtIndex:i];
......