Diff
Modified: trunk/Source/WTF/ChangeLog (141218 => 141219)
--- trunk/Source/WTF/ChangeLog 2013-01-30 04:55:54 UTC (rev 141218)
+++ trunk/Source/WTF/ChangeLog 2013-01-30 05:17:40 UTC (rev 141219)
@@ -1,3 +1,23 @@
+2013-01-29 Mark Lam <[email protected]>
+
+ Introducing WTF::TypeSafeEnum and DatabaseError.
+ https://bugs.webkit.org/show_bug.cgi?id=108279.
+
+ Reviewed by Geoffrey Garen.
+
+ * WTF.xcodeproj/project.pbxproj:
+ * wtf/TypeSafeEnum.h: Added.
+ (WTF):
+ (TypeSafeEnum):
+ (WTF::TypeSafeEnum::TypeSafeEnum):
+ (WTF::TypeSafeEnum::value):
+ (WTF::TypeSafeEnum::operator==):
+ (WTF::TypeSafeEnum::operator!=):
+ (WTF::TypeSafeEnum::operator<):
+ (WTF::TypeSafeEnum::operator<=):
+ (WTF::TypeSafeEnum::operator>):
+ (WTF::TypeSafeEnum::operator>=):
+
2013-01-29 Sheriff Bot <[email protected]>
Unreviewed, rolling out r140983.
Modified: trunk/Source/WTF/WTF.xcodeproj/project.pbxproj (141218 => 141219)
--- trunk/Source/WTF/WTF.xcodeproj/project.pbxproj 2013-01-30 04:55:54 UTC (rev 141218)
+++ trunk/Source/WTF/WTF.xcodeproj/project.pbxproj 2013-01-30 05:17:40 UTC (rev 141219)
@@ -310,6 +310,7 @@
F3FBC720161AF7CD00BB4BD4 /* MemoryInstrumentationSequence.h in Headers */ = {isa = PBXBuildFile; fileRef = F3FBC71F161AF7CD00BB4BD4 /* MemoryInstrumentationSequence.h */; };
FEDACD3D1630F83F00C69634 /* StackStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FEDACD3B1630F83F00C69634 /* StackStats.cpp */; };
FEDACD3E1630F83F00C69634 /* StackStats.h in Headers */ = {isa = PBXBuildFile; fileRef = FEDACD3C1630F83F00C69634 /* StackStats.h */; };
+ FE43302716A7ADC300D1585D /* TypeSafeEnum.h in Headers */ = {isa = PBXBuildFile; fileRef = FE43302616A7ADC300D1585D /* TypeSafeEnum.h */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@@ -621,6 +622,7 @@
F3FBC71F161AF7CD00BB4BD4 /* MemoryInstrumentationSequence.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemoryInstrumentationSequence.h; sourceTree = "<group>"; };
FEDACD3B1630F83F00C69634 /* StackStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StackStats.cpp; sourceTree = "<group>"; };
FEDACD3C1630F83F00C69634 /* StackStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StackStats.h; sourceTree = "<group>"; };
+ FE43302616A7ADC300D1585D /* TypeSafeEnum.h */ = {isa = PBXFileReference; fileEncoding = 4; path = TypeSafeEnum.h; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -866,6 +868,7 @@
A8A4733E151A825B004123FF /* ThreadSafeRefCounted.h */,
A8A4733F151A825B004123FF /* ThreadSpecific.h */,
A8A47341151A825B004123FF /* TypedArrayBase.h */,
+ FE43302616A7ADC300D1585D /* TypeSafeEnum.h */,
A8A47342151A825B004123FF /* TypeTraits.cpp */,
A8A47343151A825B004123FF /* TypeTraits.h */,
A8A47346151A825B004123FF /* Uint16Array.h */,
@@ -1224,6 +1227,7 @@
A8A47454151A825B004123FF /* ThreadSafeRefCounted.h in Headers */,
A8A47455151A825B004123FF /* ThreadSpecific.h in Headers */,
A8A47457151A825B004123FF /* TypedArrayBase.h in Headers */,
+ FE43302716A7ADC300D1585D /* TypeSafeEnum.h in Headers */,
A8A47459151A825B004123FF /* TypeTraits.h in Headers */,
A8A4745C151A825B004123FF /* Uint16Array.h in Headers */,
A8A4745D151A825B004123FF /* Uint32Array.h in Headers */,
Added: trunk/Source/WTF/wtf/TypeSafeEnum.h (0 => 141219)
--- trunk/Source/WTF/wtf/TypeSafeEnum.h (rev 0)
+++ trunk/Source/WTF/wtf/TypeSafeEnum.h 2013-01-30 05:17:40 UTC (rev 141219)
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2013 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_TypeSafeEnum_h
+#define WTF_TypeSafeEnum_h
+
+namespace WTF {
+
+// How to define a type safe enum list using TypeSafeEnum?
+// ======================================================
+// Definition should be a struct that encapsulates an enum list.
+// The enum list should be names Enums.
+//
+// Here's an example of how to define a type safe enum named MyEnum using
+// the TypeSafeEnum template:
+//
+// struct MyEnumDefinition {
+// enum Enums {
+// ValueDefault,
+// Value1,
+// ...
+// ValueN
+// };
+// };
+// typedef TypeSafeEnum<MyEnumDefinition, MyEnumDefinition::ValueDefault> MyEnum;
+//
+// With that, you can now use MyEnum enum values as follow:
+//
+// MyEnum value1; // value1 is assigned MyEnum::ValueDefault by default.
+// MyEnum value2 = MyEnum::Value1; // value2 is assigned MyEnum::Value1;
+
+template <typename Definition, typename Definition::Enums defaultValue>
+class TypeSafeEnum : public Definition {
+ typedef enum Definition::Enums Value;
+public:
+ ALWAYS_INLINE TypeSafeEnum() : m_value(defaultValue) { }
+ ALWAYS_INLINE TypeSafeEnum(Value value) : m_value(value) { }
+
+ ALWAYS_INLINE Value value() const { return m_value; }
+
+ ALWAYS_INLINE bool operator==(const TypeSafeEnum other) { return m_value == other.m_value; }
+ ALWAYS_INLINE bool operator!=(const TypeSafeEnum other) { return m_value != other.m_value; }
+ ALWAYS_INLINE bool operator<(const TypeSafeEnum other) { return m_value < other.m_value; }
+ ALWAYS_INLINE bool operator<=(const TypeSafeEnum other) { return m_value <= other.m_value; }
+ ALWAYS_INLINE bool operator>(const TypeSafeEnum other) { return m_value > other.m_value; }
+ ALWAYS_INLINE bool operator>=(const TypeSafeEnum other) { return m_value >= other.m_value; }
+
+private:
+ Value m_value;
+};
+
+} // namespace WTF
+
+using WTF::TypeSafeEnum;
+
+#endif // WTF_TypeSafeEnum_h
Modified: trunk/Source/WebCore/ChangeLog (141218 => 141219)
--- trunk/Source/WebCore/ChangeLog 2013-01-30 04:55:54 UTC (rev 141218)
+++ trunk/Source/WebCore/ChangeLog 2013-01-30 05:17:40 UTC (rev 141219)
@@ -1,3 +1,24 @@
+2013-01-29 Mark Lam <[email protected]>
+
+ Introducing WTF::TypeSafeEnum and DatabaseError.
+ https://bugs.webkit.org/show_bug.cgi?id=108279.
+
+ Reviewed by Geoffrey Garen.
+
+ DatabaseError will be used later in the webdatabase refactoring effort.
+ It is currently unused.
+
+ No new tests.
+
+ * GNUmakefile.list.am:
+ * Modules/webdatabase/DatabaseError.h: Added.
+ (WebCore):
+ * Target.pri:
+ * WebCore.vcproj/WebCore.vcproj:
+ * WebCore.vcxproj/WebCore.vcxproj:
+ * WebCore.vcxproj/WebCore.vcxproj.filters:
+ * WebCore.xcodeproj/project.pbxproj:
+
2013-01-29 Elliott Sprehn <[email protected]>
Move ShadowRoot creation into ElementShadow
Modified: trunk/Source/WebCore/GNUmakefile.list.am (141218 => 141219)
--- trunk/Source/WebCore/GNUmakefile.list.am 2013-01-30 04:55:54 UTC (rev 141218)
+++ trunk/Source/WebCore/GNUmakefile.list.am 2013-01-30 05:17:40 UTC (rev 141219)
@@ -2108,6 +2108,7 @@
Source/WebCore/Modules/webdatabase/DatabaseContext.cpp \
Source/WebCore/Modules/webdatabase/DatabaseContext.h \
Source/WebCore/Modules/webdatabase/DatabaseDetails.h \
+ Source/WebCore/Modules/webdatabase/DatabaseError.h \
Source/WebCore/Modules/webdatabase/DatabaseManager.cpp \
Source/WebCore/Modules/webdatabase/DatabaseManager.h \
Source/WebCore/Modules/webdatabase/DatabaseManagerClient.h \
Added: trunk/Source/WebCore/Modules/webdatabase/DatabaseError.h (0 => 141219)
--- trunk/Source/WebCore/Modules/webdatabase/DatabaseError.h (rev 0)
+++ trunk/Source/WebCore/Modules/webdatabase/DatabaseError.h 2013-01-30 05:17:40 UTC (rev 141219)
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2013 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 DatabaseError_h
+#define DatabaseError_h
+
+#if ENABLE(SQL_DATABASE)
+
+#include <wtf/TypeSafeEnum.h>
+
+namespace WebCore {
+
+struct DatabaseErrorDefinition {
+ enum Enums {
+ None = 0,
+ CannotOpenDatabase,
+ DatabaseIsBeingDeleted,
+ DatabaseSizeExceededQuota,
+ DatabaseSizeOverflowed
+ };
+};
+
+typedef TypeSafeEnum<DatabaseErrorDefinition, DatabaseErrorDefinition::None> DatabaseError;
+
+} // namespace WebCore
+
+#endif // ENABLE(SQL_DATABASE)
+
+#endif // DatabaseError_h
Modified: trunk/Source/WebCore/Target.pri (141218 => 141219)
--- trunk/Source/WebCore/Target.pri 2013-01-30 04:55:54 UTC (rev 141218)
+++ trunk/Source/WebCore/Target.pri 2013-01-30 05:17:40 UTC (rev 141219)
@@ -1441,6 +1441,7 @@
Modules/webdatabase/Database.h \
Modules/webdatabase/DatabaseBackend.h \
Modules/webdatabase/DatabaseCallback.h \
+ Modules/webdatabase/DatabaseError.h \
Modules/webdatabase/DatabaseManager.h \
Modules/webdatabase/DatabaseServer.h \
Modules/webdatabase/DatabaseSync.h \
Modified: trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj (141218 => 141219)
--- trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj 2013-01-30 04:55:54 UTC (rev 141218)
+++ trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj 2013-01-30 05:17:40 UTC (rev 141219)
@@ -25417,6 +25417,10 @@
>
</File>
<File
+ RelativePath="..\Modules\webdatabase\DatabaseError.h"
+ >
+ </File>
+ <File
RelativePath="..\Modules\webdatabase\DatabaseManager.cpp"
>
</File>
Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj (141218 => 141219)
--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj 2013-01-30 04:55:54 UTC (rev 141218)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj 2013-01-30 05:17:40 UTC (rev 141219)
@@ -6406,6 +6406,7 @@
<ClInclude Include="..\Modules\webdatabase\DatabaseBackend.h" />
<ClInclude Include="..\Modules\webdatabase\DatabaseCallback.h" />
<ClInclude Include="..\Modules\webdatabase\DatabaseContext.h" />
+ <ClInclude Include="..\Modules\webdatabase\DatabaseError.h" />
<ClInclude Include="..\Modules\webdatabase\DatabaseManager.h" />
<ClInclude Include="..\Modules\webdatabase\DatabaseServer.h" />
<ClInclude Include="..\Modules\webdatabase\DatabaseSync.h" />
Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters (141218 => 141219)
--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters 2013-01-30 04:55:54 UTC (rev 141218)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters 2013-01-30 05:17:40 UTC (rev 141219)
@@ -8453,6 +8453,9 @@
<ClInclude Include="..\Modules\webdatabase\DatabaseContext.h">
<Filter>Modules\webdatabase</Filter>
</ClInclude>
+ <ClInclude Include="..\Modules\webdatabase\DatabaseError.h">
+ <Filter>Modules\webdatabase</Filter>
+ </ClInclude>
<ClInclude Include="..\Modules\webdatabase\DatabaseManager.h">
<Filter>Modules\webdatabase</Filter>
</ClInclude>
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (141218 => 141219)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2013-01-30 04:55:54 UTC (rev 141218)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2013-01-30 05:17:40 UTC (rev 141219)
@@ -3701,6 +3701,7 @@
97BC6A271505F081001B74AC /* DatabaseContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97BC69E51505F081001B74AC /* DatabaseContext.cpp */; };
97BC6A281505F081001B74AC /* DatabaseContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 97BC69E61505F081001B74AC /* DatabaseContext.h */; settings = {ATTRIBUTES = (Private, ); }; };
97BC6A291505F081001B74AC /* DatabaseDetails.h in Headers */ = {isa = PBXBuildFile; fileRef = 97BC69E71505F081001B74AC /* DatabaseDetails.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ FE09DB49169E2D6E00622557 /* DatabaseError.h in Headers */ = {isa = PBXBuildFile; fileRef = FE09DB46169E2D6E00622557 /* DatabaseError.h */; settings = {ATTRIBUTES = (Private, ); }; };
FEB26D28167A8F2A00FDD26B /* DatabaseServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FEB26D27167A8F2A00FDD26B /* DatabaseServer.cpp */; };
FEAF6654167970320062D0C5 /* DatabaseServer.h in Headers */ = {isa = PBXBuildFile; fileRef = FEAF6653167970070062D0C5 /* DatabaseServer.h */; settings = {ATTRIBUTES = (Private, ); }; };
97BC6A2A1505F081001B74AC /* DatabaseSync.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97BC69E81505F081001B74AC /* DatabaseSync.cpp */; };
@@ -11104,6 +11105,7 @@
97BC69E51505F081001B74AC /* DatabaseContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DatabaseContext.cpp; path = Modules/webdatabase/DatabaseContext.cpp; sourceTree = "<group>"; };
97BC69E61505F081001B74AC /* DatabaseContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DatabaseContext.h; path = Modules/webdatabase/DatabaseContext.h; sourceTree = "<group>"; };
97BC69E71505F081001B74AC /* DatabaseDetails.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DatabaseDetails.h; path = Modules/webdatabase/DatabaseDetails.h; sourceTree = "<group>"; };
+ FE09DB46169E2D6E00622557 /* DatabaseError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DatabaseError.h; path = Modules/webdatabase/DatabaseError.h; sourceTree = "<group>"; };
FEAF6653167970070062D0C5 /* DatabaseServer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DatabaseServer.h; path = Modules/webdatabase/DatabaseServer.h; sourceTree = "<group>"; };
FEB26D27167A8F2A00FDD26B /* DatabaseServer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DatabaseServer.cpp; path = Modules/webdatabase/DatabaseServer.cpp; sourceTree = "<group>"; };
97BC69E81505F081001B74AC /* DatabaseSync.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DatabaseSync.cpp; path = Modules/webdatabase/DatabaseSync.cpp; sourceTree = "<group>"; };
@@ -18509,6 +18511,7 @@
97BC69E51505F081001B74AC /* DatabaseContext.cpp */,
97BC69E61505F081001B74AC /* DatabaseContext.h */,
97BC69E71505F081001B74AC /* DatabaseDetails.h */,
+ FE09DB46169E2D6E00622557 /* DatabaseError.h */,
FE456F161677D74E005EDDF9 /* DatabaseManager.cpp */,
FE456F171677D74E005EDDF9 /* DatabaseManager.h */,
97BC69F11505F081001B74AC /* DatabaseManagerClient.h */,
@@ -23292,6 +23295,7 @@
97BC6A251505F081001B74AC /* DatabaseCallback.h in Headers */,
97BC6A281505F081001B74AC /* DatabaseContext.h in Headers */,
97BC6A291505F081001B74AC /* DatabaseDetails.h in Headers */,
+ FE09DB49169E2D6E00622557 /* DatabaseError.h in Headers */,
FE456F191677D74E005EDDF9 /* DatabaseManager.h in Headers */,
97BC6A331505F081001B74AC /* DatabaseManagerClient.h in Headers */,
FEAF6654167970320062D0C5 /* DatabaseServer.h in Headers */,