+2015-04-24 Darin Adler <darin@apple.com>
+
+ Convert OwnPtr and PassOwnPtr uses to std::unique_ptr
+ https://bugs.webkit.org/show_bug.cgi?id=128007
+
+ Reviewed by Anders Carlsson.
+
+ * WTF.vcxproj/WTF.vcxproj: Removed OwnPtr source files.
+ * WTF.vcxproj/WTF.vcxproj.filters: Ditto.
+ * WTF.xcodeproj/project.pbxproj: Ditto.
+ * wtf/CMakeLists.txt: Ditto.
+
+ * wtf/Forward.h: Removed OwnPtr and PassOwnPtr.
+ * wtf/HashTraits.h: Ditto.
+
+ * wtf/OwnPtr.h: Removed.
+ * wtf/OwnPtrCommon.h: Removed.
+ * wtf/PassOwnPtr.h: Removed.
+
+ * wtf/SizeLimits.cpp: Removed OwnPtr.
+ * wtf/VectorTraits.h: Removed OwnPtr specialization.
+
2015-04-23 Jer Noble <jer.noble@apple.com>
Disable HAVE_AVKIT on AppleTV
<ClInclude Include="..\wtf\Noncopyable.h" />
<ClInclude Include="..\wtf\NumberOfCores.h" />
<ClInclude Include="..\wtf\OSRandomSource.h" />
- <ClInclude Include="..\wtf\OwnPtr.h" />
- <ClInclude Include="..\wtf\OwnPtrCommon.h" />
<ClInclude Include="..\wtf\PackedIntVector.h" />
<ClInclude Include="..\wtf\PageAllocation.h" />
<ClInclude Include="..\wtf\PageBlock.h" />
<ClInclude Include="..\wtf\ParallelJobsGeneric.h" />
<ClInclude Include="..\wtf\ParallelJobsLibdispatch.h" />
<ClInclude Include="..\wtf\ParallelJobsOpenMP.h" />
- <ClInclude Include="..\wtf\PassOwnPtr.h" />
<ClInclude Include="..\wtf\PassRefPtr.h" />
<ClInclude Include="..\wtf\Platform.h" />
<ClInclude Include="..\wtf\PrintStream.h" />
<ClInclude Include="..\wtf\OSRandomSource.h">
<Filter>wtf</Filter>
</ClInclude>
- <ClInclude Include="..\wtf\OwnPtr.h">
- <Filter>wtf</Filter>
- </ClInclude>
- <ClInclude Include="..\wtf\OwnPtrCommon.h">
- <Filter>wtf</Filter>
- </ClInclude>
<ClInclude Include="..\wtf\PackedIntVector.h">
<Filter>wtf</Filter>
</ClInclude>
<ClInclude Include="..\wtf\ParallelJobsOpenMP.h">
<Filter>wtf</Filter>
</ClInclude>
- <ClInclude Include="..\wtf\PassOwnPtr.h">
- <Filter>wtf</Filter>
- </ClInclude>
<ClInclude Include="..\wtf\PassRefPtr.h">
<Filter>wtf</Filter>
</ClInclude>
A8A473F7151A825B004123FF /* OSAllocatorPosix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A472D8151A825B004123FF /* OSAllocatorPosix.cpp */; };
A8A473F9151A825B004123FF /* OSRandomSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A472DA151A825B004123FF /* OSRandomSource.cpp */; };
A8A473FA151A825B004123FF /* OSRandomSource.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472DB151A825B004123FF /* OSRandomSource.h */; };
- A8A473FC151A825B004123FF /* OwnPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472DD151A825B004123FF /* OwnPtr.h */; };
- A8A473FD151A825B004123FF /* OwnPtrCommon.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472DE151A825B004123FF /* OwnPtrCommon.h */; };
A8A473FE151A825B004123FF /* PackedIntVector.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472DF151A825B004123FF /* PackedIntVector.h */; };
A8A473FF151A825B004123FF /* PageAllocation.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472E0151A825B004123FF /* PageAllocation.h */; };
A8A47402151A825B004123FF /* PageBlock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A472E3151A825B004123FF /* PageBlock.cpp */; };
A8A47404151A825B004123FF /* PageReservation.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472E5151A825B004123FF /* PageReservation.h */; };
A8A47405151A825B004123FF /* ParallelJobs.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472E6151A825B004123FF /* ParallelJobs.h */; };
A8A47408151A825B004123FF /* ParallelJobsLibdispatch.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472E9151A825B004123FF /* ParallelJobsLibdispatch.h */; };
- A8A4740B151A825B004123FF /* PassOwnPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472EC151A825B004123FF /* PassOwnPtr.h */; };
A8A4740C151A825B004123FF /* PassRefPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472ED151A825B004123FF /* PassRefPtr.h */; };
A8A47414151A825B004123FF /* RandomNumber.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A472FB151A825B004123FF /* RandomNumber.cpp */; };
A8A47415151A825B004123FF /* RandomNumber.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472FC151A825B004123FF /* RandomNumber.h */; };
A8A472D8151A825B004123FF /* OSAllocatorPosix.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OSAllocatorPosix.cpp; sourceTree = "<group>"; };
A8A472DA151A825B004123FF /* OSRandomSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OSRandomSource.cpp; sourceTree = "<group>"; };
A8A472DB151A825B004123FF /* OSRandomSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OSRandomSource.h; sourceTree = "<group>"; };
- A8A472DD151A825B004123FF /* OwnPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OwnPtr.h; sourceTree = "<group>"; };
- A8A472DE151A825B004123FF /* OwnPtrCommon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OwnPtrCommon.h; sourceTree = "<group>"; };
A8A472DF151A825B004123FF /* PackedIntVector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PackedIntVector.h; sourceTree = "<group>"; };
A8A472E0151A825B004123FF /* PageAllocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageAllocation.h; sourceTree = "<group>"; };
A8A472E3151A825B004123FF /* PageBlock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageBlock.cpp; sourceTree = "<group>"; };
A8A472E5151A825B004123FF /* PageReservation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageReservation.h; sourceTree = "<group>"; };
A8A472E6151A825B004123FF /* ParallelJobs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ParallelJobs.h; sourceTree = "<group>"; };
A8A472E9151A825B004123FF /* ParallelJobsLibdispatch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ParallelJobsLibdispatch.h; sourceTree = "<group>"; };
- A8A472EC151A825B004123FF /* PassOwnPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PassOwnPtr.h; sourceTree = "<group>"; };
A8A472ED151A825B004123FF /* PassRefPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PassRefPtr.h; sourceTree = "<group>"; };
A8A472FB151A825B004123FF /* RandomNumber.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RandomNumber.cpp; sourceTree = "<group>"; };
A8A472FC151A825B004123FF /* RandomNumber.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RandomNumber.h; sourceTree = "<group>"; };
A8A472DA151A825B004123FF /* OSRandomSource.cpp */,
A8A472DB151A825B004123FF /* OSRandomSource.h */,
1AFDE6521953B23D00C48FFA /* Optional.h */,
- A8A472DD151A825B004123FF /* OwnPtr.h */,
- A8A472DE151A825B004123FF /* OwnPtrCommon.h */,
A8A472DF151A825B004123FF /* PackedIntVector.h */,
A8A472E0151A825B004123FF /* PageAllocation.h */,
A8A472E3151A825B004123FF /* PageBlock.cpp */,
A8A472E5151A825B004123FF /* PageReservation.h */,
A8A472E6151A825B004123FF /* ParallelJobs.h */,
A8A472E9151A825B004123FF /* ParallelJobsLibdispatch.h */,
- A8A472EC151A825B004123FF /* PassOwnPtr.h */,
A8A472ED151A825B004123FF /* PassRefPtr.h */,
A876DBD7151816E500DADB95 /* Platform.h */,
0F9D335D165DBA73005AD387 /* PrintStream.cpp */,
7E29C33E15FFD79B00516D61 /* ObjcRuntimeExtras.h in Headers */,
A8A473F6151A825B004123FF /* OSAllocator.h in Headers */,
A8A473FA151A825B004123FF /* OSRandomSource.h in Headers */,
- A8A473FC151A825B004123FF /* OwnPtr.h in Headers */,
- A8A473FD151A825B004123FF /* OwnPtrCommon.h in Headers */,
0FB14E1B1810E1DC009B6B4D /* BagToHashMap.h in Headers */,
A8A473FE151A825B004123FF /* PackedIntVector.h in Headers */,
A8A473FF151A825B004123FF /* PageAllocation.h in Headers */,
A8A47404151A825B004123FF /* PageReservation.h in Headers */,
A8A47405151A825B004123FF /* ParallelJobs.h in Headers */,
A8A47408151A825B004123FF /* ParallelJobsLibdispatch.h in Headers */,
- A8A4740B151A825B004123FF /* PassOwnPtr.h in Headers */,
A8A4740C151A825B004123FF /* PassRefPtr.h in Headers */,
A876DBD8151816E500DADB95 /* Platform.h in Headers */,
0FB14E19180FA218009B6B4D /* Bag.h in Headers */,
NumberOfCores.h
OSAllocator.h
OSRandomSource.h
- OwnPtr.h
- OwnPtrCommon.h
PageAllocation.h
PageBlock.h
PageReservation.h
ParallelJobsGeneric.h
ParallelJobsLibdispatch.h
ParallelJobsOpenMP.h
- PassOwnPtr.h
PassRefPtr.h
Platform.h
PrintStream.h
template<typename T> class Function;
template<typename T> class LazyNeverDestroyed;
template<typename T> class NeverDestroyed;
-template<typename T> class OwnPtr;
-template<typename T> class PassOwnPtr;
template<typename T> class PassRefPtr;
template<typename T> class RefPtr;
template<typename T> class Ref;
using WTF::LazyNeverDestroyed;
using WTF::NeverDestroyed;
using WTF::OrdinalNumber;
-using WTF::OwnPtr;
-using WTF::PassOwnPtr;
using WTF::PassRefPtr;
using WTF::PrintStream;
using WTF::Ref;
class String;
-template<typename T> class OwnPtr;
-
template<typename T> struct HashTraits;
template<bool isInteger, typename T> struct GenericHashTraitsBase;
static T* peek(std::nullptr_t) { return nullptr; }
};
-template<typename T> struct HashTraits<OwnPtr<T>> : SimpleClassHashTraits<OwnPtr<T>> {
- typedef std::nullptr_t EmptyValueType;
- static EmptyValueType emptyValue() { return nullptr; }
-
- typedef T* PeekType;
- static T* peek(const OwnPtr<T>& value) { return value.get(); }
- static T* peek(std::nullptr_t) { return nullptr; }
-};
-
template<typename P> struct HashTraits<RefPtr<P>> : SimpleClassHashTraits<RefPtr<P>> {
- static P* emptyValue() { return 0; }
+ static P* emptyValue() { return nullptr; }
typedef P* PeekType;
static PeekType peek(const RefPtr<P>& value) { return value.get(); }
+++ /dev/null
-/*
- * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2014 Apple Inc. All rights reserved.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef WTF_OwnPtr_h
-#define WTF_OwnPtr_h
-
-#include <algorithm>
-#include <cstddef>
-#include <memory>
-#include <wtf/Assertions.h>
-#include <wtf/Atomics.h>
-#include <wtf/GetPtr.h>
-#include <wtf/HashTraits.h>
-#include <wtf/Noncopyable.h>
-#include <wtf/OwnPtrCommon.h>
-
-namespace WTF {
-
- template<typename T> class PassOwnPtr;
- template<typename T> PassOwnPtr<T> adoptPtr(T*);
-
- template<typename T> class OwnPtr {
- public:
- typedef T ValueType;
- typedef ValueType* PtrType;
-
- OwnPtr() : m_ptr(0) { }
- OwnPtr(std::nullptr_t) : m_ptr(0) { }
-
- // See comment in PassOwnPtr.h for why this takes a const reference.
- template<typename U> OwnPtr(const PassOwnPtr<U>& o);
-
- ~OwnPtr() { deleteOwnedPtr(m_ptr); }
-
- PtrType get() const { return m_ptr; }
-
- void clear();
- PassOwnPtr<T> release();
- PtrType leakPtr() WARN_UNUSED_RETURN;
-
- ValueType& operator*() const { ASSERT(m_ptr); return *m_ptr; }
- PtrType operator->() const { ASSERT(m_ptr); return m_ptr; }
-
- bool operator!() const { return !m_ptr; }
-
- // This conversion operator allows implicit conversion to bool but not to other integer types.
- typedef PtrType OwnPtr::*UnspecifiedBoolType;
- operator UnspecifiedBoolType() const { return m_ptr ? &OwnPtr::m_ptr : 0; }
-
- OwnPtr& operator=(const PassOwnPtr<T>&);
- OwnPtr& operator=(std::nullptr_t) { clear(); return *this; }
- template<typename U> OwnPtr& operator=(const PassOwnPtr<U>&);
-
- OwnPtr(OwnPtr&&);
- template<typename U> OwnPtr(OwnPtr<U>&&);
-
- OwnPtr& operator=(OwnPtr&&);
- template<typename U> OwnPtr& operator=(OwnPtr<U>&&);
-
- // Hash table deleted values, which are only constructed and never copied or destroyed.
- OwnPtr(HashTableDeletedValueType) : m_ptr(hashTableDeletedValue()) { }
- bool isHashTableDeletedValue() const { return m_ptr == hashTableDeletedValue(); }
-
- void swap(OwnPtr& o) { std::swap(m_ptr, o.m_ptr); }
-
- // Construct an object to store into this OwnPtr, but only so long as this OwnPtr
- // doesn't already point to an object. This will ensure that after you call this,
- // the OwnPtr will point to an instance of T, even if called concurrently. This
- // instance may or may not have been created by this call. Moreover, this call uses
- // an opportunistic transaction, in that we may create an instance of T and then
- // immediately throw it away, if in the process of creating that instance some
- // other thread was doing the same thing and stored its instance into this pointer
- // before we had a chance to do so.
- template<typename... Args>
- void createTransactionally(Args...);
-
- private:
- explicit OwnPtr(PtrType ptr) : m_ptr(ptr) { }
-
- static PtrType hashTableDeletedValue() { return reinterpret_cast<PtrType>(-1); }
-
- // We should never have two OwnPtrs for the same underlying object (otherwise we'll get
- // double-destruction), so these equality operators should never be needed.
- template<typename U> bool operator==(const OwnPtr<U>&) { COMPILE_ASSERT(!sizeof(U*), OwnPtrs_should_never_be_equal); return false; }
- template<typename U> bool operator!=(const OwnPtr<U>&) { COMPILE_ASSERT(!sizeof(U*), OwnPtrs_should_never_be_equal); return false; }
- template<typename U> bool operator==(const PassOwnPtr<U>&) { COMPILE_ASSERT(!sizeof(U*), OwnPtrs_should_never_be_equal); return false; }
- template<typename U> bool operator!=(const PassOwnPtr<U>&) { COMPILE_ASSERT(!sizeof(U*), OwnPtrs_should_never_be_equal); return false; }
-
- PtrType m_ptr;
- };
-
- template<typename T> template<typename U> inline OwnPtr<T>::OwnPtr(const PassOwnPtr<U>& o)
- : m_ptr(o.leakPtr())
- {
- }
-
- template<typename T> inline void OwnPtr<T>::clear()
- {
- deleteOwnedPtr(std::exchange(m_ptr, nullptr));
- }
-
- template<typename T> inline PassOwnPtr<T> OwnPtr<T>::release()
- {
- return adoptPtr(std::exchange(m_ptr, nullptr));
- }
-
- template<typename T> inline typename OwnPtr<T>::PtrType OwnPtr<T>::leakPtr()
- {
- return std::exchange(m_ptr, nullptr);
- }
-
- template<typename T> inline OwnPtr<T>& OwnPtr<T>::operator=(const PassOwnPtr<T>& o)
- {
- PtrType ptr = std::exchange(m_ptr, o.leakPtr());
- ASSERT(!ptr || m_ptr != ptr);
- deleteOwnedPtr(ptr);
- return *this;
- }
-
- template<typename T> template<typename U> inline OwnPtr<T>& OwnPtr<T>::operator=(const PassOwnPtr<U>& o)
- {
- PtrType ptr = std::exchange(m_ptr, o.leakPtr());
- ASSERT(!ptr || m_ptr != ptr);
- deleteOwnedPtr(ptr);
- return *this;
- }
-
- template<typename T> inline OwnPtr<T>::OwnPtr(OwnPtr<T>&& o)
- : m_ptr(o.leakPtr())
- {
- }
-
- template<typename T> template<typename U> inline OwnPtr<T>::OwnPtr(OwnPtr<U>&& o)
- : m_ptr(o.leakPtr())
- {
- }
-
- template<typename T> inline auto OwnPtr<T>::operator=(OwnPtr&& o) -> OwnPtr&
- {
- ASSERT(!o || o != m_ptr);
- OwnPtr ptr = WTF::move(o);
- swap(ptr);
- return *this;
- }
-
- template<typename T> template<typename U> inline auto OwnPtr<T>::operator=(OwnPtr<U>&& o) -> OwnPtr&
- {
- ASSERT(!o || o != m_ptr);
- OwnPtr ptr = WTF::move(o);
- swap(ptr);
- return *this;
- }
-
- template<typename T> inline void swap(OwnPtr<T>& a, OwnPtr<T>& b)
- {
- a.swap(b);
- }
-
- template<typename T, typename U> inline bool operator==(const OwnPtr<T>& a, U* b)
- {
- return a.get() == b;
- }
-
- template<typename T, typename U> inline bool operator==(T* a, const OwnPtr<U>& b)
- {
- return a == b.get();
- }
-
- template<typename T, typename U> inline bool operator!=(const OwnPtr<T>& a, U* b)
- {
- return a.get() != b;
- }
-
- template<typename T, typename U> inline bool operator!=(T* a, const OwnPtr<U>& b)
- {
- return a != b.get();
- }
-
- template<typename T> template<typename... Args> inline void OwnPtr<T>::createTransactionally(Args... args)
- {
- if (m_ptr) {
- WTF::loadLoadFence();
- return;
- }
-
- T* newObject = new T(args...);
- WTF::storeStoreFence();
-#if ENABLE(COMPARE_AND_SWAP)
- do {
- if (m_ptr) {
- delete newObject;
- WTF::loadLoadFence();
- return;
- }
- } while (!WTF::weakCompareAndSwap(bitwise_cast<void*volatile*>(&m_ptr), nullptr, newObject));
-#else
- m_ptr = newObject;
-#endif
- }
-
- template <typename T> struct IsSmartPtr<OwnPtr<T>> {
- static const bool value = true;
- };
-
- template<typename P> struct DefaultHash<OwnPtr<P>> {
- typedef PtrHash<OwnPtr<P>> Hash;
- };
-
-} // namespace WTF
-
-using WTF::OwnPtr;
-
-#endif // WTF_OwnPtr_h
+++ /dev/null
-/*
- * Copyright (C) 2009, 2013 Apple Inc. All rights reserved.
- * Copyright (C) 2009 Torch Mobile, Inc.
- * Copyright (C) 2010 Company 100 Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef WTF_OwnPtrCommon_h
-#define WTF_OwnPtrCommon_h
-
-namespace WTF {
-
- template <typename T> inline void deleteOwnedPtr(T* ptr)
- {
- typedef char known[sizeof(T) ? 1 : -1];
- if (sizeof(known))
- delete ptr;
- }
-
-} // namespace WTF
-
-#endif // WTF_OwnPtrCommon_h
+++ /dev/null
-/*
- * Copyright (C) 2009, 2010 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef WTF_PassOwnPtr_h
-#define WTF_PassOwnPtr_h
-
-#include <cstddef>
-#include <wtf/Assertions.h>
-#include <wtf/GetPtr.h>
-#include <wtf/OwnPtrCommon.h>
-#include <type_traits>
-
-namespace WTF {
-
- template<typename T> class OwnPtr;
- template<typename T> class PassOwnPtr;
- template<typename T> PassOwnPtr<T> adoptPtr(T*);
-
- class RefCountedBase;
- class ThreadSafeRefCountedBase;
-
- template<typename T> class PassOwnPtr {
- public:
- typedef T ValueType;
- 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
- // temporaries, and we don't have a need to use real const PassOwnPtrs anyway.
- PassOwnPtr(const PassOwnPtr& o) : m_ptr(o.leakPtr()) { }
- template<typename U> PassOwnPtr(const PassOwnPtr<U>& o) : m_ptr(o.leakPtr()) { }
-
- ~PassOwnPtr() { deleteOwnedPtr(m_ptr); }
-
- PtrType get() const { return m_ptr; }
-
- PtrType leakPtr() const WARN_UNUSED_RETURN;
-
- ValueType& operator*() const { ASSERT(m_ptr); return *m_ptr; }
- PtrType operator->() const { ASSERT(m_ptr); return m_ptr; }
-
- bool operator!() const { return !m_ptr; }
-
- // This conversion operator allows implicit conversion to bool but not to other integer types.
- typedef PtrType PassOwnPtr::*UnspecifiedBoolType;
- operator UnspecifiedBoolType() const { return m_ptr ? &PassOwnPtr::m_ptr : 0; }
-
- PassOwnPtr& operator=(const PassOwnPtr&) { COMPILE_ASSERT(!sizeof(T*), PassOwnPtr_should_never_be_assigned_to); return *this; }
-
- template<typename U> friend PassOwnPtr<U> adoptPtr(U*);
-
- private:
- explicit PassOwnPtr(PtrType ptr) : m_ptr(ptr) { }
-
- // We should never have two OwnPtrs for the same underlying object (otherwise we'll get
- // double-destruction), so these equality operators should never be needed.
- template<typename U> bool operator==(const PassOwnPtr<U>&) { COMPILE_ASSERT(!sizeof(U*), OwnPtrs_should_never_be_equal); return false; }
- template<typename U> bool operator!=(const PassOwnPtr<U>&) { COMPILE_ASSERT(!sizeof(U*), OwnPtrs_should_never_be_equal); return false; }
- template<typename U> bool operator==(const OwnPtr<U>&) { COMPILE_ASSERT(!sizeof(U*), OwnPtrs_should_never_be_equal); return false; }
- template<typename U> bool operator!=(const OwnPtr<U>&) { COMPILE_ASSERT(!sizeof(U*), OwnPtrs_should_never_be_equal); return false; }
-
- mutable PtrType m_ptr;
- };
-
- template<typename T> inline typename PassOwnPtr<T>::PtrType PassOwnPtr<T>::leakPtr() const
- {
- return std::exchange(m_ptr, nullptr);
- }
-
- template<typename T, typename U> inline bool operator==(const PassOwnPtr<T>& a, const PassOwnPtr<U>& b)
- {
- return a.get() == b.get();
- }
-
- template<typename T, typename U> inline bool operator==(const PassOwnPtr<T>& a, const OwnPtr<U>& b)
- {
- return a.get() == b.get();
- }
-
- template<typename T, typename U> inline bool operator==(const OwnPtr<T>& a, const PassOwnPtr<U>& b)
- {
- return a.get() == b.get();
- }
-
- template<typename T, typename U> inline bool operator==(const PassOwnPtr<T>& a, U* b)
- {
- return a.get() == b;
- }
-
- template<typename T, typename U> inline bool operator==(T* a, const PassOwnPtr<U>& b)
- {
- return a == b.get();
- }
-
- template<typename T, typename U> inline bool operator!=(const PassOwnPtr<T>& a, const PassOwnPtr<U>& b)
- {
- return a.get() != b.get();
- }
-
- template<typename T, typename U> inline bool operator!=(const PassOwnPtr<T>& a, const OwnPtr<U>& b)
- {
- return a.get() != b.get();
- }
-
- template<typename T, typename U> inline bool operator!=(const OwnPtr<T>& a, const PassOwnPtr<U>& b)
- {
- return a.get() != b.get();
- }
-
- template<typename T, typename U> inline bool operator!=(const PassOwnPtr<T>& a, U* b)
- {
- return a.get() != b;
- }
-
- template<typename T, typename U> inline bool operator!=(T* a, const PassOwnPtr<U>& b)
- {
- return a != b.get();
- }
-
- template<typename T> inline PassOwnPtr<T> adoptPtr(T* ptr)
- {
- static_assert(!std::is_convertible<T*, RefCountedBase*>::value, "Do not use adoptPtr with RefCounted, use adoptRef!");
- static_assert(!std::is_convertible<T*, ThreadSafeRefCountedBase*>::value, "Do not use adoptPtr with ThreadSafeRefCounted, use adoptRef!");
-
- return PassOwnPtr<T>(ptr);
- }
-
- template<typename T, typename U> inline PassOwnPtr<T> static_pointer_cast(const PassOwnPtr<U>& p)
- {
- return adoptPtr(static_cast<T*>(p.leakPtr()));
- }
-
- template <typename T> struct IsSmartPtr<PassOwnPtr<T>> {
- static const bool value = true;
- };
-
-} // namespace WTF
-
-using WTF::PassOwnPtr;
-using WTF::adoptPtr;
-using WTF::static_pointer_cast;
-
-#endif // WTF_PassOwnPtr_h
#include <type_traits>
#include <utility>
#include <wtf/Assertions.h>
-#include <wtf/OwnPtr.h>
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
};
#endif
-static_assert(sizeof(OwnPtr<int>) == sizeof(int*), "OwnPtr should stay small!");
static_assert(sizeof(PassRefPtr<RefCounted<int>>) == sizeof(int*), "PassRefPtr should stay small!");
static_assert(sizeof(RefCounted<int>) == sizeof(SameSizeAsRefCounted), "RefCounted should stay small!");
static_assert(sizeof(RefPtr<RefCounted<int>>) == sizeof(int*), "RefPtr should stay small!");
#ifndef WTF_VectorTraits_h
#define WTF_VectorTraits_h
-#include <wtf/OwnPtr.h>
#include <wtf/Ref.h>
#include <wtf/RefPtr.h>
#include <utility>
static const bool canCompareWithMemcmp = true;
};
- // We know OwnPtr and RefPtr are simple enough that initializing to 0 and moving with memcpy
- // (and then not destructing the original) will totally work
- template<typename P>
- struct VectorTraits<RefPtr<P>> : SimpleClassVectorTraits { };
+ // We know smart pointers are simple enough that initializing to 0 and moving with memcpy
+ // (and then not destructing the original) will work.
- template<typename P>
- struct VectorTraits<OwnPtr<P>> : SimpleClassVectorTraits { };
-
- template<typename P>
- struct VectorTraits<std::unique_ptr<P>> : SimpleClassVectorTraits { };
-
- template<typename P>
- struct VectorTraits<Ref<P>> : SimpleClassVectorTraits { };
-
- template<>
- struct VectorTraits<AtomicString> : SimpleClassVectorTraits { };
+ template<typename P> struct VectorTraits<RefPtr<P>> : SimpleClassVectorTraits { };
+ template<typename P> struct VectorTraits<std::unique_ptr<P>> : SimpleClassVectorTraits { };
+ template<typename P> struct VectorTraits<Ref<P>> : SimpleClassVectorTraits { };
+ template<> struct VectorTraits<AtomicString> : SimpleClassVectorTraits { };
template<typename First, typename Second>
struct VectorTraits<std::pair<First, Second>>
+2015-04-24 Darin Adler <darin@apple.com>
+
+ Convert OwnPtr and PassOwnPtr uses to std::unique_ptr
+ https://bugs.webkit.org/show_bug.cgi?id=128007
+
+ Reviewed by Anders Carlsson.
+
+ * PlatformEfl.cmake: Removed OwnPtrCairo source files.
+ * PlatformGTK.cmake: Ditto.
+ * PlatformWinCairo.cmake: Ditto.
+ * WebCore.vcxproj/WebCore.vcxproj: Ditto.
+ * WebCore.vcxproj/WebCore.vcxproj.filters: Ditto.
+
+ * platform/CrossThreadCopier.cpp: Removed OwnPtr specialization.
+ * platform/CrossThreadCopier.h: Ditto.
+
+ * platform/ScrollAnimatorNone.cpp: Removed unneeded include.
+ * platform/ThreadGlobalData.cpp: Ditto.
+ * platform/ThreadGlobalData.h: Ditto.
+ * platform/graphics/avfoundation/cf/CDMSessionAVFoundationCF.h: Ditto.
+
+ * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
+ (WebCore::AVFWrapper::processNotification): Use unique_ptr.
+ (WebCore::AVFWrapper::notificationCallback): Use make_unique.
+ (WebCore::AVFWrapper::platformLayer): Ditto.
+
+ * platform/graphics/cairo/CairoUtilities.cpp:
+ (WebCore::appendPathToCairoContext): Use cairo_path_destroy directly
+ instead of a smart pointer; the code path is simple enough that it is
+ clear this way.
+
+ * platform/graphics/cairo/ImageBufferCairo.cpp:
+ (WebCore::ImageBuffer::ImageBuffer): Use make_unique.
+ * platform/graphics/cairo/ImageBufferDataCairo.h: Use unique_ptr.
+
+ * platform/graphics/cairo/OwnPtrCairo.cpp: Removed.
+ * platform/graphics/cairo/OwnPtrCairo.h: Removed.
+
+ * platform/graphics/cairo/PathCairo.cpp:
+ (WebCore::Path::Path): Use cairo_path_destroy directly instead of a
+ smart pointer; the code path is simple enough that it is clear this way.
+ (WebCore::Path::operator=): Ditto.
+ (WebCore::Path::addPath): Ditto.
+ (WebCore::Path::apply): Ditto.
+ * platform/graphics/cairo/PlatformContextCairo.cpp:
+ (WebCore::PlatformContextCairo::clipForPatternFilling): Ditto.
+
+ * platform/graphics/freetype/FontCacheFreeType.cpp: Removed unneeded include.
+ * platform/graphics/glx/GLContextGLX.cpp: Ditto.
+
+ * platform/graphics/surfaces/egl/EGLSurface.cpp:
+ (WebCore::EGLOffScreenSurface::EGLOffScreenSurface): Use make_unique.
+
+ * platform/graphics/surfaces/glx/GLXConfigSelector.h:
+ (WebCore::GLXConfigSelector::findMatchingConfig): Use unique_ptr with X11Deleter.
+ (WebCore::GLXConfigSelector::findMatchingConfigWithVisualId): Ditto.
+ * platform/graphics/surfaces/glx/GLXSurface.cpp:
+ (WebCore::GLXTransportSurface::GLXTransportSurface): Ditto.
+ (WebCore::GLXOffScreenSurface::initialize): Ditto.
+
+ * platform/graphics/surfaces/glx/OwnPtrX11.h: Removed.
+
+ * platform/graphics/surfaces/glx/X11Helper.cpp:
+ (WebCore::X11Helper::createOffScreenWindow): Use unique_ptr with X11Deleter.
+ (WebCore::X11Helper::createPixmap): Ditto.
+
+ * platform/graphics/surfaces/glx/X11Helper.h: Added X11Deleter,
+ which can be used with unique_ptr to make it call XFree instead of delete.
+
+ * platform/graphics/win/FullScreenController.cpp: Use unique_ptr.
+ (FullScreenController::FullScreenController): Use make_unique.
+ (FullScreenController::enterFullScreen): Ditto.
+ * platform/graphics/win/FullScreenController.h: Use unique_ptr.
+
+ * platform/graphics/win/GraphicsContext3DWin.cpp: Removed unneeded includes.
+
+ * platform/graphics/win/WKCAImageQueue.cpp:
+ (WebCore::WKCAImageQueue::WKCAImageQueue): Use make_unique.
+ * platform/graphics/win/WKCAImageQueue.h: Use unique_ptr.
+
+ * platform/network/NetworkStorageSessionStub.cpp: Removed unneeded include.
+
+ * platform/network/ResourceHandleInternal.h: Use unique_ptr.
+
+ * platform/network/curl/MultipartHandle.cpp:
+ (WebCore::MultipartHandle::create): Deleted.
+ * platform/network/curl/MultipartHandle.h: Deleted the create function.
+
+ * platform/network/curl/ResourceHandleManager.cpp:
+ (WebCore::headerCallback): Use make_unique.
+
2015-04-24 Per Arne Vollan <peavo@outlook.com>
[Win] Popup menu is not accessible.
platform/graphics/cairo/ImageBufferCairo.cpp
platform/graphics/cairo/ImageCairo.cpp
platform/graphics/cairo/IntRectCairo.cpp
- platform/graphics/cairo/OwnPtrCairo.cpp
platform/graphics/cairo/PathCairo.cpp
platform/graphics/cairo/PatternCairo.cpp
platform/graphics/cairo/PlatformContextCairo.cpp
platform/graphics/cairo/ImageBufferCairo.cpp
platform/graphics/cairo/ImageCairo.cpp
platform/graphics/cairo/IntRectCairo.cpp
- platform/graphics/cairo/OwnPtrCairo.cpp
platform/graphics/cairo/PathCairo.cpp
platform/graphics/cairo/PatternCairo.cpp
platform/graphics/cairo/PlatformContextCairo.cpp
platform/graphics/cairo/ImageBufferCairo.cpp
platform/graphics/cairo/ImageCairo.cpp
platform/graphics/cairo/IntRectCairo.cpp
- platform/graphics/cairo/OwnPtrCairo.cpp
platform/graphics/cairo/PathCairo.cpp
platform/graphics/cairo/PatternCairo.cpp
platform/graphics/cairo/PlatformContextCairo.cpp
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
</ClCompile>
- <ClCompile Include="..\platform\graphics\cairo\OwnPtrCairo.cpp">
- <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
- <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
- <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|Win32'">true</ExcludedFromBuild>
- <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|x64'">true</ExcludedFromBuild>
- <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
- <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
- <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
- <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
- </ClCompile>
<ClCompile Include="..\platform\graphics\cairo\PathCairo.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
</CustomBuildStep>
- <CustomBuildStep Include="..\platform\graphics\cairo\OwnPtrCairo.h">
- <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
- <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
- <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|Win32'">true</ExcludedFromBuild>
- <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|x64'">true</ExcludedFromBuild>
- <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
- <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
- <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
- <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
- </CustomBuildStep>
<CustomBuildStep Include="..\platform\graphics\cairo\PlatformPathCairo.h">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ClCompile Include="..\platform\graphics\cairo\IntRectCairo.cpp">
<Filter>platform\graphics\cairo</Filter>
</ClCompile>
- <ClCompile Include="..\platform\graphics\cairo\OwnPtrCairo.cpp">
- <Filter>platform\graphics\cairo</Filter>
- </ClCompile>
<ClCompile Include="..\platform\graphics\cairo\PathCairo.cpp">
<Filter>platform\graphics\cairo</Filter>
</ClCompile>
<CustomBuildStep Include="..\platform\graphics\cairo\GraphicsContextPlatformPrivateCairo.h">
<Filter>platform\graphics\cairo</Filter>
</CustomBuildStep>
- <CustomBuildStep Include="..\platform\graphics\cairo\OwnPtrCairo.h">
- <Filter>platform\graphics\cairo</Filter>
- </CustomBuildStep>
<CustomBuildStep Include="..\platform\graphics\cairo\PlatformPathCairo.h">
<Filter>platform\graphics\cairo</Filter>
</CustomBuildStep>
>::value),
RawPointerRefCountedTest);
-// Verify that PassOwnPtr gets passed through.
-COMPILE_ASSERT((std::is_same<
- PassOwnPtr<float>,
- CrossThreadCopier<PassOwnPtr<float>>::Type
- >::value),
- PassOwnPtrTest);
-
-// Verify that PassOwnPtr does not get passed through.
-COMPILE_ASSERT((std::is_same<
- int,
- CrossThreadCopier<OwnPtr<float>>::Type
- >::value),
- OwnPtrTest);
-
} // namespace WebCore
#include <wtf/Assertions.h>
#include <wtf/Forward.h>
-#include <wtf/PassOwnPtr.h>
#include <wtf/PassRefPtr.h>
#include <wtf/RefPtr.h>
#include <wtf/Threading.h>
}
};
- template<typename T> struct CrossThreadCopierBase<false, false, PassOwnPtr<T>> {
- typedef PassOwnPtr<T> Type;
- static Type copy(Type ownPtr)
- {
- return ownPtr;
- }
- };
-
template<> struct CrossThreadCopierBase<false, false, URL> {
typedef URL Type;
static Type copy(const URL&);
#include "ScrollbarTheme.h"
#include <algorithm>
#include <wtf/CurrentTime.h>
-#include <wtf/PassOwnPtr.h>
using namespace std;
#include "TextCodecICU.h"
#include "ThreadTimers.h"
#include <wtf/MainThread.h>
-#include <wtf/PassOwnPtr.h>
#include <wtf/ThreadSpecific.h>
#include <wtf/Threading.h>
#include <wtf/WTFThreadData.h>
#include <wtf/HashMap.h>
#include <wtf/HashSet.h>
#include <wtf/Noncopyable.h>
-#include <wtf/OwnPtr.h>
#include <wtf/text/StringHash.h>
#include <wtf/ThreadSpecific.h>
#define CDMSessionAVFoundationCF_h
#include "CDMSession.h"
-#include <wtf/PassOwnPtr.h>
#include <wtf/RetainPtr.h>
#if HAVE(AVFOUNDATION_LOADER_DELEGATE) && ENABLE(ENCRYPTED_MEDIA_V2)
mutable RetainPtr<CACFLayerRef> m_caVideoLayer;
RefPtr<PlatformCALayer> m_videoLayerWrapper;
- OwnPtr<LayerClient> m_layerClient;
+ std::unique_ptr<LayerClient> m_layerClient;
COMPtr<IDirect3DDevice9Ex> m_d3dDevice;
InbandTextTrackPrivateAVF* m_currentTextTrack;
if (!context)
return;
- OwnPtr<NotificationCallbackData> notificationData = adoptPtr(reinterpret_cast<NotificationCallbackData*>(context));
+ std::unique_ptr<NotificationCallbackData> notificationData { static_cast<NotificationCallbackData*>(context) };
MutexLocker locker(mapLock());
AVFWrapper* self = avfWrapperForCallbackContext(notificationData->m_context);
LOG(Media, "AVFWrapper::notificationCallback(if=%d) %s", reinterpret_cast<uintptr_t>(observer), notificationName);
#endif
- OwnPtr<NotificationCallbackData> notificationData = adoptPtr(new NotificationCallbackData(propertyName, observer));
+ auto notificationData = std::make_unique<NotificationCallbackData>(propertyName, observer);
- dispatch_async_f(dispatch_get_main_queue(), notificationData.leakPtr(), processNotification);
+ dispatch_async_f(dispatch_get_main_queue(), notificationData.release(), processNotification);
}
void AVFWrapper::loadPlayableCompletionCallback(AVCFAssetRef, void* context)
return 0;
// Create a PlatformCALayer so we can resize the video layer to match the element size.
- m_layerClient = adoptPtr(new LayerClient(this));
+ m_layerClient = std::make_unique<LayerClient>(this);
if (!m_layerClient)
return 0;
#include "FloatPoint.h"
#include "FloatRect.h"
#include "IntRect.h"
-#include "OwnPtrCairo.h"
#include "Path.h"
#include "PlatformPathCairo.h"
#include "RefPtrCairo.h"
void appendPathToCairoContext(cairo_t* to, cairo_t* from)
{
- OwnPtr<cairo_path_t> cairoPath = adoptPtr(cairo_copy_path(from));
- cairo_append_path(to, cairoPath.get());
+ auto cairoPath = cairo_copy_path(from);
+ cairo_append_path(to, cairoPath);
+ cairo_path_destroy(cairoPath);
}
void setPathOnCairoContext(cairo_t* to, cairo_t* from)
#include <cairo.h>
#include <runtime/JSCInlines.h>
#include <runtime/TypedArrayInlines.h>
-#include <wtf/PassOwnPtr.h>
#include <wtf/Vector.h>
#include <wtf/text/Base64.h>
#include <wtf/text/WTFString.h>
RefPtr<cairo_t> cr = adoptRef(cairo_create(m_data.m_surface.get()));
m_data.m_platformContext.setCr(cr.get());
- m_data.m_context = adoptPtr(new GraphicsContext(&m_data.m_platformContext));
+ m_data.m_context = std::make_unique<GraphicsContext>(&m_data.m_platformContext);
success = true;
}
RefPtr<cairo_surface_t> m_surface;
PlatformContextCairo m_platformContext;
- OwnPtr<GraphicsContext> m_context;
+ std::unique_ptr<GraphicsContext> m_context;
IntSize m_size;
#if ENABLE(ACCELERATED_2D_CANVAS)
+++ /dev/null
-/*
- * Copyright (C) 2010 Collabora Ltd.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301 USA
- */
-
-#include "config.h"
-#include "OwnPtrCairo.h"
-
-#if USE(CAIRO)
-
-#if USE(FREETYPE)
-#include <cairo-ft.h>
-#include <fontconfig/fcfreetype.h>
-#endif
-
-#include <cairo.h>
-
-namespace WTF {
-
-#if USE(FREETYPE)
-template <> void deleteOwnedPtr<FcObjectSet>(FcObjectSet* ptr)
-{
- if (ptr)
- FcObjectSetDestroy(ptr);
-}
-
-template <> void deleteOwnedPtr<FcFontSet>(FcFontSet* ptr)
-{
- if (ptr)
- FcFontSetDestroy(ptr);
-}
-#endif
-
-} // namespace WTF
-
-#endif // USE(CAIRO)
+++ /dev/null
-/*
- * Copyright (C) 2010 Collabora Ltd.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301 USA
- */
-
-#ifndef OwnPtrCairo_h
-#define OwnPtrCairo_h
-
-#if USE(CAIRO)
-
-#include <wtf/OwnPtr.h>
-#include <wtf/PassOwnPtr.h>
-
-#if USE(FREETYPE)
-typedef struct _FcObjectSet FcObjectSet;
-typedef struct _FcFontSet FcFontSet;
-#endif
-
-typedef struct cairo_path cairo_path_t;
-
-namespace WTF {
-
-#if USE(FREETYPE)
-template <> void deleteOwnedPtr<FcObjectSet>(FcObjectSet*);
-template <> void deleteOwnedPtr<FcFontSet>(FcFontSet*);
-#endif
-
-} // namespace WTF
-
-#endif // USE(CAIRO)
-
-#endif // OwnPtrCairo_h
#include "AffineTransform.h"
#include "FloatRect.h"
#include "GraphicsContext.h"
-#include "OwnPtrCairo.h"
#include "PlatformPathCairo.h"
#include "StrokeStyleApplier.h"
#include <cairo.h>
return;
cairo_t* cr = ensurePlatformPath()->context();
- OwnPtr<cairo_path_t> pathCopy = adoptPtr(cairo_copy_path(other.platformPath()->context()));
- cairo_append_path(cr, pathCopy.get());
+ auto pathCopy = cairo_copy_path(other.platformPath()->context());
+ cairo_append_path(cr, pathCopy);
+ cairo_path_destroy(pathCopy);
}
PlatformPathPtr Path::ensurePlatformPath()
} else {
clear();
cairo_t* cr = ensurePlatformPath()->context();
- OwnPtr<cairo_path_t> pathCopy = adoptPtr(cairo_copy_path(other.platformPath()->context()));
- cairo_append_path(cr, pathCopy.get());
+ auto pathCopy = cairo_copy_path(other.platformPath()->context());
+ cairo_append_path(cr, pathCopy);
+ cairo_path_destroy(pathCopy);
}
return *this;
cairo_t* cr = path.platformPath()->context();
cairo_save(cr);
cairo_transform(cr, &matrix);
- std::unique_ptr<cairo_path_t, void(*)(cairo_path_t*)> pathCopy(cairo_copy_path(cr), [](cairo_path_t* path) {
- cairo_path_destroy(path);
- });
+ auto pathCopy = cairo_copy_path(cr);
cairo_restore(cr);
- cairo_append_path(ensurePlatformPath()->context(), pathCopy.get());
+ cairo_append_path(ensurePlatformPath()->context(), pathCopy);
+ cairo_path_destroy(pathCopy);
}
void Path::closeSubpath()
return;
cairo_t* cr = platformPath()->context();
- OwnPtr<cairo_path_t> pathCopy = adoptPtr(cairo_copy_path(cr));
+ auto pathCopy = cairo_copy_path(cr);
cairo_path_data_t* data;
PathElement pelement;
FloatPoint points[3];
break;
}
}
+ cairo_path_destroy(pathCopy);
}
void Path::transform(const AffineTransform& trans)
#include "CairoUtilities.h"
#include "Gradient.h"
#include "GraphicsContext.h"
-#include "OwnPtrCairo.h"
#include "Pattern.h"
#include <cairo.h>
ASSERT(state.fillPattern);
// Hold current cairo path in a variable for restoring it after configuring the pattern clip rectangle.
- OwnPtr<cairo_path_t> currentPath = adoptPtr(cairo_copy_path(m_cr.get()));
+ auto currentPath = cairo_copy_path(m_cr.get());
cairo_new_path(m_cr.get());
// Initialize clipping extent from current cairo clip extents, then shrink if needed according to pattern.
}
// Restoring cairo path.
- cairo_append_path(m_cr.get(), currentPath.get());
+ cairo_append_path(m_cr.get(), currentPath);
+ cairo_path_destroy(currentPath);
}
} // namespace WebCore
#include "FontCache.h"
#include "Font.h"
-#include "OwnPtrCairo.h"
#include "RefPtrCairo.h"
#include "UTF16UChar32Iterator.h"
#include <cairo-ft.h>
#include "OpenGLShims.h"
#include <GL/glx.h>
#include <cairo.h>
-#include <wtf/OwnPtr.h>
#if ENABLE(ACCELERATED_2D_CANVAS)
#include <cairo-gl.h>
if (m_sharedDisplay == EGL_NO_DISPLAY)
return;
- m_configSelector = adoptPtr(new EGLConfigSelector(surfaceAttributes));
+ m_configSelector = std::make_unique<EGLConfigSelector>(surfaceAttributes);
}
EGLOffScreenSurface::~EGLOffScreenSurface()
GLXFBConfig findMatchingConfig(const int attributes[], int depth = 32)
{
int numAvailableConfigs;
- OwnPtrX11<GLXFBConfig> temp(glXChooseFBConfig(X11Helper::nativeDisplay(), DefaultScreen(X11Helper::nativeDisplay()), attributes, &numAvailableConfigs));
+ std::unique_ptr<GLXFBConfig[], X11Deleter> temp(glXChooseFBConfig(X11Helper::nativeDisplay(), DefaultScreen(X11Helper::nativeDisplay()), attributes, &numAvailableConfigs));
if (!numAvailableConfigs || !temp.get())
return 0;
- OwnPtrX11<XVisualInfo> scopedVisualInfo;
for (int i = 0; i < numAvailableConfigs; ++i) {
- scopedVisualInfo = glXGetVisualFromFBConfig(X11Helper::nativeDisplay(), temp[i]);
+ std::unique_ptr<XVisualInfo, X11Deleter> scopedVisualInfo { glXGetVisualFromFBConfig(X11Helper::nativeDisplay(), temp[i]) };
if (!scopedVisualInfo.get())
continue;
}
// Did not find any visual supporting alpha, select the first available config.
- scopedVisualInfo = glXGetVisualFromFBConfig(X11Helper::nativeDisplay(), temp[0]);
+ std::unique_ptr<XVisualInfo, X11Deleter> scopedVisualInfo { glXGetVisualFromFBConfig(X11Helper::nativeDisplay(), temp[0]) };
if ((m_attributes & GLPlatformSurface::SupportAlpha) && (scopedVisualInfo->depth != 32))
m_attributes &= ~GLPlatformSurface::SupportAlpha;
GLXFBConfig findMatchingConfigWithVisualId(const int attributes[], int depth, VisualID id)
{
int numAvailableConfigs;
- OwnPtrX11<GLXFBConfig> temp(glXChooseFBConfig(X11Helper::nativeDisplay(), DefaultScreen(X11Helper::nativeDisplay()), attributes, &numAvailableConfigs));
+ std::unique_ptr<GLXFBConfig[], X11Deleter> temp(glXChooseFBConfig(X11Helper::nativeDisplay(), DefaultScreen(X11Helper::nativeDisplay()), attributes, &numAvailableConfigs));
if (!numAvailableConfigs || !temp.get())
return 0;
- OwnPtrX11<XVisualInfo> scopedVisualInfo;
for (int i = 0; i < numAvailableConfigs; ++i) {
- scopedVisualInfo = glXGetVisualFromFBConfig(X11Helper::nativeDisplay(), temp[i]);
+ std::unique_ptr<XVisualInfo, X11Deleter> scopedVisualInfo { glXGetVisualFromFBConfig(X11Helper::nativeDisplay(), temp[i]) };
if (!scopedVisualInfo.get())
continue;
m_sharedDisplay = X11Helper::nativeDisplay();
attributes |= GLPlatformSurface::DoubleBuffered;
m_configSelector = std::make_unique<GLXConfigSelector>(attributes);
- OwnPtrX11<XVisualInfo> visInfo(m_configSelector->visualInfo(m_configSelector->surfaceContextConfig()));
+ std::unique_ptr<XVisualInfo, X11Deleter> visInfo(m_configSelector->visualInfo(m_configSelector->surfaceContextConfig()));
if (!visInfo.get()) {
destroy();
m_configSelector = std::make_unique<GLXConfigSelector>(attributes);
- OwnPtrX11<XVisualInfo> visualInfo(m_configSelector->visualInfo(m_configSelector->pixmapContextConfig()));
+ std::unique_ptr<XVisualInfo, X11Deleter> visualInfo(m_configSelector->visualInfo(m_configSelector->pixmapContextConfig()));
X11Helper::createPixmap(&m_pixmap, *visualInfo.get());
if (!m_pixmap) {
+++ /dev/null
-/*
- * Copyright (C) 2012 Intel Corporation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef OwnPtrX11_h
-#define OwnPtrX11_h
-
-namespace WebCore {
-
-template<typename T>
-struct OwnPtrX11 {
-
- OwnPtrX11() : m_xResource(0) { }
- OwnPtrX11(T* xResource) : m_xResource(xResource) { }
-
- ~OwnPtrX11()
- {
- if (m_xResource)
- XFree(m_xResource);
- }
-
- OwnPtrX11& operator=(T* xResource)
- {
- if (m_xResource)
- XFree(m_xResource);
-
- m_xResource = xResource;
- return *this;
- }
-
- operator T*() const { return m_xResource; }
- T* operator->() const { return m_xResource; }
- T* get() const { return m_xResource; }
-
-private:
- OwnPtrX11(const OwnPtrX11&);
- OwnPtrX11& operator=(const OwnPtrX11&);
- static void* operator new (size_t);
- static void operator delete (void*);
- T* m_xResource;
-};
-
-}
-
-#endif
memset(&visualInfoTemplate, 0, sizeof(XVisualInfo));
visualInfoTemplate.visualid = visualId;
int matchingCount = 0;
- OwnPtrX11<XVisualInfo> matchingVisuals(XGetVisualInfo(nativeDisplay(), VisualIDMask, &visualInfoTemplate, &matchingCount));
+ std::unique_ptr<XVisualInfo, X11Deleter> matchingVisuals(XGetVisualInfo(nativeDisplay(), VisualIDMask, &visualInfoTemplate, &matchingCount));
XVisualInfo* foundVisual = 0;
if (matchingVisuals) {
memset(&visualInfoTemplate, 0, sizeof(XVisualInfo));
visualInfoTemplate.visualid = visualId;
int matchingCount = 0;
- OwnPtrX11<XVisualInfo> matchingVisuals(XGetVisualInfo(nativeDisplay(), VisualIDMask, &visualInfoTemplate, &matchingCount));
+ std::unique_ptr<XVisualInfo, X11Deleter> matchingVisuals(XGetVisualInfo(nativeDisplay(), VisualIDMask, &visualInfoTemplate, &matchingCount));
XVisualInfo* foundVisual = 0;
int requiredDepth = hasAlpha ? 32 : 24;
#define X11Helper_h
#include "IntRect.h"
-#include "OwnPtrX11.h"
#if USE(EGL)
#include <opengl/GLDefs.h>
namespace WebCore {
-class X11Helper {
+class X11Deleter {
+public:
+ template<typename T> void operator()(T* resource)
+ {
+ if (resource)
+ XFree(resource);
+ }
+};
+class X11Helper {
public:
static void createPixmap(Pixmap*, const XVisualInfo&, const IntSize& = IntSize(1, 1));
static void createOffScreenWindow(uint32_t*, const XVisualInfo&, const IntSize& = IntSize(1, 1));
};
class ScopedXPixmapCreationErrorHandler {
-
public:
ScopedXPixmapCreationErrorHandler();
~ScopedXPixmapCreationErrorHandler();
#include "MediaPlayerPrivateFullscreenWindow.h"
#include "Timer.h"
#include "WebCoreInstanceHandle.h"
-#include <wtf/PassOwnPtr.h>
#include <wtf/RefPtr.h>
using namespace WebCore;
FullScreenController* m_controller;
FullScreenControllerClient* m_client;
- OwnPtr<MediaPlayerPrivateFullscreenWindow> m_fullScreenWindow;
- OwnPtr<MediaPlayerPrivateFullscreenWindow> m_backgroundWindow;
+ std::unique_ptr<MediaPlayerPrivateFullscreenWindow> m_fullScreenWindow;
+ std::unique_ptr<MediaPlayerPrivateFullscreenWindow> m_backgroundWindow;
IntRect m_fullScreenFrame;
IntRect m_originalFrame;
HWND m_originalHost;
}
FullScreenController::FullScreenController(FullScreenControllerClient* client)
- : m_private(adoptPtr(new FullScreenController::Private(this, client)))
+ : m_private(std::make_unique<Private>(this, client))
{
ASSERT_ARG(client, client);
}
m_private->m_originalFrame = originalFrame;
ASSERT(!m_private->m_backgroundWindow);
- m_private->m_backgroundWindow = adoptPtr(new MediaPlayerPrivateFullscreenWindow(m_private.get()));
+ m_private->m_backgroundWindow = std::make_unique<MediaPlayerPrivateFullscreenWindow>(m_private.get());
m_private->m_backgroundWindow->createWindow(0);
::AnimateWindow(m_private->m_backgroundWindow->hwnd(), kFullScreenAnimationDuration, AW_BLEND | AW_ACTIVATE);
m_private->m_client->fullScreenClientWillEnterFullScreen();
ASSERT(!m_private->m_fullScreenWindow);
- m_private->m_fullScreenWindow = adoptPtr(new MediaPlayerPrivateFullscreenWindow(m_private.get()));
+ m_private->m_fullScreenWindow = std::make_unique<MediaPlayerPrivateFullscreenWindow>(m_private.get());
ASSERT(m_private->m_fullScreenWindow);
m_private->m_fullScreenWindow->createWindow(0);
#if ENABLE(FULLSCREEN_API)
-#include <wtf/OwnPtr.h>
+#include <memory>
namespace WebCore {
class Private;
friend class Private;
- OwnPtr<FullScreenController::Private> m_private;
+ std::unique_ptr<FullScreenController::Private> m_private;
};
}
#include "GraphicsContext3D.h"
#include "GraphicsContext3DPrivate.h"
#include <WebCore/PlatformCALayerWin.h>
-#include <wtf/OwnPtr.h>
-#include <wtf/PassOwnPtr.h>
#if PLATFORM(WIN)
#include <GLSLANG/ShaderLang.h>
#include <CoreFoundation/CoreFoundation.h>
#include <WebKitSystemInterface/WebKitSystemInterface.h>
-#include <wtf/PassOwnPtr.h>
#include <wtf/RetainPtr.h>
namespace WebCore {
}
WKCAImageQueue::WKCAImageQueue(uint32_t width, uint32_t height, uint32_t capacity)
- : m_private(adoptPtr(new WKCAImageQueuePrivate()))
+ : m_private(std::make_unique<WKCAImageQueuePrivate>())
{
m_private->m_imageQueue = adoptCF(wkCAImageQueueCreate(width, height, capacity));
}
WKCAImageQueue::WKCAImageQueue(const WKCAImageQueue& o)
- : m_private(adoptPtr(new WKCAImageQueuePrivate()))
+ : m_private(std::make_unique<WKCAImageQueuePrivate>())
{
m_private->m_imageQueue = o.m_private->m_imageQueue;
}
typedef const void * CFTypeRef;
typedef const struct __CFDictionary * CFDictionaryRef;
+#include <memory>
#include <stdint.h>
-#include <wtf/OwnPtr.h>
namespace WebCore {
private:
WKCAImageQueue(const WKCAImageQueue&);
WKCAImageQueue& operator=(const WKCAImageQueue&);
- OwnPtr<WKCAImageQueuePrivate> m_private;
+ std::unique_ptr<WKCAImageQueuePrivate> m_private;
};
}
#include "NetworkStorageSession.h"
#include "NetworkingContext.h"
-#include <wtf/PassOwnPtr.h>
namespace WebCore {
#include "ResourceRequest.h"
#include "AuthenticationChallenge.h"
#include "Timer.h"
-#include <wtf/OwnPtr.h>
#if USE(CFNETWORK)
#include "ResourceHandleCFURLConnectionDelegate.h"
unsigned m_sslErrors;
Vector<char> m_postBytes;
- OwnPtr<MultipartHandle> m_multipartHandle;
+ std::unique_ptr<MultipartHandle> m_multipartHandle;
#endif
#if USE(SOUP)
GRefPtr<SoupMessage> m_soupMessage;
namespace WebCore {
-PassOwnPtr<MultipartHandle> MultipartHandle::create(ResourceHandle* handle, const String& boundary)
-{
- return adoptPtr(new MultipartHandle(handle, boundary));
-}
-
bool MultipartHandle::extractBoundary(const String& contentType, String& boundary)
{
static const size_t length = strlen("boundary=");
#include "HTTPHeaderMap.h"
#include "ResourceHandle.h"
-
-#include <wtf/OwnPtr.h>
#include <wtf/Vector.h>
#include <wtf/text/WTFString.h>
namespace WebCore {
class MultipartHandle {
-
public:
- static PassOwnPtr<MultipartHandle> create(ResourceHandle* handle, const String& boundary);
static bool extractBoundary(const String& contentType, String& boundary);
MultipartHandle(ResourceHandle* handle, const String& boundary)
String boundary;
bool parsed = MultipartHandle::extractBoundary(d->m_response.httpHeaderField(HTTPHeaderName::ContentType), boundary);
if (parsed)
- d->m_multipartHandle = MultipartHandle::create(job, boundary);
+ d->m_multipartHandle = std::make_unique<MultipartHandle>(job, boundary);
}
#if ENABLE(WEB_TIMING)
+2015-04-24 Darin Adler <darin@apple.com>
+
+ Convert OwnPtr and PassOwnPtr uses to std::unique_ptr
+ https://bugs.webkit.org/show_bug.cgi?id=128007
+
+ Reviewed by Anders Carlsson.
+
+ * NetworkProcess/cache/NetworkCacheEncoder.h: Added an include now
+ needed that was inherited from OwnPtr.h before.
+
2015-04-24 Antti Koivisto <antti@apple.com>
Network Cache: Make path functions members
#if ENABLE(NETWORK_CACHE)
#include "NetworkCacheCoder.h"
-
+#include <wtf/HashFunctions.h>
#include <wtf/StringHasher.h>
#include <wtf/Vector.h>
+2015-04-24 Darin Adler <darin@apple.com>
+
+ Convert OwnPtr and PassOwnPtr uses to std::unique_ptr
+ https://bugs.webkit.org/show_bug.cgi?id=128007
+
+ Reviewed by Anders Carlsson.
+
+ * DumpRenderTree/win/HistoryDelegate.h: Removed unneeded include.
+ * DumpRenderTree/win/UIDelegate.h: Ditto.
+
+ * TestWebKitAPI/Tests/WTF/HashMap.cpp: Removed OwnPtr-specific test cases.
+ * TestWebKitAPI/Tests/WTF/HashSet.cpp: Ditto.
+
+ * TestWebKitAPI/Tests/WebKit/win/WebViewDestruction.cpp: Removed unneeded include.
+
+ * TestWebKitAPI/Tests/WebKit2/UserMessage.cpp: Use unique_ptr.
+ (TestWebKitAPI::WebKit2UserMessageRoundTripTest::SetUp): Use make_unique.
+ * TestWebKitAPI/Tests/WebKit2/WillLoad.cpp: Ditto.
+ (TestWebKitAPI::WebKit2WillLoadTest::SetUp): Ditto.
+ * TestWebKitAPI/Tests/WebKit2Gtk/DOMDOMWindowTest.cpp:
+ (WebKitDOMDOMWindowTest::create): Ditto.
+ * TestWebKitAPI/Tests/WebKit2Gtk/WebExtensionTest.cpp:
+ (documentLoadedCallback): Use a queue of DelayedSignal objects instead
+ of smart pointers to DelayedSIgnal objects.
+ (uriChangedCallback): Ditto.
+
2015-04-24 Brent Fulgham <bfulgham@apple.com>
[Mac] Unreviewed test fix.
#define HistoryDelegate_h
#include <WebKit/WebKit.h>
-#include <wtf/OwnPtr.h>
class HistoryDelegate : public IWebHistoryDelegate {
public:
#include <WebCore/COMPtr.h>
#include <WebKit/WebKit.h>
-#include <wtf/OwnPtr.h>
#include <windef.h>
class DRTUndoManager;
#include "RefLogger.h"
#include <string>
#include <wtf/HashMap.h>
-#include <wtf/OwnPtr.h>
-#include <wtf/PassOwnPtr.h>
#include <wtf/text/StringHash.h>
namespace TestWebKitAPI {
}
}
-TEST(WTF_HashMap, OwnPtrKey)
-{
- ConstructorDestructorCounter::TestingScope scope;
-
- HashMap<OwnPtr<ConstructorDestructorCounter>, int> map;
-
- OwnPtr<ConstructorDestructorCounter> ownPtr = adoptPtr(new ConstructorDestructorCounter);
- map.add(WTF::move(ownPtr), 2);
-
- EXPECT_EQ(1u, ConstructorDestructorCounter::constructionCount);
- EXPECT_EQ(0u, ConstructorDestructorCounter::destructionCount);
-
- map.clear();
-
- EXPECT_EQ(1u, ConstructorDestructorCounter::constructionCount);
- EXPECT_EQ(1u, ConstructorDestructorCounter::destructionCount);
-}
-
-TEST(WTF_HashMap, OwnPtrKey_FindUsingRawPointer)
-{
- HashMap<OwnPtr<int>, int> map;
-
- OwnPtr<int> ownPtr = adoptPtr(new int(5));
- int* ptr = ownPtr.get();
- map.add(WTF::move(ownPtr), 2);
-
- auto it = map.find(ptr);
- ASSERT_TRUE(it != map.end());
- EXPECT_EQ(ptr, it->key.get());
- EXPECT_EQ(2, it->value);
-}
-
-TEST(WTF_HashMap, OwnPtrKey_ContainsUsingRawPointer)
-{
- HashMap<OwnPtr<int>, int> map;
-
- OwnPtr<int> ownPtr = adoptPtr(new int(5));
- int* ptr = ownPtr.get();
- map.add(WTF::move(ownPtr), 2);
-
- EXPECT_EQ(true, map.contains(ptr));
-}
-
-TEST(WTF_HashMap, OwnPtrKey_GetUsingRawPointer)
-{
- HashMap<OwnPtr<int>, int> map;
-
- OwnPtr<int> ownPtr = adoptPtr(new int(5));
- int* ptr = ownPtr.get();
- map.add(WTF::move(ownPtr), 2);
-
- int value = map.get(ptr);
- EXPECT_EQ(2, value);
-}
-
-TEST(WTF_HashMap, OwnPtrKey_RemoveUsingRawPointer)
-{
- ConstructorDestructorCounter::TestingScope scope;
-
- HashMap<OwnPtr<ConstructorDestructorCounter>, int> map;
-
- OwnPtr<ConstructorDestructorCounter> ownPtr = adoptPtr(new ConstructorDestructorCounter);
- ConstructorDestructorCounter* ptr = ownPtr.get();
- map.add(WTF::move(ownPtr), 2);
-
- EXPECT_EQ(1u, ConstructorDestructorCounter::constructionCount);
- EXPECT_EQ(0u, ConstructorDestructorCounter::destructionCount);
-
- bool result = map.remove(ptr);
- EXPECT_EQ(true, result);
-
- EXPECT_EQ(1u, ConstructorDestructorCounter::constructionCount);
- EXPECT_EQ(1u, ConstructorDestructorCounter::destructionCount);
-}
-
-TEST(WTF_HashMap, OwnPtrKey_TakeUsingRawPointer)
-{
- ConstructorDestructorCounter::TestingScope scope;
-
- HashMap<OwnPtr<ConstructorDestructorCounter>, int> map;
-
- OwnPtr<ConstructorDestructorCounter> ownPtr = adoptPtr(new ConstructorDestructorCounter);
- ConstructorDestructorCounter* ptr = ownPtr.get();
- map.add(WTF::move(ownPtr), 2);
-
- EXPECT_EQ(1u, ConstructorDestructorCounter::constructionCount);
- EXPECT_EQ(0u, ConstructorDestructorCounter::destructionCount);
-
- int result = map.take(ptr);
- EXPECT_EQ(2, result);
-
- EXPECT_EQ(1u, ConstructorDestructorCounter::constructionCount);
- EXPECT_EQ(1u, ConstructorDestructorCounter::destructionCount);
-}
-
TEST(WTF_HashMap, UniquePtrKey)
{
ConstructorDestructorCounter::TestingScope scope;
#include "Counters.h"
#include "MoveOnly.h"
#include <wtf/HashSet.h>
-#include <wtf/OwnPtr.h>
-#include <wtf/PassOwnPtr.h>
namespace TestWebKitAPI {
EXPECT_TRUE(secondSet.contains(MoveOnly(i + 1)));
}
-TEST(WTF_HashSet, OwnPtrKey)
-{
- ConstructorDestructorCounter::TestingScope scope;
-
- HashSet<OwnPtr<ConstructorDestructorCounter>> set;
-
- OwnPtr<ConstructorDestructorCounter> ownPtr = adoptPtr(new ConstructorDestructorCounter);
- set.add(WTF::move(ownPtr));
-
- EXPECT_EQ(1u, ConstructorDestructorCounter::constructionCount);
- EXPECT_EQ(0u, ConstructorDestructorCounter::destructionCount);
-
- set.clear();
-
- EXPECT_EQ(1u, ConstructorDestructorCounter::constructionCount);
- EXPECT_EQ(1u, ConstructorDestructorCounter::destructionCount);
-}
-
-TEST(WTF_HashSet, OwnPtrKey_FindUsingRawPointer)
-{
- HashSet<OwnPtr<int>> set;
-
- OwnPtr<int> ownPtr = adoptPtr(new int(5));
- int* ptr = ownPtr.get();
- set.add(WTF::move(ownPtr));
-
- auto it = set.find(ptr);
- ASSERT_TRUE(it != set.end());
- EXPECT_EQ(ptr, it->get());
- EXPECT_EQ(5, *it->get());
-}
-
-TEST(WTF_HashSet, OwnPtrKey_ContainsUsingRawPointer)
-{
- HashSet<OwnPtr<int>> set;
-
- OwnPtr<int> ownPtr = adoptPtr(new int(5));
- int* ptr = ownPtr.get();
- set.add(WTF::move(ownPtr));
-
- EXPECT_EQ(true, set.contains(ptr));
-}
-
-TEST(WTF_HashSet, OwnPtrKey_RemoveUsingRawPointer)
-{
- ConstructorDestructorCounter::TestingScope scope;
-
- HashSet<OwnPtr<ConstructorDestructorCounter>> set;
-
- OwnPtr<ConstructorDestructorCounter> ownPtr = adoptPtr(new ConstructorDestructorCounter);
- ConstructorDestructorCounter* ptr = ownPtr.get();
- set.add(WTF::move(ownPtr));
-
- EXPECT_EQ(1u, ConstructorDestructorCounter::constructionCount);
- EXPECT_EQ(0u, ConstructorDestructorCounter::destructionCount);
-
- bool result = set.remove(ptr);
- EXPECT_EQ(true, result);
-
- EXPECT_EQ(1u, ConstructorDestructorCounter::constructionCount);
- EXPECT_EQ(1u, ConstructorDestructorCounter::destructionCount);
-}
-
-TEST(WTF_HashSet, OwnPtrKey_TakeUsingRawPointer)
-{
- ConstructorDestructorCounter::TestingScope scope;
-
- HashSet<OwnPtr<ConstructorDestructorCounter>> set;
-
- OwnPtr<ConstructorDestructorCounter> ownPtr = adoptPtr(new ConstructorDestructorCounter);
- ConstructorDestructorCounter* ptr = ownPtr.get();
- set.add(WTF::move(ownPtr));
-
- EXPECT_EQ(1u, ConstructorDestructorCounter::constructionCount);
- EXPECT_EQ(0u, ConstructorDestructorCounter::destructionCount);
-
- auto result = set.take(ptr);
- EXPECT_EQ(ptr, result.get());
-
- EXPECT_EQ(1u, ConstructorDestructorCounter::constructionCount);
- EXPECT_EQ(0u, ConstructorDestructorCounter::destructionCount);
-
- result = nullptr;
-
- EXPECT_EQ(1u, ConstructorDestructorCounter::constructionCount);
- EXPECT_EQ(1u, ConstructorDestructorCounter::destructionCount);
-}
TEST(WTF_HashSet, UniquePtrKey)
{
#include <WebCore/COMPtr.h>
#include <WebKit/WebKit.h>
#include <WebKit/WebKitCOMAPI.h>
-#include <wtf/PassOwnPtr.h>
namespace TestWebKitAPI {
#include "PlatformUtilities.h"
#include "PlatformWebView.h"
-#include <wtf/OwnPtr.h>
-#include <wtf/PassOwnPtr.h>
namespace TestWebKitAPI {
}
WKRetainPtr<WKContextRef> context;
- OwnPtr<PlatformWebView> webView;
+ std::unique_ptr<PlatformWebView> webView;
WKRetainPtr<WKTypeRef> recievedBody;
context = adoptWK(Util::createContextForInjectedBundleTest("UserMessageTest"));
setInjectedBundleClient(context.get(), this);
- webView = adoptPtr(new PlatformWebView(context.get()));
+ webView = std::make_unique<PlatformWebView>(context.get());
setPageLoaderClient(webView->page(), this);
didFinishLoad = false;
#include "PlatformUtilities.h"
#include "PlatformWebView.h"
-#include <wtf/OwnPtr.h>
-#include <wtf/PassOwnPtr.h>
namespace TestWebKitAPI {
}
WKRetainPtr<WKContextRef> context;
- OwnPtr<PlatformWebView> webView;
+ std::unique_ptr<PlatformWebView> webView;
WKRetainPtr<WKStringRef> messageName;
WKRetainPtr<WKTypeRef> messageBody;
context = adoptWK(Util::createContextForInjectedBundleTest("WillLoadTest"));
setInjectedBundleClient(context.get(), this);
- webView = adoptPtr(new PlatformWebView(context.get()));
+ webView = std::make_unique<PlatformWebView>(context.get());
didReceiveMessage = false;
}
class WebKitDOMDOMWindowTest : public WebProcessTest {
public:
- static PassOwnPtr<WebProcessTest> create() { return adoptPtr(new WebKitDOMDOMWindowTest()); }
+ static std::unique_ptr<WebProcessTest> create() { return std::make_unique<WebKitDOMDOMWindowTest>(); }
private:
guint64 webPageFromArgs(GVariant* args)
#include <string.h>
#include <webkit2/webkit-web-extension.h>
#include <wtf/Deque.h>
-#include <wtf/OwnPtr.h>
-#include <wtf/PassOwnPtr.h>
#include <wtf/ProcessID.h>
#include <wtf/gobject/GRefPtr.h>
#include <wtf/gobject/GUniquePtr.h>
CString uri;
};
-Deque<OwnPtr<DelayedSignal>> delayedSignalsQueue;
+Deque<DelayedSignal> delayedSignalsQueue;
static void emitDocumentLoaded(GDBusConnection* connection)
{
if (data)
emitDocumentLoaded(G_DBUS_CONNECTION(data));
else
- delayedSignalsQueue.append(adoptPtr(new DelayedSignal(DocumentLoadedSignal)));
+ delayedSignalsQueue.append(DelayedSignal(DocumentLoadedSignal));
}
static void emitURIChanged(GDBusConnection* connection, const char* uri)
if (data)
emitURIChanged(G_DBUS_CONNECTION(data), webkit_web_page_get_uri(webPage));
else
- delayedSignalsQueue.append(adoptPtr(new DelayedSignal(URIChangedSignal, webkit_web_page_get_uri(webPage))));
+ delayedSignalsQueue.append(DelayedSignal(URIChangedSignal, webkit_web_page_get_uri(webPage)));
}
static gboolean sendRequestCallback(WebKitWebPage*, WebKitURIRequest* request, WebKitURIResponse* redirectResponse, gpointer)
g_object_set_data(G_OBJECT(userData), "dbus-connection", connection);
while (delayedSignalsQueue.size()) {
- OwnPtr<DelayedSignal> delayedSignal = delayedSignalsQueue.takeFirst();
- switch (delayedSignal->type) {
+ DelayedSignal delayedSignal = delayedSignalsQueue.takeFirst();
+ switch (delayedSignal.type) {
case DocumentLoadedSignal:
emitDocumentLoaded(connection);
break;
case URIChangedSignal:
- emitURIChanged(connection, delayedSignal->uri.data());
+ emitURIChanged(connection, delayedSignal.uri.data());
break;
}
}