Introducing the Platform Abstraction Layer (PAL)
authormmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 22 Jan 2017 17:24:51 +0000 (17:24 +0000)
committermmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 22 Jan 2017 17:24:51 +0000 (17:24 +0000)
commit2238006f60a39ded7814650f12bd08ba99fbc498
treef74af30aaf59573545cc42352ec2a47be7fde38f
parent1cf24ea0e9bf944532ac6c0a62c2443c2dfced58
Introducing the Platform Abstraction Layer (PAL)
https://bugs.webkit.org/show_bug.cgi?id=143358

Reviewed by Alex Christensen.

.:

* CMakeLists.txt:
* Source/CMakeLists.txt:
* Source/cmake/WebKitFS.cmake:

Source/WebCore:

In order to enforce layering and promote testability, WebCore/platform files
should be compiled in their own project. This new project can enforce layering
and can be tested with unit tests in addition to layout tests.

The name of this new project is the Platform Abstraction Layer, or "PAL."
This comprises of a new directory in WebCore which will be the destination
for files migrated from WebCore/platform. This new folder, and its associated
project, will maintain layering invariants. These invariants are enforced at
build-time by setting the #include path for PAL to not include the rest of
WebCore (which is the same layering enforcement mechanism for WTF). Files will
be migrated into this new target/directory piece-by-piece, and the migration
of a file will be performed as soon as it can be migrated without violating
layering.

Within WebCore, files should include PAL files using the convention
#include <pal/foo.h>. Symbols within PAL are placed within a new top-level
namespace, "PAL," and therefore when used should be referred to as PAL::Foo.

The first set of files to move into the new platform is the crypto/ subdirectory
because it is both simple but also includes platform-dependent files.

No new tests because there is no behavior change.

