Title: [89090] branches/safari-534-branch

Diff

Modified: branches/safari-534-branch/Source/_javascript_Core/ChangeLog (89089 => 89090)


--- branches/safari-534-branch/Source/_javascript_Core/ChangeLog	2011-06-16 23:53:23 UTC (rev 89089)
+++ branches/safari-534-branch/Source/_javascript_Core/ChangeLog	2011-06-17 00:19:55 UTC (rev 89090)
@@ -1,5 +1,19 @@
 2011-06-14  Lucas Forschler  <[email protected]>
 
+    Merged 88477.
+
+    2011-06-09  Dan Bernstein  <[email protected]>
+
+        Reviewed by Anders Carlsson.
+
+        Add Vector::reverse()
+        https://bugs.webkit.org/show_bug.cgi?id=62393
+
+        * wtf/Vector.h:
+        (WTF::Vector::reverse): Added
+
+2011-06-14  Lucas Forschler  <[email protected]>
+
     Merged 88833.
 
     2011-06-14  Stephanie Lewis  <[email protected]>

Modified: branches/safari-534-branch/Source/_javascript_Core/wtf/Vector.h (89089 => 89090)


--- branches/safari-534-branch/Source/_javascript_Core/wtf/Vector.h	2011-06-16 23:53:23 UTC (rev 89089)
+++ branches/safari-534-branch/Source/_javascript_Core/wtf/Vector.h	2011-06-17 00:19:55 UTC (rev 89090)
@@ -619,6 +619,8 @@
             m_buffer.swap(other.m_buffer);
         }
 
+        void reverse();
+
         void checkConsistency();
 
     private:
@@ -1097,6 +1099,13 @@
     }
 
     template<typename T, size_t inlineCapacity>
+    inline void Vector<T, inlineCapacity>::reverse()
+    {
+        for (size_t i = 0; i < m_size / 2; ++i)
+            std::swap(at(i), at(m_size - 1 - i));
+    }
+
+    template<typename T, size_t inlineCapacity>
     inline T* Vector<T, inlineCapacity>::releaseBuffer()
     {
         T* buffer = m_buffer.releaseBuffer();

Modified: branches/safari-534-branch/Tools/ChangeLog (89089 => 89090)


--- branches/safari-534-branch/Tools/ChangeLog	2011-06-16 23:53:23 UTC (rev 89089)
+++ branches/safari-534-branch/Tools/ChangeLog	2011-06-17 00:19:55 UTC (rev 89090)
@@ -1,5 +1,21 @@
 2011-06-14  Lucas Forschler  <[email protected]>
 
+    Merged 88477.
+
+    2011-06-09  Dan Bernstein  <[email protected]>
+
+        Reviewed by Anders Carlsson.
+
+        Added a test for Vector::reverse()
+        https://bugs.webkit.org/show_bug.cgi?id=62393
+
+        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+        * TestWebKitAPI/Tests/WTF/VectorReverse.cpp: Added.
+        (TestWebKitAPI::TEST):
+        * TestWebKitAPI/win/TestWebKitAPI.vcproj:
+
+2011-06-14  Lucas Forschler  <[email protected]>
+
     Merged 88857.
     Fix branch build tools break.  
 

Modified: branches/safari-534-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (89089 => 89090)


--- branches/safari-534-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2011-06-16 23:53:23 UTC (rev 89089)
+++ branches/safari-534-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2011-06-17 00:19:55 UTC (rev 89090)
@@ -16,6 +16,7 @@
 		33BE5AF5137B5A6C00705813 /* MouseMoveAfterCrash.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 33BE5AF4137B5A6C00705813 /* MouseMoveAfterCrash.cpp */; };
 		33BE5AF9137B5AAE00705813 /* MouseMoveAfterCrash_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 33BE5AF8137B5AAE00705813 /* MouseMoveAfterCrash_Bundle.cpp */; };
 		33E79E06137B5FD900E32D99 /* mouse-move-listener.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 33E79E05137B5FCE00E32D99 /* mouse-move-listener.html */; };
+		37200B9213A16230007A4FAD /* VectorReverse.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37200B9113A16230007A4FAD /* VectorReverse.cpp */; };
 		4BFDFFA71314776C0061F24B /* HitTestResultNodeHandle_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFDFFA61314776C0061F24B /* HitTestResultNodeHandle_Bundle.cpp */; };
 		4BFDFFA9131477770061F24B /* HitTestResultNodeHandle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFDFFA8131477770061F24B /* HitTestResultNodeHandle.cpp */; };
 		BC131885117114B600B69727 /* PlatformUtilitiesMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC131884117114B600B69727 /* PlatformUtilitiesMac.mm */; };
