Title: [181376] releases/WebKitGTK/webkit-2.8/Source/WTF
Revision
181376
Author
carlo...@webkit.org
Date
2015-03-11 02:38:16 -0700 (Wed, 11 Mar 2015)

Log Message

Merge r180814 - Remove unused PossiblyNull
https://bugs.webkit.org/show_bug.cgi?id=142124

Reviewed by Andreas Kling.

* WTF.vcxproj/WTF.vcxproj: Removed the file.
* WTF.vcxproj/WTF.vcxproj.filters: Ditto.
* WTF.xcodeproj/project.pbxproj: Ditto.
* wtf/CMakeLists.txt: Ditto.
* wtf/PossiblyNull.h: Removed.

* wtf/FastMalloc.h: Moved everything to the left.
Moved member functions out of the TryMallocReturnValue class definition.
(WTF::TryMallocReturnValue::operator PossiblyNull<T>): Deleted.
(WTF::TryMallocReturnValue::getValue): Marked inline, changed to work
only with pointer types, not arbitrary non-pointer types.

Modified Paths

Removed Paths

Diff

Modified: releases/WebKitGTK/webkit-2.8/Source/WTF/ChangeLog (181375 => 181376)


--- releases/WebKitGTK/webkit-2.8/Source/WTF/ChangeLog	2015-03-11 09:11:05 UTC (rev 181375)
+++ releases/WebKitGTK/webkit-2.8/Source/WTF/ChangeLog	2015-03-11 09:38:16 UTC (rev 181376)
@@ -1,3 +1,22 @@
+2015-02-27  Darin Adler  <da...@apple.com>
+
+        Remove unused PossiblyNull
+        https://bugs.webkit.org/show_bug.cgi?id=142124
+
+        Reviewed by Andreas Kling.
+
+        * WTF.vcxproj/WTF.vcxproj: Removed the file.
+        * WTF.vcxproj/WTF.vcxproj.filters: Ditto.
+        * WTF.xcodeproj/project.pbxproj: Ditto.
+        * wtf/CMakeLists.txt: Ditto.
+        * wtf/PossiblyNull.h: Removed.
+
+        * wtf/FastMalloc.h: Moved everything to the left.
+        Moved member functions out of the TryMallocReturnValue class definition.
+        (WTF::TryMallocReturnValue::operator PossiblyNull<T>): Deleted.
+        (WTF::TryMallocReturnValue::getValue): Marked inline, changed to work
+        only with pointer types, not arbitrary non-pointer types.
+
 2015-03-09  Mark Lam  <mark....@apple.com>
 
         8-bit version of weakCompareAndSwap() can cause an infinite loop.

Modified: releases/WebKitGTK/webkit-2.8/Source/WTF/WTF.vcxproj/WTF.vcxproj (181375 => 181376)


--- releases/WebKitGTK/webkit-2.8/Source/WTF/WTF.vcxproj/WTF.vcxproj	2015-03-11 09:11:05 UTC (rev 181375)
+++ releases/WebKitGTK/webkit-2.8/Source/WTF/WTF.vcxproj/WTF.vcxproj	2015-03-11 09:38:16 UTC (rev 181376)
@@ -253,7 +253,6 @@
     <ClInclude Include="..\wtf\PassRef.h" />
     <ClInclude Include="..\wtf\PassRefPtr.h" />
     <ClInclude Include="..\wtf\Platform.h" />
-    <ClInclude Include="..\wtf\PossiblyNull.h" />
     <ClInclude Include="..\wtf\PrintStream.h" />
     <ClInclude Include="..\wtf\RAMSize.h" />
     <ClInclude Include="..\wtf\RandomNumber.h" />
@@ -776,4 +775,4 @@
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
   </ImportGroup>
-</Project>
\ No newline at end of file
+</Project>

Modified: releases/WebKitGTK/webkit-2.8/Source/WTF/WTF.vcxproj/WTF.vcxproj.filters (181375 => 181376)