* CMakeLists.txt:
* Configurations/WebCore.xcconfig: Add PAL to the include path
* PAL/Configurations/Base.xcconfig: Added.
* PAL/Configurations/DebugRelease.xcconfig: Added.
* PAL/Configurations/PAL.xcconfig: Added. Sets up some PAL-specific
variables.
* PAL/Configurations/FeatureDefines.xcconfig: Added.
* PAL/Configurations/Version.xcconfig: Added.
* PAL/PAL.xcodeproj/project.pbxproj: Added. New project file.
* PAL/config.h: Added. Simplified from WebCore/config.h.
* PAL/pal/CMakeLists.txt: Added.
* PAL/pal/PlatformEfl.cmake: Added.
* PAL/pal/PlatformGTK.cmake: Added.
* PAL/pal/PlatformMac.cmake: Added.
* PAL/pal/PlatformWin.cmake: Added.
* PAL/pal/crypto/CryptoDigest.h: Renamed from Source/WebCore/platform/crypto/CryptoDigest.h.
* PAL/pal/crypto/commoncrypto/CryptoDigestCommonCrypto.cpp: Renamed from Source/WebCore/platform/crypto/commoncrypto/CryptoDigestCommonCrypto.cpp.
* PAL/pal/crypto/gcrypt/CryptoDigestGCrypt.cpp: Renamed from Source/WebCore/platform/crypto/gcrypt/CryptoDigestGCrypt.cpp.
* PAL/pal/crypto/gnutls/CryptoDigestGnuTLS.cpp: Renamed from Source/WebCore/platform/crypto/gnutls/CryptoDigestGnuTLS.cpp.
* PAL/pal/crypto/win/CryptoDigestWin.cpp: Renamed from Source/WebCore/platform/crypto/win/CryptoDigestWin.cpp.
* PlatformEfl.cmake:
* PlatformGTK.cmake:
* PlatformMac.cmake:
* PlatformWin.cmake:
* WebCore.xcodeproj/project.pbxproj: Create a project link so WebCore
knows that it needs to build PAL as a dependency.
* crypto/algorithms/CryptoAlgorithmSHA1.cpp:
(WebCore::CryptoAlgorithmSHA1::digest): Update #include and namespace.
* crypto/algorithms/CryptoAlgorithmSHA224.cpp:
(WebCore::CryptoAlgorithmSHA224::digest): Ditto.
* crypto/algorithms/CryptoAlgorithmSHA256.cpp:
(WebCore::CryptoAlgorithmSHA256::digest): Ditto.
* crypto/algorithms/CryptoAlgorithmSHA384.cpp:
(WebCore::CryptoAlgorithmSHA384::digest): Ditto.
* crypto/algorithms/CryptoAlgorithmSHA512.cpp:
(WebCore::CryptoAlgorithmSHA512::digest): Ditto.
* crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp:
(WebCore::cryptoDigestAlgorithm): Ditto.
(WebCore::signRSASSA_PKCS1_v1_5): Ditto.
(WebCore::verifyRSASSA_PKCS1_v1_5): Ditto.
* inspector/InspectorDOMAgent.cpp:
(WebCore::computeContentSecurityPolicySHA256Hash): Ditto.
* page/csp/ContentSecurityPolicy.cpp:
(WebCore::toCryptoDigestAlgorithm): Ditto.
(WebCore::ContentSecurityPolicy::findHashOfContentInPolicies): Ditto.
* platform/network/soup/SoupNetworkSession.cpp:
(WebCore::HostTLSCertificateSet::computeCertificateHash): Ditto.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@211027 268f45cc-cd09-0410-ab3c-d52691b4dbfc
46 files changed:
CMakeLists.txt
ChangeLog
Source/CMakeLists.txt
Source/JavaScriptCore/Configurations/FeatureDefines.xcconfig
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/Configurations/FeatureDefines.xcconfig
Source/WebCore/Configurations/WebCore.xcconfig
Source/WebCore/PAL/Configurations/Base.xcconfig [new file with mode: 0644]
Source/WebCore/PAL/Configurations/DebugRelease.xcconfig [new file with mode: 0644]
Source/WebCore/PAL/Configurations/FeatureDefines.xcconfig [new file with mode: 0644]
Source/WebCore/PAL/Configurations/PAL.xcconfig [new file with mode: 0644]
Source/WebCore/PAL/Configurations/Version.xcconfig [new file with mode: 0644]
Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj [new file with mode: 0644]
Source/WebCore/PAL/config.h [new file with mode: 0644]
Source/WebCore/PAL/pal/CMakeLists.txt [new file with mode: 0644]
Source/WebCore/PAL/pal/PlatformEfl.cmake [new file with mode: 0644]
Source/WebCore/PAL/pal/PlatformGTK.cmake [new file with mode: 0644]
Source/WebCore/PAL/pal/PlatformMac.cmake [new file with mode: 0644]
Source/WebCore/PAL/pal/PlatformWin.cmake [new file with mode: 0644]
Source/WebCore/PAL/pal/crypto/CryptoDigest.h [moved from Source/WebCore/platform/crypto/CryptoDigest.h with 94% similarity]
Source/WebCore/PAL/pal/crypto/commoncrypto/CryptoDigestCommonCrypto.cpp [moved from Source/WebCore/platform/crypto/commoncrypto/CryptoDigestCommonCrypto.cpp with 99% similarity]
Source/WebCore/PAL/pal/crypto/gcrypt/CryptoDigestGCrypt.cpp [moved from Source/WebCore/platform/crypto/gcrypt/CryptoDigestGCrypt.cpp with 98% similarity]
Source/WebCore/PAL/pal/crypto/gnutls/CryptoDigestGnuTLS.cpp [moved from Source/WebCore/platform/crypto/gnutls/CryptoDigestGnuTLS.cpp with 98% similarity]
Source/WebCore/PAL/pal/crypto/win/CryptoDigestWin.cpp [moved from Source/WebCore/platform/crypto/win/CryptoDigestWin.cpp with 98% similarity]
Source/WebCore/PlatformEfl.cmake
Source/WebCore/PlatformGTK.cmake
Source/WebCore/PlatformMac.cmake
Source/WebCore/PlatformWin.cmake
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA1.cpp
Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA224.cpp
Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA256.cpp
Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA384.cpp
Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA512.cpp
Source/WebCore/crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp
Source/WebCore/inspector/InspectorDOMAgent.cpp
Source/WebCore/page/csp/ContentSecurityPolicy.cpp
Source/WebCore/platform/network/soup/SoupNetworkSession.cpp
Source/WebKit/CMakeLists.txt
Source/WebKit/mac/Configurations/FeatureDefines.xcconfig
Source/WebKit2/Configurations/FeatureDefines.xcconfig
Source/cmake/OptionsWin.cmake
Source/cmake/WebKitFS.cmake
Tools/Scripts/webkitpy/style/checkers/featuredefines.py
Tools/TestWebKitAPI/Configurations/FeatureDefines.xcconfig