@@ -114,6 +115,7 @@
 		33BE5AF4137B5A6C00705813 /* MouseMoveAfterCrash.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MouseMoveAfterCrash.cpp; sourceTree = "<group>"; };
 		33BE5AF8137B5AAE00705813 /* MouseMoveAfterCrash_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MouseMoveAfterCrash_Bundle.cpp; sourceTree = "<group>"; };
 		33E79E05137B5FCE00E32D99 /* mouse-move-listener.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "mouse-move-listener.html"; sourceTree = "<group>"; };
+		37200B9113A16230007A4FAD /* VectorReverse.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = VectorReverse.cpp; path = WTF/VectorReverse.cpp; sourceTree = "<group>"; };
 		4BFDFFA61314776C0061F24B /* HitTestResultNodeHandle_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HitTestResultNodeHandle_Bundle.cpp; sourceTree = "<group>"; };
 		4BFDFFA8131477770061F24B /* HitTestResultNodeHandle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HitTestResultNodeHandle.cpp; sourceTree = "<group>"; };
 		8DD76FA10486AA7600D96B5E /* TestWebKitAPI */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = TestWebKitAPI; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -314,6 +316,7 @@
 			isa = PBXGroup;
 			children = (
 				BC90964B125561BF00083756 /* VectorBasic.cpp */,
+				37200B9113A16230007A4FAD /* VectorReverse.cpp */,
 			);
 			name = WTF;
 			sourceTree = "<group>";
@@ -461,6 +464,7 @@
 				BC246D9A132F1FE100B56D7C /* CanHandleRequest.cpp in Sources */,
 				F6F3F29113342FEB00A6BF19 /* CookieManager.cpp in Sources */,
 				33BE5AF5137B5A6C00705813 /* MouseMoveAfterCrash.cpp in Sources */,
+				37200B9213A16230007A4FAD /* VectorReverse.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};

Copied: branches/safari-534-branch/Tools/TestWebKitAPI/Tests/WTF/VectorReverse.cpp (from rev 88477, trunk/Tools/TestWebKitAPI/Tests/WTF/VectorReverse.cpp) (0 => 89090)


--- branches/safari-534-branch/Tools/TestWebKitAPI/Tests/WTF/VectorReverse.cpp	                        (rev 0)
+++ branches/safari-534-branch/Tools/TestWebKitAPI/Tests/WTF/VectorReverse.cpp	2011-06-17 00:19:55 UTC (rev 89090)
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2011 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. 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.
+ */
+
+#include "Test.h"
+
+#include <_javascript_Core/Vector.h>
+
+namespace TestWebKitAPI {
+
+TEST(WTF, VectorReverse)
+{
+    Vector<int> intVector;
+    intVector.append(10);
+    intVector.append(11);
+    intVector.append(12);
+    intVector.append(13);
+    intVector.reverse();
+
+    EXPECT_EQ(13, intVector[0]);
+    EXPECT_EQ(12, intVector[1]);
+    EXPECT_EQ(11, intVector[2]);
+    EXPECT_EQ(10, intVector[3]);
+
+    intVector.append(9);
+    intVector.reverse();
+
+    EXPECT_EQ(9, intVector[0]);
+    EXPECT_EQ(10, intVector[1]);
+    EXPECT_EQ(11, intVector[2]);
+    EXPECT_EQ(12, intVector[3]);
+    EXPECT_EQ(13, intVector[4]);
+}
+
+} // namespace TestWebKitAPI

Modified: branches/safari-534-branch/Tools/TestWebKitAPI/win/TestWebKitAPI.vcproj (89089 => 89090)


--- branches/safari-534-branch/Tools/TestWebKitAPI/win/TestWebKitAPI.vcproj	2011-06-16 23:53:23 UTC (rev 89089)
+++ branches/safari-534-branch/Tools/TestWebKitAPI/win/TestWebKitAPI.vcproj	2011-06-17 00:19:55 UTC (rev 89090)
@@ -583,6 +583,10 @@
 					RelativePath="..\Tests\WTF\VectorBasic.cpp"
 					>
 				</File>
+				<File
+					RelativePath="..\Tests\WTF\VectorReverse.cpp"
+					>
+				</File>
 			</Filter>
 		</Filter>
 		<File
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to