--- releases/WebKitGTK/webkit-2.8/Source/WTF/WTF.vcxproj/WTF.vcxproj.filters	2015-03-11 09:11:05 UTC (rev 181375)
+++ releases/WebKitGTK/webkit-2.8/Source/WTF/WTF.vcxproj/WTF.vcxproj.filters	2015-03-11 09:38:16 UTC (rev 181376)
@@ -567,9 +567,6 @@
     <ClInclude Include="..\wtf\Platform.h">
       <Filter>wtf</Filter>
     </ClInclude>
-    <ClInclude Include="..\wtf\PossiblyNull.h">
-      <Filter>wtf</Filter>
-    </ClInclude>
     <ClInclude Include="..\wtf\PrintStream.h">
       <Filter>wtf</Filter>
     </ClInclude>
@@ -733,4 +730,4 @@
     <None Include="WTFPostBuild.cmd" />
     <None Include="WTFPreBuild.cmd" />
   </ItemGroup>
-</Project>
\ No newline at end of file
+</Project>

Modified: releases/WebKitGTK/webkit-2.8/Source/WTF/WTF.xcodeproj/project.pbxproj (181375 => 181376)


--- releases/WebKitGTK/webkit-2.8/Source/WTF/WTF.xcodeproj/project.pbxproj	2015-03-11 09:11:05 UTC (rev 181375)
+++ releases/WebKitGTK/webkit-2.8/Source/WTF/WTF.xcodeproj/project.pbxproj	2015-03-11 09:38:16 UTC (rev 181376)
@@ -199,7 +199,6 @@
 		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 */; };
-		A8A4740F151A825B004123FF /* PossiblyNull.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472F3151A825B004123FF /* PossiblyNull.h */; };
 		A8A47414151A825B004123FF /* RandomNumber.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A472FB151A825B004123FF /* RandomNumber.cpp */; };
 		A8A47415151A825B004123FF /* RandomNumber.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472FC151A825B004123FF /* RandomNumber.h */; };
 		A8A47416151A825B004123FF /* RandomNumberSeed.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472FD151A825B004123FF /* RandomNumberSeed.h */; };
@@ -495,7 +494,6 @@
 		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>"; };
-		A8A472F3151A825B004123FF /* PossiblyNull.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PossiblyNull.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>"; };
 		A8A472FD151A825B004123FF /* RandomNumberSeed.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RandomNumberSeed.h; sourceTree = "<group>"; };
@@ -822,7 +820,6 @@
 				93B1AA7F180E5AF3004A2F05 /* PassRef.h */,
 				A8A472ED151A825B004123FF /* PassRefPtr.h */,
 				A876DBD7151816E500DADB95 /* Platform.h */,
-				A8A472F3151A825B004123FF /* PossiblyNull.h */,
 				0F9D335D165DBA73005AD387 /* PrintStream.cpp */,
 				0F9D335E165DBA73005AD387 /* PrintStream.h */,
 				0FC4488216FE9FE100844BE9 /* ProcessID.h */,
@@ -1153,7 +1150,6 @@
 				A8A4740B151A825B004123FF /* PassOwnPtr.h in Headers */,
 				A8A4740C151A825B004123FF /* PassRefPtr.h in Headers */,
 				A876DBD8151816E500DADB95 /* Platform.h in Headers */,
-				A8A4740F151A825B004123FF /* PossiblyNull.h in Headers */,
 				0FB14E19180FA218009B6B4D /* Bag.h in Headers */,
 				0F9D3363165DBA73005AD387 /* PrintStream.h in Headers */,
 				0FC4488316FE9FE100844BE9 /* ProcessID.h in Headers */,

Modified: releases/WebKitGTK/webkit-2.8/Source/WTF/wtf/CMakeLists.txt (181375 => 181376)


--- releases/WebKitGTK/webkit-2.8/Source/WTF/wtf/CMakeLists.txt	2015-03-11 09:11:05 UTC (rev 181375)
+++ releases/WebKitGTK/webkit-2.8/Source/WTF/wtf/CMakeLists.txt	2015-03-11 09:38:16 UTC (rev 181376)
@@ -71,7 +71,6 @@
     PassRef.h
     PassRefPtr.h
     Platform.h
-    PossiblyNull.h
     PrintStream.h
     ProcessID.h
     RAMSize.h

