[WinCairo] Fix build errors which come from including headers and not suitable implem...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 14 Feb 2018 06:01:37 +0000 (06:01 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 14 Feb 2018 06:01:37 +0000 (06:01 +0000)
https://bugs.webkit.org/show_bug.cgi?id=182679

Patch by Yousuke Kimoto <yousuke.kimoto@sony.com> on 2018-02-13
Reviewed by Michael Catanzaro.

* NetworkProcess/cache/NetworkCacheBlobStorage.cpp:
(WebKit::NetworkCache::BlobStorage::add):
* NetworkProcess/cache/NetworkCacheData.cpp:
(WebKit::NetworkCache::Data::mapToFile const):
(WebKit::NetworkCache::mapFile):
(WebKit::NetworkCache::adoptAndMapFile):
(WebKit::NetworkCache::readOrMakeSalt):
* NetworkProcess/cache/NetworkCacheFileSystem.cpp:
(WebKit::NetworkCache::directoryEntryType):
(WebKit::NetworkCache::traverseDirectory):
(WebKit::NetworkCache::fileTimes):
(WebKit::NetworkCache::updateFileModificationTimeIfNeeded):
* NetworkProcess/cache/NetworkCacheStorage.cpp:
(WebKit::NetworkCache::Storage::traverse):
* NetworkProcess/win/SystemProxyWin.h:
* Platform/IPC/Attachment.h:
* Platform/Module.h:
* Platform/SharedMemory.h:
* PluginProcess/WebProcessConnection.cpp:
* Shared/API/c/WKBase.h:
* Shared/ChildProcess.cpp:
* Shared/WebCoreArgumentCoders.h:
* UIProcess/ProcessAssertion.h:
* WebProcess/InjectedBundle/InjectedBundle.h:
* WebProcess/WebProcess.cpp:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@228455 268f45cc-cd09-0410-ab3c-d52691b4dbfc

16 files changed:
Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/cache/NetworkCacheBlobStorage.cpp
Source/WebKit/NetworkProcess/cache/NetworkCacheData.cpp
Source/WebKit/NetworkProcess/cache/NetworkCacheFileSystem.cpp
Source/WebKit/NetworkProcess/cache/NetworkCacheStorage.cpp
Source/WebKit/NetworkProcess/win/SystemProxyWin.h
Source/WebKit/Platform/IPC/Attachment.h
Source/WebKit/Platform/Module.h
Source/WebKit/Platform/SharedMemory.h
Source/WebKit/PluginProcess/WebProcessConnection.cpp
Source/WebKit/Shared/API/c/WKBase.h
Source/WebKit/Shared/ChildProcess.cpp
Source/WebKit/Shared/WebCoreArgumentCoders.h
Source/WebKit/UIProcess/ProcessAssertion.h
Source/WebKit/WebProcess/InjectedBundle/InjectedBundle.h
Source/WebKit/WebProcess/WebProcess.cpp

index 99873dc..a82e899 100644 (file)
@@ -1,3 +1,36 @@
+2018-02-13  Yousuke Kimoto  <yousuke.kimoto@sony.com>
+
+        [WinCairo] Fix build errors which come from including headers and not suitable implementation for windows
+        https://bugs.webkit.org/show_bug.cgi?id=182679
+
+        Reviewed by Michael Catanzaro.
+
+        * NetworkProcess/cache/NetworkCacheBlobStorage.cpp:
+        (WebKit::NetworkCache::BlobStorage::add):
+        * NetworkProcess/cache/NetworkCacheData.cpp:
+        (WebKit::NetworkCache::Data::mapToFile const):
+        (WebKit::NetworkCache::mapFile):
+        (WebKit::NetworkCache::adoptAndMapFile):
+        (WebKit::NetworkCache::readOrMakeSalt):
+        * NetworkProcess/cache/NetworkCacheFileSystem.cpp:
+        (WebKit::NetworkCache::directoryEntryType):
+        (WebKit::NetworkCache::traverseDirectory):
+        (WebKit::NetworkCache::fileTimes):
+        (WebKit::NetworkCache::updateFileModificationTimeIfNeeded):
+        * NetworkProcess/cache/NetworkCacheStorage.cpp:
+        (WebKit::NetworkCache::Storage::traverse):
+        * NetworkProcess/win/SystemProxyWin.h:
+        * Platform/IPC/Attachment.h:
+        * Platform/Module.h:
+        * Platform/SharedMemory.h:
+        * PluginProcess/WebProcessConnection.cpp:
+        * Shared/API/c/WKBase.h:
+        * Shared/ChildProcess.cpp:
+        * Shared/WebCoreArgumentCoders.h:
+        * UIProcess/ProcessAssertion.h:
+        * WebProcess/InjectedBundle/InjectedBundle.h:
+        * WebProcess/WebProcess.cpp:
+
 2018-02-13  Commit Queue  <commit-queue@webkit.org>
 
         Unreviewed, rolling out r228431.
index 993af0e..f73c50d 100644 (file)
 #include "NetworkCacheFileSystem.h"
 #include <WebCore/FileSystem.h>
 #include <fcntl.h>
+#include <wtf/RunLoop.h>
+#include <wtf/SHA1.h>
+
+#if !OS(WINDOWS)
 #include <sys/mman.h>
 #include <sys/stat.h>
 #include <unistd.h>
-#include <wtf/RunLoop.h>
-#include <wtf/SHA1.h>
+#endif
 
 namespace WebKit {
 namespace NetworkCache {
@@ -83,6 +86,7 @@ String BlobStorage::blobPathForHash(const SHA1::Digest& hash) const
 
 BlobStorage::Blob BlobStorage::add(const String& path, const Data& data)
 {
+#if !OS(WINDOWS)
     ASSERT(!RunLoop::isMain());
 
     auto hash = computeSHA1(data, m_salt);
@@ -114,6 +118,9 @@ BlobStorage::Blob BlobStorage::add(const String& path, const Data& data)
     m_approximateSize += mappedData.size();
 
     return { mappedData, hash };
+#else
+    return { Data(), computeSHA1(data, m_salt) };
+#endif
 }
 
 BlobStorage::Blob BlobStorage::get(const String& path)
index cf637a7..a6e37be 100644 (file)
 
 #include <WebCore/FileSystem.h>
 #include <fcntl.h>
+#include <wtf/CryptographicallyRandomNumber.h>
+
+#if !OS(WINDOWS)
 #include <sys/mman.h>
 #include <sys/stat.h>
 #include <unistd.h>
-#include <wtf/CryptographicallyRandomNumber.h>
+#endif
 
 namespace WebKit {
 namespace NetworkCache {
 
 Data Data::mapToFile(const char* path) const
 {
+#if !OS(WINDOWS)
     int fd = open(path, O_CREAT | O_EXCL | O_RDWR , S_IRUSR | S_IWUSR);
     if (fd < 0)
         return { };
@@ -67,10 +71,14 @@ Data Data::mapToFile(const char* path) const
     msync(map, m_size, MS_ASYNC);
 
     return Data::adoptMap(map, m_size, fd);
+#else
+    return Data();
+#endif
 }
 
 Data mapFile(const char* path)
 {
+#if !OS(WINDOWS)
     int fd = open(path, O_RDONLY, 0);
     if (fd < 0)
         return { };
@@ -86,10 +94,14 @@ Data mapFile(const char* path)
     }
 
     return adoptAndMapFile(fd, 0, size);
+#else
+    return Data();
+#endif
 }
 
 Data adoptAndMapFile(int fd, size_t offset, size_t size)
 {
+#if !OS(WINDOWS)
     if (!size) {
         close(fd);
         return Data::empty();
@@ -102,6 +114,9 @@ Data adoptAndMapFile(int fd, size_t offset, size_t size)
     }
 
     return Data::adoptMap(map, size, fd);
+#else
+    return Data();
+#endif
 }
 
 SHA1::Digest computeSHA1(const Data& data, const Salt& salt)
@@ -138,6 +153,7 @@ static Salt makeSalt()
 
 std::optional<Salt> readOrMakeSalt(const String& path)
 {
+#if !OS(WINDOWS)
     auto cpath = WebCore::FileSystem::fileSystemRepresentation(path);
     auto fd = open(cpath.data(), O_RDONLY, 0);
     Salt salt;
@@ -154,6 +170,9 @@ std::optional<Salt> readOrMakeSalt(const String& path)
             return { };
     }
     return salt;
+#else
+    return Salt();
+#endif
 }
 
 } // namespace NetworkCache
index b8fb7c9..f65d99e 100644 (file)
 
 #include "Logging.h"
 #include <WebCore/FileSystem.h>
-#include <dirent.h>
-#include <sys/stat.h>
-#include <sys/time.h>
 #include <wtf/Assertions.h>
 #include <wtf/Function.h>
 #include <wtf/text/CString.h>
 
+#if !OS(WINDOWS)
+#include <dirent.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#endif
+
 #if PLATFORM(IOS) && !PLATFORM(IOS_SIMULATOR)
 #include <sys/attr.h>
 #include <unistd.h>
@@ -50,6 +53,7 @@ namespace NetworkCache {
 
 static DirectoryEntryType directoryEntryType(uint8_t dtype)
 {
+#if !OS(WINDOWS)
     switch (dtype) {
     case DT_DIR:
         return DirectoryEntryType::Directory;
@@ -59,10 +63,14 @@ static DirectoryEntryType directoryEntryType(uint8_t dtype)
         ASSERT_NOT_REACHED();
         return DirectoryEntryType::File;
     }
+#else
+    return DirectoryEntryType::File;
+#endif
 }
 
 void traverseDirectory(const String& path, const Function<void (const String&, DirectoryEntryType)>& function)
 {
+#if !OS(WINDOWS)
     DIR* dir = opendir(WebCore::FileSystem::fileSystemRepresentation(path).data());
     if (!dir)
         return;
@@ -79,6 +87,9 @@ void traverseDirectory(const String& path, const Function<void (const String&, D
         function(nameString, directoryEntryType(dp->d_type));
     }
     closedir(dir);
+#else
+    function(String(), DirectoryEntryType::File);
+#endif
 }
 
 void deleteDirectoryRecursively(const String& path)
@@ -116,6 +127,8 @@ FileTimes fileTimes(const String& path)
         return { };
     return { WallTime::fromRawSeconds(g_ascii_strtoull(birthtimeString, nullptr, 10)),
         WallTime::fromRawSeconds(g_file_info_get_attribute_uint64(fileInfo.get(), "time::modified")) };
+#elif OS(WINDOWS)
+    return FileTimes();
 #endif
 }
 
@@ -127,8 +140,10 @@ void updateFileModificationTimeIfNeeded(const String& path)
         if (WallTime::now() - times.modification < 1_h)
             return;
     }
+#if !OS(WINDOWS)
     // This really updates both the access time and the modification time.
     utimes(WebCore::FileSystem::fileSystemRepresentation(path).data(), nullptr);
+#endif
 }
 
 bool canUseSharedMemoryForPath(const String& path)
index 705e835..aabced0 100644 (file)
@@ -908,7 +908,7 @@ void Storage::traverse(const String& type, TraverseFlags flags, TraverseHandler&
             });
 
             const unsigned maximumParallelReadCount = 5;
