Changeset 223966 in webkit


Ignore:
Timestamp:
Oct 25, 2017 11:38:48 AM (7 years ago)
Author:
commit-queue@webkit.org
Message:

[WinCairo] Add WebKit platform files for wincairo webkit
https://bugs.webkit.org/show_bug.cgi?id=178000

Patch by Yousuke Kimoto <yousuke.kimoto@sony.com> on 2017-10-25
Reviewed by Alex Christensen.

  • Platform/Module.h:
  • Platform/SharedMemory.h:

(WebKit::SharedMemory::handle const):

  • Platform/win/LoggingWin.cpp: Added. It is based on Source/WebCore/platform/win/LoggingWin.cpp

(WebKit::logLevelString):

  • Platform/win/ModuleWin.cpp: Added.

(WebKit::Module::load):
(WebKit::Module::unload):
(WebKit::Module::platformFunctionPointer const):

  • Platform/win/SharedMemoryWin.cpp: Added.

(WebKit::SharedMemory::Handle::Handle):
(WebKit::SharedMemory::Handle::~Handle):
(WebKit::SharedMemory::Handle::isNull const):
(WebKit::SharedMemory::Handle::encode const):
(WebKit::SharedMemory::Handle::clear):
(WebKit::getDuplicatedHandle):
(WebKit::SharedMemory::Handle::decode):
(WebKit::protectAttribute):
(WebKit::SharedMemory::allocate):
(WebKit::SharedMemory::create):
(WebKit::accessRights):
(WebKit::SharedMemory::map):
(WebKit::SharedMemory::adopt):
(WebKit::SharedMemory::~SharedMemory):
(WebKit::SharedMemory::createHandle):
(WebKit::SharedMemory::systemPageSize):

  • PlatformWin.cmake:
Location:
trunk/Source/WebKit
Files:
2 added
4 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r223964 r223966  
     12017-10-25  Yousuke Kimoto  <yousuke.kimoto@sony.com>
     2
     3        [WinCairo] Add WebKit platform files for wincairo webkit
     4        https://bugs.webkit.org/show_bug.cgi?id=178000
     5
     6        Reviewed by Alex Christensen.
     7
     8        * Platform/Module.h:
     9        * Platform/SharedMemory.h:
     10        (WebKit::SharedMemory::handle const):
     11        * Platform/win/LoggingWin.cpp: Added. It is based on Source/WebCore/platform/win/LoggingWin.cpp
     12        (WebKit::logLevelString):
     13        * Platform/win/ModuleWin.cpp: Added.
     14        (WebKit::Module::load):
     15        (WebKit::Module::unload):
     16        (WebKit::Module::platformFunctionPointer const):
     17        * Platform/win/SharedMemoryWin.cpp: Added.
     18        (WebKit::SharedMemory::Handle::Handle):
     19        (WebKit::SharedMemory::Handle::~Handle):
     20        (WebKit::SharedMemory::Handle::isNull const):
     21        (WebKit::SharedMemory::Handle::encode const):
     22        (WebKit::SharedMemory::Handle::clear):
     23        (WebKit::getDuplicatedHandle):
     24        (WebKit::SharedMemory::Handle::decode):
     25        (WebKit::protectAttribute):
     26        (WebKit::SharedMemory::allocate):
     27        (WebKit::SharedMemory::create):
     28        (WebKit::accessRights):
     29        (WebKit::SharedMemory::map):
     30        (WebKit::SharedMemory::adopt):
     31        (WebKit::SharedMemory::~SharedMemory):
     32        (WebKit::SharedMemory::createHandle):
     33        (WebKit::SharedMemory::systemPageSize):
     34        * PlatformWin.cmake:
     35
    1362017-10-25  Chris Dumez  <cdumez@apple.com>
    237
  • trunk/Source/WebKit/Platform/Module.h

    r213576 r223966  
    11/*
    22 * Copyright (C) 2010 Apple Inc. All rights reserved.
     3 * Copyright (C) 2017 Sony Interactive Entertainment Inc.
    34 *
    45 * Redistribution and use in source and binary forms, with or without
     
    2425 */
    2526
    26 #ifndef Module_h
    27 #define Module_h
     27#pragma once
    2828
    2929#include <wtf/Noncopyable.h>
     
    6565
    6666    String m_path;
     67#if PLATFORM(WIN)
     68    HMODULE m_module;
     69#endif
    6770#if USE(CF)
    6871    RetainPtr<CFBundleRef> m_bundle;
     
    8184
    8285}
    83 
    84 #endif
  • trunk/Source/WebKit/Platform/SharedMemory.h

    r209920 r223966  
    11/*
    22 * Copyright (C) 2010 Apple Inc. All rights reserved.
     3 * Copyright (C) 2017 Sony Interactive Entertainment Inc.
    34 *
    45 * Redistribution and use in source and binary forms, with or without
     
    2425 */
    2526
    26 #ifndef SharedMemory_h
    27 #define SharedMemory_h
     27#pragma once
    2828
    2929#include <wtf/Forward.h>
     
    8080        mutable mach_port_t m_port;
    8181        size_t m_size;
     82#elif OS(WINDOWS)
     83        mutable HANDLE m_handle;
     84        size_t m_size;
    8285#endif
    8386    };
     
    8891#if USE(UNIX_DOMAIN_SOCKETS)
    8992    static RefPtr<SharedMemory> wrapMap(void*, size_t, int fileDescriptor);
     93#endif
     94#if OS(WINDOWS)
     95    static RefPtr<SharedMemory> adopt(HANDLE, size_t, Protection);
    9096#endif
    9197
     
    100106        return m_data;
    101107    }
     108
     109#if OS(WINDOWS)
     110    HANDLE handle() const { return m_handle; }
     111#endif
    102112
    103113    // Return the system page size in bytes.
     
    120130#elif OS(DARWIN)
    121131    mach_port_t m_port;
     132#elif OS(WINDOWS)
     133    HANDLE m_handle;
    122134#endif
    123135};
    124136
    125137};
    126 
    127 #endif // SharedMemory_h
  • trunk/Source/WebKit/Platform/win/LoggingWin.cpp

    r223965 r223966  
    11/*
    2  * Copyright (C) 2010 Apple Inc. All rights reserved.
     2 * Copyright (C) 2008, 2013 Apple Inc. All Rights Reserved.
     3 * Copyright (C) 2017 Sony Interactive Entertainment Inc.
    34 *
    45 * Redistribution and use in source and binary forms, with or without
     
    2425 */
    2526
    26 #ifndef Module_h
    27 #define Module_h
     27#include "config.h"
     28#include "Logging.h"
    2829
    29 #include <wtf/Noncopyable.h>
     30#if !LOG_DISABLED || !RELEASE_LOG_DISABLED
     31
     32#include <wtf/StdLibExtras.h>
    3033#include <wtf/text/WTFString.h>
    31 
    32 #if USE(CF)
    33 #include <wtf/RetainPtr.h>
    34 #endif
    35 
    36 #if USE(GLIB)
    37 typedef struct _GModule GModule;
    38 #endif
    3934
    4035namespace WebKit {
    4136
    42 class Module {
    43     WTF_MAKE_NONCOPYABLE(Module);
    44 public:
    45     Module(const String& path);
    46     ~Module();
     37static char* const loggingEnvironmentVariable = "WebKitLogging";
    4738
    48     bool load();
    49     // Note: On Mac this leaks the CFBundle to avoid crashes when a bundle is unloaded and there are
    50     // live Objective-C objects whose methods come from that bundle.
    51     void unload();
     39String logLevelString()
     40{
     41    DWORD length = GetEnvironmentVariableA(loggingEnvironmentVariable, 0, 0);
     42    if (!length)
     43        return emptyString();
    5244
    53 #if USE(CF)
    54     String bundleIdentifier() const;
    55 #endif
     45    auto buffer = std::make_unique<char[]>(length);
    5646
    57     template<typename FunctionType> FunctionType functionPointer(const char* functionName) const;
     47    if (!GetEnvironmentVariableA(loggingEnvironmentVariable, buffer.get(), length))
     48        return emptyString();
    5849
    59 #if USE(CF) && !defined(__LP64__)
    60     CFBundleRefNum bundleResourceMap();
    61 #endif
    62 
    63 private:
    64     void* platformFunctionPointer(const char* functionName) const;
    65 
    66     String m_path;
    67 #if USE(CF)
    68     RetainPtr<CFBundleRef> m_bundle;
    69 #if !defined(__LP64__)
    70     CFBundleRefNum m_bundleResourceMap;
    71 #endif
    72 #elif USE(GLIB)
    73     GModule* m_handle;
    74 #endif
    75 };
    76 
    77 template<typename FunctionType> FunctionType Module::functionPointer(const char* functionName) const
    78 {
    79     return reinterpret_cast<FunctionType>(platformFunctionPointer(functionName));
     50    return String(buffer.get());
    8051}
    8152
    82 }
     53} // namespace WebKit
    8354
    84 #endif
     55#endif // !LOG_DISABLED || !RELEASE_LOG_DISABLED
  • trunk/Source/WebKit/Platform/win/ModuleWin.cpp

    r223965 r223966  
    11/*
    22 * Copyright (C) 2010 Apple Inc. All rights reserved.
     3 * Copyright (C) 2017 Sony Interactive Entertainment Inc.
    34 *
    45 * Redistribution and use in source and binary forms, with or without
     
    2425 */
    2526
    26 #ifndef Module_h
    27 #define Module_h
     27#include "config.h"
     28#include "Module.h"
    2829
    29 #include <wtf/Noncopyable.h>
    30 #include <wtf/text/WTFString.h>
    31 
    32 #if USE(CF)
    33 #include <wtf/RetainPtr.h>
    34 #endif
    35 
    36 #if USE(GLIB)
    37 typedef struct _GModule GModule;
    38 #endif
     30#include <shlwapi.h>
     31#include <wtf/text/CString.h>
    3932
    4033namespace WebKit {
    4134
    42 class Module {
    43     WTF_MAKE_NONCOPYABLE(Module);
    44 public:
    45     Module(const String& path);
    46     ~Module();
     35bool Module::load()
     36{
     37    ASSERT(!::PathIsRelativeW(m_path.charactersWithNullTermination().data()));
     38    m_module = ::LoadLibraryExW(m_path.charactersWithNullTermination().data(), 0, LOAD_WITH_ALTERED_SEARCH_PATH);
     39    return m_module;
     40}
    4741
    48     bool load();
    49     // Note: On Mac this leaks the CFBundle to avoid crashes when a bundle is unloaded and there are
    50     // live Objective-C objects whose methods come from that bundle.
    51     void unload();
     42void Module::unload()
     43{
     44    if (!m_module)
     45        return;
     46    ::FreeLibrary(m_module);
     47    m_module = 0;
     48}
    5249
    53 #if USE(CF)
    54     String bundleIdentifier() const;
    55 #endif
    56 
    57     template<typename FunctionType> FunctionType functionPointer(const char* functionName) const;
    58 
    59 #if USE(CF) && !defined(__LP64__)
    60     CFBundleRefNum bundleResourceMap();
    61 #endif
    62 
    63 private:
    64     void* platformFunctionPointer(const char* functionName) const;
    65 
    66     String m_path;
    67 #if USE(CF)
    68     RetainPtr<CFBundleRef> m_bundle;
    69 #if !defined(__LP64__)
    70     CFBundleRefNum m_bundleResourceMap;
    71 #endif
    72 #elif USE(GLIB)
    73     GModule* m_handle;
    74 #endif
    75 };
    76 
    77 template<typename FunctionType> FunctionType Module::functionPointer(const char* functionName) const
     50void* Module::platformFunctionPointer(const char* functionName) const
    7851{
    79     return reinterpret_cast<FunctionType>(platformFunctionPointer(functionName));
     52    if (!m_module)
     53        return 0;
     54    return ::GetProcAddress(m_module, functionName);
    8055}
    8156
    8257}
    83 
    84 #endif
  • trunk/Source/WebKit/PlatformWin.cmake

    r223262 r223966  
    1717    NetworkProcess/win/NetworkProcessMainWin.cpp
    1818    NetworkProcess/win/SystemProxyWin.cpp
     19
     20    Platform/win/LoggingWin.cpp
     21    Platform/win/ModuleWin.cpp
     22    Platform/win/SharedMemoryWin.cpp
    1923
    2024    Shared/Authentication/curl/AuthenticationManagerCurl.cpp
Note: See TracChangeset for help on using the changeset viewer.