Modified: releases/WebKitGTK/webkit-2.8/Source/WTF/wtf/FastMalloc.h (181375 => 181376)


--- releases/WebKitGTK/webkit-2.8/Source/WTF/wtf/FastMalloc.h	2015-03-11 09:11:05 UTC (rev 181375)
+++ releases/WebKitGTK/webkit-2.8/Source/WTF/wtf/FastMalloc.h	2015-03-11 09:38:16 UTC (rev 181376)
@@ -1,5 +1,5 @@
 /*
- *  Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ *  Copyright (C) 2005-2009, 2015 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
@@ -23,77 +23,79 @@
 
 #include <new>
 #include <stdlib.h>
-#include <wtf/PossiblyNull.h>
 #include <wtf/StdLibExtras.h>
 
 namespace WTF {
 
-    // These functions call CRASH() if an allocation fails.
-    WTF_EXPORT_PRIVATE void* fastMalloc(size_t);
-    WTF_EXPORT_PRIVATE void* fastZeroedMalloc(size_t);
-    WTF_EXPORT_PRIVATE void* fastCalloc(size_t numElements, size_t elementSize);
-    WTF_EXPORT_PRIVATE void* fastRealloc(void*, size_t);
-    WTF_EXPORT_PRIVATE char* fastStrDup(const char*);
-    WTF_EXPORT_PRIVATE size_t fastMallocSize(const void*);
-    WTF_EXPORT_PRIVATE size_t fastMallocGoodSize(size_t);
+class TryMallocReturnValue {
+public:
+    TryMallocReturnValue(void*);
+    TryMallocReturnValue(TryMallocReturnValue&&);
+    ~TryMallocReturnValue();
+    template<typename T> bool getValue(T*&) WARN_UNUSED_RETURN;
+private:
+    void operator=(TryMallocReturnValue&&) = delete;
+    mutable void* m_data;
+};
 
-    // Allocations from fastAlignedMalloc() must be freed using fastAlignedFree().
-    WTF_EXPORT_PRIVATE void* fastAlignedMalloc(size_t alignment, size_t);
-    WTF_EXPORT_PRIVATE void fastAlignedFree(void*);
+// These functions call CRASH() if an allocation fails.
+WTF_EXPORT_PRIVATE void* fastMalloc(size_t);
+WTF_EXPORT_PRIVATE void* fastZeroedMalloc(size_t);
+WTF_EXPORT_PRIVATE void* fastCalloc(size_t numElements, size_t elementSize);
+WTF_EXPORT_PRIVATE void* fastRealloc(void*, size_t);
+WTF_EXPORT_PRIVATE char* fastStrDup(const char*);
 
-    struct TryMallocReturnValue {
-        TryMallocReturnValue(void* data)
-            : m_data(data)
-        {
-        }
-        TryMallocReturnValue(const TryMallocReturnValue& source)
-            : m_data(source.m_data)
-        {
-            source.m_data = 0;
-        }
-        ~TryMallocReturnValue() { ASSERT(!m_data); }
-        template <typename T> bool getValue(T& data) WARN_UNUSED_RETURN;
-        template <typename T> operator PossiblyNull<T>()
-        { 
-            T value; 
-            getValue(value); 
-            return PossiblyNull<T>(value);
-        } 
-    private:
-        mutable void* m_data;
-    };
-    
-    template <typename T> bool TryMallocReturnValue::getValue(T& data)
-    {
-        union u { void* data; T target; } res;
-        res.data = ""
-        data = ""
-        bool returnValue = !!m_data;
-        m_data = 0;
-        return returnValue;
-    }
+WTF_EXPORT_PRIVATE TryMallocReturnValue tryFastMalloc(size_t);
+TryMallocReturnValue tryFastZeroedMalloc(size_t);
+WTF_EXPORT_PRIVATE TryMallocReturnValue tryFastCalloc(size_t numElements, size_t elementSize);
+WTF_EXPORT_PRIVATE TryMallocReturnValue tryFastRealloc(void*, size_t);
 
-    WTF_EXPORT_PRIVATE TryMallocReturnValue tryFastMalloc(size_t n);
-    TryMallocReturnValue tryFastZeroedMalloc(size_t n);
-    WTF_EXPORT_PRIVATE TryMallocReturnValue tryFastCalloc(size_t n_elements, size_t element_size);
-    WTF_EXPORT_PRIVATE TryMallocReturnValue tryFastRealloc(void* p, size_t n);
+WTF_EXPORT_PRIVATE void fastFree(void*);
 
-    WTF_EXPORT_PRIVATE void fastFree(void*);
+// Allocations from fastAlignedMalloc() must be freed using fastAlignedFree().
+WTF_EXPORT_PRIVATE void* fastAlignedMalloc(size_t alignment, size_t);
+WTF_EXPORT_PRIVATE void fastAlignedFree(void*);
 
-    WTF_EXPORT_PRIVATE void releaseFastMallocFreeMemory();
-    WTF_EXPORT_PRIVATE void releaseFastMallocFreeMemoryForThisThread();
-    
-    struct FastMallocStatistics {
-        size_t reservedVMBytes;
-        size_t committedVMBytes;
-        size_t freeListBytes;
-    };
-    WTF_EXPORT_PRIVATE FastMallocStatistics fastMallocStatistics();
+WTF_EXPORT_PRIVATE size_t fastMallocSize(const void*);
+WTF_EXPORT_PRIVATE size_t fastMallocGoodSize(size_t);
 
-    // This defines a type which holds an unsigned integer and is the same
-    // size as the minimally aligned memory allocation.
-    typedef unsigned long long AllocAlignmentInteger;
+WTF_EXPORT_PRIVATE void releaseFastMallocFreeMemory();
+WTF_EXPORT_PRIVATE void releaseFastMallocFreeMemoryForThisThread();
 
+struct FastMallocStatistics {
+    size_t reservedVMBytes;
+    size_t committedVMBytes;
+    size_t freeListBytes;
+};
+WTF_EXPORT_PRIVATE FastMallocStatistics fastMallocStatistics();
+
+// This defines a type which holds an unsigned integer and is the same
+// size as the minimally aligned memory allocation.
+typedef unsigned long long AllocAlignmentInteger;
+
+inline TryMallocReturnValue::TryMallocReturnValue(void* data)
+    : m_data(data)
+{
+}
+
+inline TryMallocReturnValue::TryMallocReturnValue(TryMallocReturnValue&& source)
+    : m_data(source.m_data)
+{
+    source.m_data = nullptr;
+}
+
+inline TryMallocReturnValue::~TryMallocReturnValue()
+{
+    ASSERT(!m_data);
+}
+
+template<typename T> inline bool TryMallocReturnValue::getValue(T*& data)
+{
+    data = ""
+    m_data = nullptr;
+    return data;
+}
+
 } // namespace WTF
 
 using WTF::fastCalloc;

Deleted: releases/WebKitGTK/webkit-2.8/Source/WTF/wtf/PossiblyNull.h (181375 => 181376)


--- releases/WebKitGTK/webkit-2.8/Source/WTF/wtf/PossiblyNull.h	2015-03-11 09:11:05 UTC (rev 181375)
+++ releases/WebKitGTK/webkit-2.8/Source/WTF/wtf/PossiblyNull.h	2015-03-11 09:38:16 UTC (rev 181376)
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2009 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 PossiblyNull_h
-#define PossiblyNull_h
-
-#include <wtf/Assertions.h>
-
-namespace WTF {
-
-template <typename T> struct PossiblyNull {
-    PossiblyNull(T data)
-        : m_data(data)
-    {
-    }
-    PossiblyNull(const PossiblyNull<T>& source)
-        : m_data(source.m_data)
-    {
-        source.m_data = 0;
-    }
-    ~PossiblyNull() { ASSERT(!m_data); }
-    bool getValue(T& out) WARN_UNUSED_RETURN;
-private:
-    mutable T m_data;
-};
-
-template <typename T> bool PossiblyNull<T>::getValue(T& out)
-{
-    out = m_data;
-    bool result = !!m_data;
-    m_data = 0;
-    return result;
-}
-
-}
-
-#endif
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to