-            traverseOperation.activeCondition.wait(lock, [&traverseOperation] {
+            traverseOperation.activeCondition.wait(lock, [&traverseOperation, maximumParallelReadCount] {
                 return traverseOperation.activeCount <= maximumParallelReadCount;
             });
         });
index dad93b9..9560928 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#pragma once
+
+#include <windows.h>
+
 class WindowsSystemProxy {
     static const int ProxyServerNameLength = 512;
 public:
index 3929db2..3fe9887 100644 (file)
 #include <mach/mach_traps.h>
 #endif
 
+#if OS(WINDOWS)
+#include <windows.h>
+#endif
+
 namespace IPC {
 
 class Decoder;
index 90328bf..768aa12 100644 (file)
 typedef struct _GModule GModule;
 #endif
 
+#if OS(WINDOWS)
+#include <windows.h>
+#endif
+
 namespace WebKit {
 
 class Module {
@@ -64,7 +68,7 @@ private:
     void* platformFunctionPointer(const char* functionName) const;
 
     String m_path;
-#if PLATFORM(WIN)
+#if OS(WINDOWS)
     HMODULE m_module;
 #endif
 #if USE(CF)
index c72e0d4..428fbf9 100644 (file)
 #include <wtf/Optional.h>
 #endif
 
+#if OS(WINDOWS)
+#include <windows.h>
+#endif
+
 namespace IPC {
 class Decoder;
 class Encoder;
index e73663e..12a341d 100644 (file)
 #include "PluginProcessConnectionMessages.h"
 #include "PluginProxyMessages.h"
 #include "WebProcessConnectionMessages.h"
-#include <unistd.h>
 #include <wtf/SetForScope.h>
 
+#if !OS(WINDOWS)
+#include <unistd.h>
+#endif
+
 using namespace WebCore;
 
 namespace WebKit {
index 1c77bd6..c995cbc 100644 (file)
 
 #if defined(BUILDING_GTK__)
 #include <WebKit/WKBaseGtk.h>
-#endif
-
-#if defined(__APPLE__) && !defined(BUILDING_GTK__)
-#include <WebKit/WKBaseMac.h>
-#endif
-
-#if defined(BUILDING_WPE__)
+#elif defined(BUILDING_WPE__)
 #include <WebKit/WKBaseWPE.h>
+#elif defined(__APPLE__)
+#include <WebKit/WKBaseMac.h>
+#elif defined(_WIN32)
+#include <WebKit/WKBaseWin.h>
 #endif
 
 /* WebKit2 shared types */
index 6994d3d..b55d86f 100644 (file)
 #include "SandboxInitializationParameters.h"
 #include <WebCore/SchemeRegistry.h>
 #include <pal/SessionID.h>
+
+#if !OS(WINDOWS)
 #include <unistd.h>
+#endif
 
 using namespace WebCore;
 
index 6b1c43a..6914c7d 100644 (file)
 #include <WebCore/MediaSelectionOption.h>
 #include <WebCore/NetworkLoadMetrics.h>
 #include <WebCore/NotificationDirection.h>
-#include <WebCore/PaymentHeaders.h>
 #include <WebCore/RealtimeMediaSource.h>
 #include <WebCore/ScrollSnapOffsetsInfo.h>
 #include <WebCore/ServiceWorkerTypes.h>
 #include <WebCore/StoredCredentialsPolicy.h>
 #include <WebCore/WorkerType.h>
 
+#if ENABLE(APPLE_PAY)
+#include <WebCore/PaymentHeaders.h>
+#endif
+
 namespace WTF {
 class MonotonicTime;
 class Seconds;
index 4d4dc66..dc9afd8 100644 (file)
 #ifndef ProcessAssertion_h
 #define ProcessAssertion_h
 
-#include <unistd.h>
 #include <wtf/Function.h>
 #include <wtf/ProcessID.h>
 
+#if !OS(WINDOWS)
+#include <unistd.h>
+#endif
+
 #if PLATFORM(IOS) && !PLATFORM(IOS_SIMULATOR)
 #include <wtf/RetainPtr.h>
 #include <wtf/WeakPtr.h>
index fc1534f..eddaf6b 100644 (file)
@@ -62,6 +62,8 @@ namespace WebKit {
 typedef NSBundle *PlatformBundle;
 #elif USE(GLIB)
 typedef ::GModule* PlatformBundle;
+#elif OS(WINDOWS)
+typedef void* PlatformBundle;
 #endif
 
 class InjectedBundleScriptWorld;
index 25785b4..1c1ed1c 100644 (file)
 #include <WebCore/Settings.h>
 #include <WebCore/URLParser.h>
 #include <WebCore/UserGestureIndicator.h>
-#include <unistd.h>
 #include <wtf/CurrentTime.h>
 #include <wtf/Language.h>
 #include <wtf/RunLoop.h>
 #include <wtf/text/StringHash.h>
 
+#if !OS(WINDOWS)
+#include <unistd.h>
+#endif
+
 #if PLATFORM(WAYLAND)
 #include "WaylandCompositorDisplay.h"
 #endif