Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (102729 => 102730)
--- trunk/Source/_javascript_Core/ChangeLog 2011-12-14 02:56:11 UTC (rev 102729)
+++ trunk/Source/_javascript_Core/ChangeLog 2011-12-14 03:12:15 UTC (rev 102730)
@@ -1,3 +1,35 @@
+2011-12-13 Anders Carlsson <[email protected]>
+
+ Add a very bare-bones implementation of bind and Function to WTF
+ https://bugs.webkit.org/show_bug.cgi?id=74462
+
+ Reviewed by Sam Weinig.
+
+ In order to make it easier to package up function calls and send them across
+ threads, add a (currently very simple) implementation of WTF::bind and WTF::Function to a new
+ wtf/Functional.h header.
+
+ Currently, all bind can do is bind a nullary function and return a Function object that can be called and copied,
+ but I'll add more as the need arises.
+
+ * GNUmakefile.list.am:
+ * _javascript_Core.gypi:
+ * _javascript_Core.vcproj/WTF/WTF.vcproj:
+ * _javascript_Core.xcodeproj/project.pbxproj:
+ * wtf/Functional.h: Added.
+ (WTF::R):
+ (WTF::FunctionImplBase::~FunctionImplBase):
+ (WTF::FunctionWrapper::ResultType):
+ (WTF::FunctionBase::isNull):
+ (WTF::FunctionBase::FunctionBase):
+ (WTF::FunctionBase::impl):
+ (WTF::bind):
+ * wtf/MainThread.cpp:
+ (WTF::callFunctionObject):
+ (WTF::callOnMainThread):
+ * wtf/MainThread.h:
+ * wtf/wtf.pro:
+
2011-12-13 Geoffrey Garen <[email protected]>
<rdar://problem/10577239> GC Crash introduced in r102545
Modified: trunk/Source/_javascript_Core/GNUmakefile.list.am (102729 => 102730)
--- trunk/Source/_javascript_Core/GNUmakefile.list.am 2011-12-14 02:56:11 UTC (rev 102729)
+++ trunk/Source/_javascript_Core/GNUmakefile.list.am 2011-12-14 03:12:15 UTC (rev 102730)
@@ -560,6 +560,7 @@
Source/_javascript_Core/wtf/Float32Array.h \
Source/_javascript_Core/wtf/Float64Array.h \
Source/_javascript_Core/wtf/Forward.h \
+ Source/_javascript_Core/wtf/Functional.h \
Source/_javascript_Core/wtf/GetPtr.h \
Source/_javascript_Core/wtf/gobject/GOwnPtr.cpp \
Source/_javascript_Core/wtf/gobject/GOwnPtr.h \
Modified: trunk/Source/_javascript_Core/_javascript_Core.gypi (102729 => 102730)
--- trunk/Source/_javascript_Core/_javascript_Core.gypi 2011-12-14 02:56:11 UTC (rev 102729)
+++ trunk/Source/_javascript_Core/_javascript_Core.gypi 2011-12-14 03:12:15 UTC (rev 102730)
@@ -159,6 +159,7 @@
'wtf/FastMalloc.h',
'wtf/FixedArray.h',
'wtf/Forward.h',
+ 'wtf/Functional.h',
'wtf/GetPtr.h',
'wtf/HashCountedSet.h',
'wtf/HashFunctions.h',
Modified: trunk/Source/_javascript_Core/_javascript_Core.vcproj/WTF/WTF.vcproj (102729 => 102730)
--- trunk/Source/_javascript_Core/_javascript_Core.vcproj/WTF/WTF.vcproj 2011-12-14 02:56:11 UTC (rev 102729)
+++ trunk/Source/_javascript_Core/_javascript_Core.vcproj/WTF/WTF.vcproj 2011-12-14 03:12:15 UTC (rev 102730)
@@ -817,6 +817,10 @@
>
</File>
<File
+ RelativePath="..\..\wtf\Functional.h"
+ >
+ </File>
+ <File
RelativePath="..\..\wtf\GetPtr.h"
>
</File>
Modified: trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj (102729 => 102730)
--- trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj 2011-12-14 02:56:11 UTC (rev 102729)
+++ trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj 2011-12-14 03:12:15 UTC (rev 102730)
@@ -264,6 +264,7 @@
18BAB55410DAE066000D945B /* ThreadIdentifierDataPthreads.h in Headers */ = {isa = PBXBuildFile; fileRef = 18BAB52810DADFCD000D945B /* ThreadIdentifierDataPthreads.h */; };
1A082779142168D70090CCAC /* BinarySemaphore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A082777142168D70090CCAC /* BinarySemaphore.cpp */; };
1A08277A142168D70090CCAC /* BinarySemaphore.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A082778142168D70090CCAC /* BinarySemaphore.h */; };
+ 1AA9E5511498093500001A8A /* Functional.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AA9E5501498093500001A8A /* Functional.h */; settings = {ATTRIBUTES = (Private, ); }; };
2CFC5D1E12F45B48004914E2 /* CharacterNames.h in Headers */ = {isa = PBXBuildFile; fileRef = 2CFC5B7A12F44714004914E2 /* CharacterNames.h */; settings = {ATTRIBUTES = (Private, ); }; };
41359CF30FDD89AD00206180 /* DateConversion.h in Headers */ = {isa = PBXBuildFile; fileRef = D21202290AD4310C00ED79B6 /* DateConversion.h */; };
41359CF60FDD89CB00206180 /* DateMath.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41359CF40FDD89CB00206180 /* DateMath.cpp */; };
@@ -1006,6 +1007,7 @@
18BAB52810DADFCD000D945B /* ThreadIdentifierDataPthreads.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThreadIdentifierDataPthreads.h; sourceTree = "<group>"; };
1A082777142168D70090CCAC /* BinarySemaphore.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BinarySemaphore.cpp; sourceTree = "<group>"; };
1A082778142168D70090CCAC /* BinarySemaphore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BinarySemaphore.h; sourceTree = "<group>"; };
+ 1AA9E5501498093500001A8A /* Functional.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Functional.h; sourceTree = "<group>"; };
1C9051420BA9E8A70081E9D0 /* Version.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Version.xcconfig; sourceTree = "<group>"; };
1C9051430BA9E8A70081E9D0 /* _javascript_Core.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = _javascript_Core.xcconfig; path = ../Configurations/_javascript_Core.xcconfig; sourceTree = "<group>"; };
1C9051440BA9E8A70081E9D0 /* DebugRelease.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = DebugRelease.xcconfig; sourceTree = "<group>"; };
@@ -1944,6 +1946,7 @@
A73BE159148420520091204B /* Float32Array.h */,
A73BE15B148420520091204B /* Float64Array.h */,
935AF46909E9D9DB00ACD1D8 /* Forward.h */,
+ 1AA9E5501498093500001A8A /* Functional.h */,
93B6A0DE0AA64DA40076DE27 /* GetPtr.h */,
657EEBBF094E445E008C9C7B /* HashCountedSet.h */,
65DFC92A08EA173A00F7300B /* HashFunctions.h */,
@@ -2988,6 +2991,7 @@
A73BE180148420A80091204B /* IntegralTypedArrayBase.h in Headers */,
860BD801148EA6F200112B2F /* Intrinsic.h in Headers */,
0FBC0AE81496C7C700D4FBDD /* DFGExitProfile.h in Headers */,
+ 1AA9E5511498093500001A8A /* Functional.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Added: trunk/Source/_javascript_Core/wtf/Functional.h (0 => 102730)
--- trunk/Source/_javascript_Core/wtf/Functional.h (rev 0)
+++ trunk/Source/_javascript_Core/wtf/Functional.h 2011-12-14 03:12:15 UTC (rev 102730)
@@ -0,0 +1,155 @@
+/*
+ * 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.
+ */
+
+#ifndef WTF_Functional_h
+#define WTF_Functional_h
+
+#include "Assertions.h"
+#include "PassRefPtr.h"
+#include "RefPtr.h"
+#include "ThreadSafeRefCounted.h"
+
+namespace WTF {
+
+// Functional.h provides a very simple way to bind a function pointer and arguments together into a function object
+// that can be stored, copied and invoked, similar to how boost::bind and std::bind in C++11.
+// The implementation is currently very simple, but the goal is to replace WorkItem in WebKit2 and make it easier to
+// package up and invoke function calls inside WebCore.
+
+// A FunctionWrapper is a class template that can wrap a function pointer or a member function pointer and
+// provide a unified interface for calling that function.
+template<typename> class FunctionWrapper;
+
+template<typename R> class FunctionWrapper<R (*)()> {
+public:
+ typedef R ResultType;
+
+ explicit FunctionWrapper(R (*function)())
+ : m_function(function)
+ {
+ }
+
+ R operator()()
+ {
+ return m_function();
+ }
+
+private:
+ R (*m_function)();
+};
+
+class FunctionImplBase : public ThreadSafeRefCounted<FunctionImplBase> {
+public:
+ virtual ~FunctionImplBase() { }
+};
+
+template<typename>
+class FunctionImpl;
+
+template<typename R>
+class FunctionImpl<R ()> : public FunctionImplBase {
+public:
+ virtual R operator()() = 0;
+};
+
+template<typename FunctionWrapper, typename FunctionType>
+class BoundFunctionImpl;
+
+template<typename FunctionWrapper> class BoundFunctionImpl<FunctionWrapper, typename FunctionWrapper::ResultType ()> : public FunctionImpl<typename FunctionWrapper::ResultType ()> {
+public:
+ explicit BoundFunctionImpl(FunctionWrapper functionWrapper)
+ : m_functionWrapper(functionWrapper)
+ {
+ }
+
+ virtual typename FunctionWrapper::ResultType operator()()
+ {
+ return m_functionWrapper();
+ }
+
+private:
+ FunctionWrapper m_functionWrapper;
+};
+
+class FunctionBase {
+public:
+ bool isNull() const
+ {
+ return !m_impl;
+ }
+
+protected:
+ FunctionBase()
+ {
+ }
+
+ explicit FunctionBase(PassRefPtr<FunctionImplBase> impl)
+ : m_impl(impl)
+ {
+ }
+
+ template<typename FunctionType> FunctionImpl<FunctionType>* impl() const
+ {
+ return static_cast<FunctionImpl<FunctionType>*>(m_impl.get());
+ }
+
+private:
+ RefPtr<FunctionImplBase> m_impl;
+};
+
+template<typename> class Function;
+
+template<typename R>
+class Function<R ()> : public FunctionBase {
+public:
+ Function()
+ {
+ }
+
+ Function(PassRefPtr<FunctionImpl<R ()> > impl)
+ : FunctionBase(impl)
+ {
+ }
+
+ R operator()()
+ {
+ ASSERT(!isNull());
+
+ return impl<R ()>()->operator()();
+ }
+};
+
+template<typename FunctionType>
+Function<typename FunctionWrapper<FunctionType>::ResultType ()> bind(FunctionType function)
+{
+ return Function<typename FunctionWrapper<FunctionType>::ResultType ()>(adoptRef(new BoundFunctionImpl<FunctionWrapper<FunctionType>, typename FunctionWrapper<FunctionType>::ResultType ()>(FunctionWrapper<FunctionType>(function))));
+}
+
+}
+
+using WTF::Function;
+using WTF::bind;
+
+#endif // WTF_Functional_h
Modified: trunk/Source/_javascript_Core/wtf/MainThread.cpp (102729 => 102730)
--- trunk/Source/_javascript_Core/wtf/MainThread.cpp 2011-12-14 02:56:11 UTC (rev 102729)
+++ trunk/Source/_javascript_Core/wtf/MainThread.cpp 2011-12-14 03:12:15 UTC (rev 102730)
@@ -31,6 +31,7 @@
#include "CurrentTime.h"
#include "Deque.h"
+#include "Functional.h"
#include "StdLibExtras.h"
#include "Threading.h"
@@ -216,6 +217,18 @@
}
}
+static void callFunctionObject(void* context)
+{
+ Function<void ()>* function = static_cast<Function<void ()>*>(context);
+ (*function)();
+ delete function;
+}
+
+void callOnMainThread(const Function<void ()>& function)
+{
+ callOnMainThread(callFunctionObject, new Function<void ()>(function));
+}
+
void setMainThreadCallbacksPaused(bool paused)
{
ASSERT(isMainThread());
Modified: trunk/Source/_javascript_Core/wtf/MainThread.h (102729 => 102730)
--- trunk/Source/_javascript_Core/wtf/MainThread.h 2011-12-14 02:56:11 UTC (rev 102729)
+++ trunk/Source/_javascript_Core/wtf/MainThread.h 2011-12-14 03:12:15 UTC (rev 102730)
@@ -46,6 +46,9 @@
void callOnMainThreadAndWait(MainThreadFunction*, void* context);
void cancelCallOnMainThread(MainThreadFunction*, void* context);
+template<typename> class Function;
+void callOnMainThread(const Function<void ()>&);
+
void setMainThreadCallbacksPaused(bool paused);
bool isMainThread();
Modified: trunk/Source/_javascript_Core/wtf/wtf.pro (102729 => 102730)
--- trunk/Source/_javascript_Core/wtf/wtf.pro 2011-12-14 02:56:11 UTC (rev 102729)
+++ trunk/Source/_javascript_Core/wtf/wtf.pro 2011-12-14 03:12:15 UTC (rev 102730)
@@ -65,6 +65,7 @@
Float32Array.h \
Float64Array.h \
Forward.h \
+ Functional.h \
GetPtr.h \
HashCountedSet.h \
HashFunctions.h \
Modified: trunk/Source/WebCore/ChangeLog (102729 => 102730)
--- trunk/Source/WebCore/ChangeLog 2011-12-14 02:56:11 UTC (rev 102729)
+++ trunk/Source/WebCore/ChangeLog 2011-12-14 03:12:15 UTC (rev 102730)
@@ -1,3 +1,14 @@
+2011-12-13 Anders Carlsson <[email protected]>
+
+ Add a very bare-bones implementation of bind and Function to WTF
+ https://bugs.webkit.org/show_bug.cgi?id=74462
+
+ Reviewed by Sam Weinig.
+
+ Add a forwarding header for Functional.h.
+
+ * ForwardingHeaders/wtf/Functional.h: Added.
+
2011-12-13 Adrienne Walker <[email protected]>
[chromium] Use HashMap<..., OwnPtr<Tile>> for compositor tilemap
Added: trunk/Source/WebCore/ForwardingHeaders/wtf/Functional.h (0 => 102730)
--- trunk/Source/WebCore/ForwardingHeaders/wtf/Functional.h (rev 0)
+++ trunk/Source/WebCore/ForwardingHeaders/wtf/Functional.h 2011-12-14 03:12:15 UTC (rev 102730)
@@ -0,0 +1,4 @@
+#ifndef WebCore_FWD_Functional_h
+#define WebCore_FWD_Functional_h
+#include <_javascript_Core/Functional.h>
+#endif
Modified: trunk/Tools/ChangeLog (102729 => 102730)
--- trunk/Tools/ChangeLog 2011-12-14 02:56:11 UTC (rev 102729)
+++ trunk/Tools/ChangeLog 2011-12-14 03:12:15 UTC (rev 102730)
@@ -1,3 +1,19 @@
+2011-12-13 Anders Carlsson <[email protected]>
+
+ Add a very bare-bones implementation of bind and Function to WTF
+ https://bugs.webkit.org/show_bug.cgi?id=74462
+
+ Reviewed by Sam Weinig.
+
+ Add basic tests for WTF::Function and WTF::bind.
+
+ * TestWebKitAPI/TestWebKitAPI.gypi:
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/Functional.cpp: Added.
+ (TestWebKitAPI::returnFortyTwo):
+ (TestWebKitAPI::TEST):
+ * TestWebKitAPI/win/TestWebKitAPI.vcproj:
+
2011-12-13 Robin Dunn <[email protected]>
[wx] Add a URL argument to wxWebView constructor.
Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.gypi (102729 => 102730)
--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.gypi 2011-12-14 02:56:11 UTC (rev 102729)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.gypi 2011-12-14 03:12:15 UTC (rev 102730)
@@ -32,6 +32,7 @@
'variables': {
'TestWebKitAPI_files': [
'Tests/WTF/CheckedArithmeticOperations.cpp',
+ 'Tests/WTF/Functional.cpp',
'Tests/WTF/HashMap.cpp',
'Tests/WTF/RedBlackTree.cpp',
'Tests/WTF/StringBuilder.cpp',
Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (102729 => 102730)
--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2011-12-14 02:56:11 UTC (rev 102729)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2011-12-14 03:12:15 UTC (rev 102730)
@@ -7,14 +7,15 @@
objects = {
/* Begin PBXBuildFile section */
+ 0BCD833514857CE400EA2003 /* HashMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0BCD833414857CE400EA2003 /* HashMap.cpp */; };
0BCD856A1485C98B00EA2003 /* TemporaryChange.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0BCD85691485C98B00EA2003 /* TemporaryChange.cpp */; };
0FC6C4CC141027E0005B7F0C /* RedBlackTree.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FC6C4CB141027E0005B7F0C /* RedBlackTree.cpp */; };
- 0BCD833514857CE400EA2003 /* HashMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0BCD833414857CE400EA2003 /* HashMap.cpp */; };
0FC6C4CF141034AD005B7F0C /* MetaAllocator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FC6C4CE141034AD005B7F0C /* MetaAllocator.cpp */; };
1A02C84F125D4A8400E3F4BD /* Find.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A02C84E125D4A8400E3F4BD /* Find.cpp */; };
1A02C870125D4CFD00E3F4BD /* find.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 1A02C84B125D4A5E00E3F4BD /* find.html */; };
1A5FEFDD1270E2A3000E2921 /* EvaluateJavaScript.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A5FEFDC1270E2A3000E2921 /* EvaluateJavaScript.cpp */; };
1A9E52C913E65EF4006917F5 /* 18-characters.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = C045F9461385C2F800C0F3CD /* 18-characters.html */; };
+ 1AA9E55914980A9900001A8A /* Functional.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AA9E55714980A9900001A8A /* Functional.cpp */; };
1ADBEFAE130C689C00D61D19 /* ForceRepaint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1ADBEFAD130C689C00D61D19 /* ForceRepaint.cpp */; };
1ADBEFE3130C6AA100D61D19 /* simple-accelerated-compositing.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 1ADBEFBC130C6A0100D61D19 /* simple-accelerated-compositing.html */; };
1AEDE22613E5E7E700E62FE8 /* InjectedBundleControllerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AEDE22413E5E7A000E62FE8 /* InjectedBundleControllerMac.mm */; };
@@ -152,13 +153,14 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
+ 0BCD833414857CE400EA2003 /* HashMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = HashMap.cpp; path = WTF/HashMap.cpp; sourceTree = "<group>"; };
0BCD85691485C98B00EA2003 /* TemporaryChange.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TemporaryChange.cpp; path = WTF/TemporaryChange.cpp; sourceTree = "<group>"; };
0FC6C4CB141027E0005B7F0C /* RedBlackTree.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RedBlackTree.cpp; path = WTF/RedBlackTree.cpp; sourceTree = "<group>"; };
- 0BCD833414857CE400EA2003 /* HashMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = HashMap.cpp; path = WTF/HashMap.cpp; sourceTree = "<group>"; };
0FC6C4CE141034AD005B7F0C /* MetaAllocator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MetaAllocator.cpp; path = WTF/MetaAllocator.cpp; sourceTree = "<group>"; };
1A02C84B125D4A5E00E3F4BD /* find.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = find.html; sourceTree = "<group>"; };
1A02C84E125D4A8400E3F4BD /* Find.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Find.cpp; sourceTree = "<group>"; };
1A5FEFDC1270E2A3000E2921 /* EvaluateJavaScript.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EvaluateJavaScript.cpp; sourceTree = "<group>"; };
+ 1AA9E55714980A9900001A8A /* Functional.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Functional.cpp; path = WTF/Functional.cpp; sourceTree = "<group>"; };
1ADBEFAD130C689C00D61D19 /* ForceRepaint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ForceRepaint.cpp; sourceTree = "<group>"; };
1ADBEFBC130C6A0100D61D19 /* simple-accelerated-compositing.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "simple-accelerated-compositing.html"; sourceTree = "<group>"; };
1AEDE22413E5E7A000E62FE8 /* InjectedBundleControllerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = InjectedBundleControllerMac.mm; sourceTree = "<group>"; };
@@ -439,6 +441,7 @@
0FC6C4CE141034AD005B7F0C /* MetaAllocator.cpp */,
0FC6C4CB141027E0005B7F0C /* RedBlackTree.cpp */,
A7A966DA140ECCC8005EF9B4 /* CheckedArithmeticOperations.cpp */,
+ 1AA9E55714980A9900001A8A /* Functional.cpp */,
0BCD833414857CE400EA2003 /* HashMap.cpp */,
81B50192140F232300D9EB58 /* StringBuilder.cpp */,
C01363C713C3997300EF3964 /* StringOperators.cpp */,
@@ -695,6 +698,7 @@
BC029B181486AD6400817DA9 /* RetainPtr.cpp in Sources */,
BC029B1C1486B25900817DA9 /* RetainPtr.mm in Sources */,
BC901E241492ADCE0074A667 /* WKConnection.cpp in Sources */,
+ 1AA9E55914980A9900001A8A /* Functional.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Added: trunk/Tools/TestWebKitAPI/Tests/WTF/Functional.cpp (0 => 102730)
--- trunk/Tools/TestWebKitAPI/Tests/WTF/Functional.cpp (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/Functional.cpp 2011-12-14 03:12:15 UTC (rev 102730)
@@ -0,0 +1,46 @@
+/*
+ * 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 "config.h"
+#include <wtf/Functional.h>
+
+namespace TestWebKitAPI {
+
+static int returnFortyTwo()
+{
+ return 42;
+}
+
+TEST(FunctionalTest, Basic)
+{
+ Function<int()> emptyFunction;
+ ASSERT_TRUE(emptyFunction.isNull());
+
+ Function<int()> returnFortyTwoFunction = bind(returnFortyTwo);
+ ASSERT_FALSE(returnFortyTwoFunction.isNull());
+ ASSERT_EQ(42, returnFortyTwoFunction());
+}
+
+} // namespace TestWebKitAPI
Modified: trunk/Tools/TestWebKitAPI/win/TestWebKitAPI.vcproj (102729 => 102730)
--- trunk/Tools/TestWebKitAPI/win/TestWebKitAPI.vcproj 2011-12-14 02:56:11 UTC (rev 102729)
+++ trunk/Tools/TestWebKitAPI/win/TestWebKitAPI.vcproj 2011-12-14 03:12:15 UTC (rev 102730)
@@ -640,6 +640,10 @@
>
</File>
<File
+ RelativePath="..\Tests\WTF\Functional.cpp"
+ >
+ </File>
+ <File
RelativePath="..\Tests\WTF\HashMap.cpp"
>
</File>