Changeset 262022 in webkit


Ignore:
Timestamp:
May 21, 2020 12:52:41 PM (4 years ago)
Author:
yoshiaki.jitsukawa@sony.com
Message:

[PlayStation] Add minimal WKView API to enable TestWebKitAPI
https://bugs.webkit.org/show_bug.cgi?id=211868

Reviewed by Alex Christensen.

Enable TestWebKitAPI

.:

  • Source/cmake/OptionsPlayStation.cmake:

Disable FullScreen API and ContextMenus.

Source/WebCore:

  • PlatformPlayStation.cmake:

Add WebKitRequirements library to WebCore_CopySharedLibs.

Source/WebKit:

  • Platform/IPC/Connection.h:
  • Platform/IPC/unix/ConnectionUnix.cpp:

(IPC::Connection::platformInvalidate):
(IPC::Connection::open):
Add SocketMonitor to monitor received messages.

  • UIProcess/API/APIProcessPoolConfiguration.cpp:

(API::ProcessPoolConfiguration::copy):

  • UIProcess/API/APIProcessPoolConfiguration.h:

Add PlayStation specific members: WebProcess and NetworkProcess paths, and user ID.

  • UIProcess/Launcher/ProcessLauncher.h:

Add PlayStation specific members: Process path and user ID.

  • NetworkProcess/EntryPoint/playstation/NetworkProcessMain.cpp: Copied from Tools\TestWebKitAPI\playstation\main.cpp.

(loadLibraryOrExit):
(main):

  • PlatformPlayStation.cmake:
  • Shared/API/c/playstation/WKEventPlayStation.cpp: Added.

(WKKeyboardEventMake):
(WKMouseEventMake):
(WKWheelEventMake):

  • Shared/API/c/playstation/WKEventPlayStation.h: Added.
  • UIProcess/API/C/playstation/WKAPICastPlayStation.h:

(WebKit::toAPI<>):
(WebKit::toImpl<>):

  • UIProcess/API/C/playstation/WKContextConfigurationPlayStation.cpp: Copied from Tools\TestWebKitAPI\playstation\PlatformUtilitiesPlayStation.cpp.

(WKContextConfigurationSetWebProcessPath):
(WKContextConfigurationCopyWebProcessPath):
(WKContextConfigurationSetNetworkProcessPath):
(WKContextConfigurationCopyNetworkProcessPath):
(WKContextConfigurationSetUserId):
(WKContextConfigurationGetUserId):

  • UIProcess/API/C/playstation/WKContextConfigurationPlayStation.h: Copied from Source\WebKit\UIProcess\API\C\playstation\WKView.h.
  • UIProcess/API/C/playstation/WKPagePrivatePlayStation.cpp: Added.

(WKPageHandleKeyboardEvent):
(WKPageHandleMouseEvent):
(WKPageHandleWheelEvent):

  • UIProcess/API/C/playstation/WKPagePrivatePlayStation.h: Copied from Source\WebKit\UIProcess\API\C\playstation\WKView.h.
  • UIProcess/API/C/playstation/WKView.cpp: Copied from Source\WebKit\WebProcess\InjectedBundle\playstation\InjectedBundlePlayStation.cpp.

(WKViewCreate):
(WKViewGetPage):

  • UIProcess/API/C/playstation/WKView.h:
  • UIProcess/Launcher/playstation/ProcessLauncherPlayStation.cpp:

(WebKit::defaultProcessPath):
(WebKit::ProcessLauncher::launchProcess):
(WebKit::ProcessLauncher::terminateProcess):
(WebKit::ProcessLauncher::platformInvalidate):

  • UIProcess/Network/NetworkProcessProxy.cpp:

(WebKit::NetworkProcessProxy::getLaunchOptions):

  • UIProcess/WebProcessPool.h:
  • UIProcess/WebProcessProxy.cpp:

(WebKit::WebProcessProxy::getLaunchOptions):

  • UIProcess/playstation/PageClientImpl.cpp: Added.

(WebKit::PageClientImpl::PageClientImpl):
(WebKit::PageClientImpl::createDrawingAreaProxy):
(WebKit::PageClientImpl::setViewNeedsDisplay):
(WebKit::PageClientImpl::requestScroll):
(WebKit::PageClientImpl::viewScrollPosition):
(WebKit::PageClientImpl::viewSize):
(WebKit::PageClientImpl::isViewWindowActive):
(WebKit::PageClientImpl::isViewFocused):
(WebKit::PageClientImpl::isViewVisible):
(WebKit::PageClientImpl::isViewInWindow):
(WebKit::PageClientImpl::processDidExit):
(WebKit::PageClientImpl::didRelaunchProcess):
(WebKit::PageClientImpl::pageClosed):
(WebKit::PageClientImpl::preferencesDidChange):
(WebKit::PageClientImpl::toolTipChanged):
(WebKit::PageClientImpl::didCommitLoadForMainFrame):
(WebKit::PageClientImpl::handleDownloadRequest):
(WebKit::PageClientImpl::didChangeContentSize):
(WebKit::PageClientImpl::setCursor):
(WebKit::PageClientImpl::setCursorHiddenUntilMouseMoves):
(WebKit::PageClientImpl::didChangeViewportProperties):
(WebKit::PageClientImpl::registerEditCommand):
(WebKit::PageClientImpl::clearAllEditCommands):
(WebKit::PageClientImpl::canUndoRedo):
(WebKit::PageClientImpl::executeUndoRedo):
(WebKit::PageClientImpl::wheelEventWasNotHandledByWebCore):
(WebKit::PageClientImpl::convertToDeviceSpace):
(WebKit::PageClientImpl::convertToUserSpace):
(WebKit::PageClientImpl::screenToRootView):
(WebKit::PageClientImpl::rootViewToScreen):
(WebKit::PageClientImpl::accessibilityScreenToRootView):
(WebKit::PageClientImpl::rootViewToAccessibilityScreen):
(WebKit::PageClientImpl::doneWithKeyEvent):
(WebKit::PageClientImpl::createPopupMenuProxy):
(WebKit::PageClientImpl::enterAcceleratedCompositingMode):
(WebKit::PageClientImpl::exitAcceleratedCompositingMode):
(WebKit::PageClientImpl::updateAcceleratedCompositingMode):
(WebKit::PageClientImpl::fullScreenManagerProxyClient):
(WebKit::PageClientImpl::didFinishLoadingDataForCustomContentProvider):
(WebKit::PageClientImpl::navigationGestureDidBegin):
(WebKit::PageClientImpl::navigationGestureWillEnd):
(WebKit::PageClientImpl::navigationGestureDidEnd):
(WebKit::PageClientImpl::willRecordNavigationSnapshot):
(WebKit::PageClientImpl::didRemoveNavigationGestureSnapshot):
(WebKit::PageClientImpl::didFirstVisuallyNonEmptyLayoutForMainFrame):
(WebKit::PageClientImpl::didFinishLoadForMainFrame):
(WebKit::PageClientImpl::didFailLoadForMainFrame):
(WebKit::PageClientImpl::didSameDocumentNavigationForMainFrame):
(WebKit::PageClientImpl::didChangeBackgroundColor):
(WebKit::PageClientImpl::isPlayingAudioWillChange):
(WebKit::PageClientImpl::isPlayingAudioDidChange):
(WebKit::PageClientImpl::refView):
(WebKit::PageClientImpl::derefView):
(WebKit::PageClientImpl::didRestoreScrollPosition):
(WebKit::PageClientImpl::userInterfaceLayoutDirection):
(WebKit::PageClientImpl::requestDOMPasteAccess):

  • UIProcess/playstation/PageClientImpl.h: Added.
  • UIProcess/playstation/WebProcessPoolPlayStation.cpp:

(WebKit::WebProcessPool::platformInitialize):

  • UIProcess/playstation/PlayStationWebView.cpp: Copied from Source\WebKit\UIProcess\playstation\WebProcessPoolPlayStation.cpp.

(WebKit::PlayStationWebView::create):
(WebKit::PlayStationWebView::PlayStationWebView):
(WebKit::PlayStationWebView::~PlayStationWebView):
(WebKit::PlayStationWebView::isActive const):
(WebKit::PlayStationWebView::isFocused const):
(WebKit::PlayStationWebView::isVisible const):

  • UIProcess/playstation/PlayStationWebView.h: Copied from Source\WebKit\WebProcess\InjectedBundle\playstation\InjectedBundlePlayStation.cpp.

(WebKit::PlayStationWebView::page):

  • WebProcess/EntryPoint/playstation/WebProcessMain.cpp: Copied from Tools\TestWebKitAPI\playstation\main.cpp.

(loadLibraryOrExit):
(main):

  • WebProcess/InjectedBundle/playstation/InjectedBundlePlayStation.cpp:

(WebKit::InjectedBundle::initialize):
(WebKit::InjectedBundle::setBundleParameter):

  • WebProcess/WebPage/AcceleratedSurface.cpp:

(WebKit::AcceleratedSurface::create):

Source/WTF:

  • wtf/PlatformPlayStation.cmake:

Link libc as a system library.

Tools:

  • TestWebKitAPI/PlatformPlayStation.cmake:
  • TestWebKitAPI/PlatformWebView.h:
  • TestWebKitAPI/playstation/PlatformUtilitiesPlayStation.cpp:

(TestWebKitAPI::Util::createInjectedBundlePath):
(TestWebKitAPI::Util::createURLForResource):

  • TestWebKitAPI/playstation/PlatformWebViewPlayStation.cpp:

(TestWebKitAPI::PlatformWebView::PlatformWebView):
(TestWebKitAPI::PlatformWebView::~PlatformWebView):
(TestWebKitAPI::PlatformWebView::initialize):
(TestWebKitAPI::PlatformWebView::resizeTo):
(TestWebKitAPI::PlatformWebView::page const):
(TestWebKitAPI::PlatformWebView::simulateSpacebarKeyPress):
(TestWebKitAPI::PlatformWebView::simulateMouseMove):
(TestWebKitAPI::PlatformWebView::simulateRightClick):
(TestWebKitAPI::PlatformWebView::simulateButtonClick):

  • TestWebKitAPI/playstation/main.cpp:

(loadLibraryOrExit):
(main):
Add PlayStation Platform support.

  • TestWebKitAPI/Tests/WebKit/WKPreferences.cpp:

(TestWebKitAPI::TEST):
Use the same expected default font preferences as GTK's.

Location:
trunk
Files:
7 added
29 edited
8 copied

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r261965 r262022  
     12020-05-21  Yoshiaki Jitsukawa  <yoshiaki.jitsukawa@sony.com>
     2
     3        [PlayStation] Add minimal WKView API to enable TestWebKitAPI
     4        https://bugs.webkit.org/show_bug.cgi?id=211868
     5
     6        Reviewed by Alex Christensen.
     7
     8        Enable TestWebKitAPI
     9
     10        * Source/cmake/OptionsPlayStation.cmake:
     11        Disable FullScreen API and ContextMenus.
     12
    1132020-05-20  ChangSeok Oh  <changseok@webkit.org>
    214
  • trunk/Source/WTF/ChangeLog

    r262000 r262022  
     12020-05-21  Yoshiaki Jitsukawa  <yoshiaki.jitsukawa@sony.com>
     2
     3        [PlayStation] Add minimal WKView API to enable TestWebKitAPI
     4        https://bugs.webkit.org/show_bug.cgi?id=211868
     5
     6        Reviewed by Alex Christensen.
     7
     8        Enable TestWebKitAPI
     9
     10        * wtf/PlatformPlayStation.cmake:
     11        Link libc as a system library.
     12
    1132020-05-21  Wenson Hsieh  <wenson_hsieh@apple.com>
    214
  • trunk/Source/WTF/wtf/PlatformPlayStation.cmake

    r261428 r262022  
    1919
    2020list(APPEND WTF_LIBRARIES
    21     ${C_STD_LIBRARY}
    2221    ${KERNEL_LIBRARY}
    2322    Threads::Threads
  • trunk/Source/WebCore/ChangeLog

    r262016 r262022  
     12020-05-21  Yoshiaki Jitsukawa  <yoshiaki.jitsukawa@sony.com>
     2
     3        [PlayStation] Add minimal WKView API to enable TestWebKitAPI
     4        https://bugs.webkit.org/show_bug.cgi?id=211868
     5
     6        Reviewed by Alex Christensen.
     7
     8        Enable TestWebKitAPI
     9
     10        * PlatformPlayStation.cmake:
     11        Add WebKitRequirements library to WebCore_CopySharedLibs.
     12
    1132020-05-21  Chris Dumez  <cdumez@apple.com>
    214
  • trunk/Source/WebCore/PlatformPlayStation.cmake

    r261571 r262022  
    9797        ${OPENSSL_LIBRARIES}
    9898        ${PNG_LIBRARIES}
     99        ${WebKitRequirements_LIBRARY}
    99100        ${WebP_LIBRARIES}
    100101)
  • trunk/Source/WebKit/ChangeLog

    r262005 r262022  
     12020-05-21  Yoshiaki Jitsukawa  <yoshiaki.jitsukawa@sony.com>
     2
     3        [PlayStation] Add minimal WKView API to enable TestWebKitAPI
     4        https://bugs.webkit.org/show_bug.cgi?id=211868
     5
     6        Reviewed by Alex Christensen.
     7
     8        Enable TestWebKitAPI
     9
     10        * Platform/IPC/Connection.h:
     11        * Platform/IPC/unix/ConnectionUnix.cpp:
     12        (IPC::Connection::platformInvalidate):
     13        (IPC::Connection::open):
     14        Add SocketMonitor to monitor received messages.
     15
     16        * UIProcess/API/APIProcessPoolConfiguration.cpp:
     17        (API::ProcessPoolConfiguration::copy):
     18        * UIProcess/API/APIProcessPoolConfiguration.h:
     19        Add PlayStation specific members: WebProcess and NetworkProcess paths, and user ID.
     20
     21        * UIProcess/Launcher/ProcessLauncher.h:
     22        Add PlayStation specific members: Process path and user ID.
     23
     24        * NetworkProcess/EntryPoint/playstation/NetworkProcessMain.cpp: Copied from Tools\TestWebKitAPI\playstation\main.cpp.
     25        (loadLibraryOrExit):
     26        (main):
     27        * PlatformPlayStation.cmake:
     28        * Shared/API/c/playstation/WKEventPlayStation.cpp: Added.
     29        (WKKeyboardEventMake):
     30        (WKMouseEventMake):
     31        (WKWheelEventMake):
     32        * Shared/API/c/playstation/WKEventPlayStation.h: Added.
     33        * UIProcess/API/C/playstation/WKAPICastPlayStation.h:
     34        (WebKit::toAPI<>):
     35        (WebKit::toImpl<>):
     36        * UIProcess/API/C/playstation/WKContextConfigurationPlayStation.cpp: Copied from Tools\TestWebKitAPI\playstation\PlatformUtilitiesPlayStation.cpp.
     37        (WKContextConfigurationSetWebProcessPath):
     38        (WKContextConfigurationCopyWebProcessPath):
     39        (WKContextConfigurationSetNetworkProcessPath):
     40        (WKContextConfigurationCopyNetworkProcessPath):
     41        (WKContextConfigurationSetUserId):
     42        (WKContextConfigurationGetUserId):
     43        * UIProcess/API/C/playstation/WKContextConfigurationPlayStation.h: Copied from Source\WebKit\UIProcess\API\C\playstation\WKView.h.
     44        * UIProcess/API/C/playstation/WKPagePrivatePlayStation.cpp: Added.
     45        (WKPageHandleKeyboardEvent):
     46        (WKPageHandleMouseEvent):
     47        (WKPageHandleWheelEvent):
     48        * UIProcess/API/C/playstation/WKPagePrivatePlayStation.h: Copied from Source\WebKit\UIProcess\API\C\playstation\WKView.h.
     49        * UIProcess/API/C/playstation/WKView.cpp: Copied from Source\WebKit\WebProcess\InjectedBundle\playstation\InjectedBundlePlayStation.cpp.
     50        (WKViewCreate):
     51        (WKViewGetPage):
     52        * UIProcess/API/C/playstation/WKView.h:
     53        * UIProcess/Launcher/playstation/ProcessLauncherPlayStation.cpp:
     54        (WebKit::defaultProcessPath):
     55        (WebKit::ProcessLauncher::launchProcess):
     56        (WebKit::ProcessLauncher::terminateProcess):
     57        (WebKit::ProcessLauncher::platformInvalidate):
     58        * UIProcess/Network/NetworkProcessProxy.cpp:
     59        (WebKit::NetworkProcessProxy::getLaunchOptions):
     60        * UIProcess/WebProcessPool.h:
     61        * UIProcess/WebProcessProxy.cpp:
     62        (WebKit::WebProcessProxy::getLaunchOptions):
     63        * UIProcess/playstation/PageClientImpl.cpp: Added.
     64        (WebKit::PageClientImpl::PageClientImpl):
     65        (WebKit::PageClientImpl::createDrawingAreaProxy):
     66        (WebKit::PageClientImpl::setViewNeedsDisplay):
     67        (WebKit::PageClientImpl::requestScroll):
     68        (WebKit::PageClientImpl::viewScrollPosition):
     69        (WebKit::PageClientImpl::viewSize):
     70        (WebKit::PageClientImpl::isViewWindowActive):
     71        (WebKit::PageClientImpl::isViewFocused):
     72        (WebKit::PageClientImpl::isViewVisible):
     73        (WebKit::PageClientImpl::isViewInWindow):
     74        (WebKit::PageClientImpl::processDidExit):
     75        (WebKit::PageClientImpl::didRelaunchProcess):
     76        (WebKit::PageClientImpl::pageClosed):
     77        (WebKit::PageClientImpl::preferencesDidChange):
     78        (WebKit::PageClientImpl::toolTipChanged):
     79        (WebKit::PageClientImpl::didCommitLoadForMainFrame):
     80        (WebKit::PageClientImpl::handleDownloadRequest):
     81        (WebKit::PageClientImpl::didChangeContentSize):
     82        (WebKit::PageClientImpl::setCursor):
     83        (WebKit::PageClientImpl::setCursorHiddenUntilMouseMoves):
     84        (WebKit::PageClientImpl::didChangeViewportProperties):
     85        (WebKit::PageClientImpl::registerEditCommand):
     86        (WebKit::PageClientImpl::clearAllEditCommands):
     87        (WebKit::PageClientImpl::canUndoRedo):
     88        (WebKit::PageClientImpl::executeUndoRedo):
     89        (WebKit::PageClientImpl::wheelEventWasNotHandledByWebCore):
     90        (WebKit::PageClientImpl::convertToDeviceSpace):
     91        (WebKit::PageClientImpl::convertToUserSpace):
     92        (WebKit::PageClientImpl::screenToRootView):
     93        (WebKit::PageClientImpl::rootViewToScreen):
     94        (WebKit::PageClientImpl::accessibilityScreenToRootView):
     95        (WebKit::PageClientImpl::rootViewToAccessibilityScreen):
     96        (WebKit::PageClientImpl::doneWithKeyEvent):
     97        (WebKit::PageClientImpl::createPopupMenuProxy):
     98        (WebKit::PageClientImpl::enterAcceleratedCompositingMode):
     99        (WebKit::PageClientImpl::exitAcceleratedCompositingMode):
     100        (WebKit::PageClientImpl::updateAcceleratedCompositingMode):
     101        (WebKit::PageClientImpl::fullScreenManagerProxyClient):
     102        (WebKit::PageClientImpl::didFinishLoadingDataForCustomContentProvider):
     103        (WebKit::PageClientImpl::navigationGestureDidBegin):
     104        (WebKit::PageClientImpl::navigationGestureWillEnd):
     105        (WebKit::PageClientImpl::navigationGestureDidEnd):
     106        (WebKit::PageClientImpl::willRecordNavigationSnapshot):
     107        (WebKit::PageClientImpl::didRemoveNavigationGestureSnapshot):
     108        (WebKit::PageClientImpl::didFirstVisuallyNonEmptyLayoutForMainFrame):
     109        (WebKit::PageClientImpl::didFinishLoadForMainFrame):
     110        (WebKit::PageClientImpl::didFailLoadForMainFrame):
     111        (WebKit::PageClientImpl::didSameDocumentNavigationForMainFrame):
     112        (WebKit::PageClientImpl::didChangeBackgroundColor):
     113        (WebKit::PageClientImpl::isPlayingAudioWillChange):
     114        (WebKit::PageClientImpl::isPlayingAudioDidChange):
     115        (WebKit::PageClientImpl::refView):
     116        (WebKit::PageClientImpl::derefView):
     117        (WebKit::PageClientImpl::didRestoreScrollPosition):
     118        (WebKit::PageClientImpl::userInterfaceLayoutDirection):
     119        (WebKit::PageClientImpl::requestDOMPasteAccess):
     120        * UIProcess/playstation/PageClientImpl.h: Added.
     121        * UIProcess/playstation/WebProcessPoolPlayStation.cpp:
     122        (WebKit::WebProcessPool::platformInitialize):
     123        * UIProcess/playstation/PlayStationWebView.cpp: Copied from Source\WebKit\UIProcess\playstation\WebProcessPoolPlayStation.cpp.
     124        (WebKit::PlayStationWebView::create):
     125        (WebKit::PlayStationWebView::PlayStationWebView):
     126        (WebKit::PlayStationWebView::~PlayStationWebView):
     127        (WebKit::PlayStationWebView::isActive const):
     128        (WebKit::PlayStationWebView::isFocused const):
     129        (WebKit::PlayStationWebView::isVisible const):
     130        * UIProcess/playstation/PlayStationWebView.h: Copied from Source\WebKit\WebProcess\InjectedBundle\playstation\InjectedBundlePlayStation.cpp.
     131        (WebKit::PlayStationWebView::page):
     132        * WebProcess/EntryPoint/playstation/WebProcessMain.cpp: Copied from Tools\TestWebKitAPI\playstation\main.cpp.
     133        (loadLibraryOrExit):
     134        (main):
     135        * WebProcess/InjectedBundle/playstation/InjectedBundlePlayStation.cpp:
     136        (WebKit::InjectedBundle::initialize):
     137        (WebKit::InjectedBundle::setBundleParameter):
     138        * WebProcess/WebPage/AcceleratedSurface.cpp:
     139        (WebKit::AcceleratedSurface::create):
     140
    11412020-05-21  Chris Dumez  <cdumez@apple.com>
    2142
  • trunk/Source/WebKit/NetworkProcess/EntryPoint/playstation/NetworkProcessMain.cpp

    r262021 r262022  
    2525
    2626#include "config.h"
    27 #include "TestsController.h"
    28 #include "process-initialization/nk-testwebkitapi.h"
     27#include "NetworkProcessMain.h"
     28
    2929#include <dlfcn.h>
     30#include <process-initialization/nk-networkprocess.h>
     31#include <stdio.h>
     32#include <stdlib.h>
     33#include <unistd.h>
     34
     35static void loadLibraryOrExit(const char* name)
     36{
     37    if (!dlopen(name, RTLD_NOW)) {
     38        fprintf(stderr, "Failed to load %s.\n", name);
     39        exit(EXIT_FAILURE);
     40    }
     41}
    3042
    3143int main(int argc, char** argv)
    3244{
    33     dlopen("libicu", RTLD_NOW);
    34 #if defined(BUILDING_TestWebCore) || defined(BUILDING_TestWebKit)
    35     dlopen("libpng16", RTLD_NOW);
    36     dlopen("libfontconfig", RTLD_NOW);
    37     dlopen("libfreetype", RTLD_NOW);
    38     dlopen("libharfbuzz", RTLD_NOW);
    39     dlopen("libcairo", RTLD_NOW);
    40     dlopen("libSceNKWebKitRequirements", RTLD_NOW);
    41     dlopen("libJavaScriptCore", RTLD_NOW);
    42 #endif
    43 #if defined(BUILDING_TestWebKit)
    44     (dlopen("libcrypto", RTLD_NOW) && dlopen("libssl", RTLD_NOW)) || dlopen("LibreSSL", RTLD_NOW);
    45     dlopen("libcurl", RTLD_NOW);
    46     dlopen("libWebKit", RTLD_NOW);
    47 #endif
    48     return TestWebKitAPI::TestsController::singleton().run(argc, argv) ? EXIT_SUCCESS : EXIT_FAILURE;
     45    if (argc < 2) {
     46        fprintf(stderr, "Unexpected argument count %d\n", argc);
     47        exit(EXIT_FAILURE);
     48    }
     49
     50    if (!((dlopen("libcrypto", RTLD_NOW) && dlopen("libssl", RTLD_NOW)) || dlopen("LibreSSL", RTLD_NOW))) {
     51        fprintf(stderr, "Failed to load SSL library.\n");
     52        exit(EXIT_FAILURE);
     53    }
     54    loadLibraryOrExit("libcurl");
     55    loadLibraryOrExit("libicu");
     56    loadLibraryOrExit("libSceNKWebKitRequirements");
     57    loadLibraryOrExit("libJavaScriptCore");
     58    loadLibraryOrExit("libWebKit");
     59
     60    char* coreProcessIdentifier = argv[1];
     61
     62    char connectionIdentifier[16];
     63    snprintf(connectionIdentifier, sizeof(connectionIdentifier), "%d", PlayStation::getConnectionIdentifier());
     64
     65    char program[] = "dummy";
     66    char* internalArgv[] = {
     67        program,
     68        coreProcessIdentifier,
     69        connectionIdentifier,
     70        0
     71    };
     72    return WebKit::NetworkProcessMain(sizeof(internalArgv) / sizeof(char*), internalArgv);
    4973}
  • trunk/Source/WebKit/Platform/IPC/Connection.h

    r261812 r262022  
    411411    GSocketMonitor m_writeSocketMonitor;
    412412#endif
     413#if PLATFORM(PLAYSTATION)
     414    RefPtr<WTF::Thread> m_socketMonitor;
     415#endif
    413416#elif OS(DARWIN)
    414417    // Called on the connection queue.
  • trunk/Source/WebKit/Platform/IPC/unix/ConnectionUnix.cpp

    r261998 r262022  
    121121#endif
    122122
     123#if PLATFORM(PLAYSTATION)
     124    if (m_socketMonitor) {
     125        m_socketMonitor->detach();
     126        m_socketMonitor = nullptr;
     127    }
     128#endif
     129
    123130    m_socketDescriptor = -1;
    124131    m_isConnected = false;
     
    360367        return G_SOURCE_REMOVE;
    361368    });
     369#endif
     370
     371#if PLATFORM(PLAYSTATION)
     372    m_socketMonitor = Thread::create("SocketMonitor", [protectedThis] {
     373        {
     374            int fd;
     375            while ((fd = protectedThis->m_socketDescriptor) != -1) {
     376                int maxFd = fd;
     377                fd_set fdSet;
     378                FD_ZERO(&fdSet);
     379                FD_SET(fd, &fdSet);
     380
     381                if (-1 != select(maxFd + 1, &fdSet, 0, 0, 0)) {
     382                    if (FD_ISSET(fd, &fdSet))
     383                        protectedThis->readyReadHandler();
     384                }
     385            }
     386
     387        }
     388    });
     389    return true;
    362390#endif
    363391
  • trunk/Source/WebKit/PlatformPlayStation.cmake

    r260387 r262022  
    1 set(WebKit_OUTPUT_NAME SceWebKit)
    2 set(WebProcess_OUTPUT_NAME WebKitWebProcess)
    3 set(NetworkProcess_OUTPUT_NAME WebKitNetworkProcess)
    4 set(GPUProcess_OUTPUT_NAME WebKitGPUProcess)
    5 set(PluginProcess_OUTPUT_NAME WebKitPluginProcess)
    6 
    71include(Headers.cmake)
    82
     
    126
    137list(APPEND WebProcess_SOURCES
    14     WebProcess/EntryPoint/unix/WebProcessMain.cpp
     8    WebProcess/EntryPoint/playstation/WebProcessMain.cpp
    159)
    1610
    1711list(APPEND NetworkProcess_SOURCES
    18     NetworkProcess/EntryPoint/unix/NetworkProcessMain.cpp
     12    NetworkProcess/EntryPoint/playstation/NetworkProcessMain.cpp
    1913)
    2014
     
    5852    Shared/API/c/curl/WKCertificateInfoCurl.cpp
    5953
     54    Shared/API/c/playstation/WKEventPlayStation.cpp
     55
    6056    Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp
    6157    Shared/CoordinatedGraphics/SimpleViewportController.cpp
     
    9187    UIProcess/API/C/curl/WKWebsiteDataStoreRefCurl.cpp
    9288
     89    UIProcess/API/C/playstation/WKContextConfigurationPlayStation.cpp
     90    UIProcess/API/C/playstation/WKPagePrivatePlayStation.cpp
     91    UIProcess/API/C/playstation/WKView.cpp
     92
    9393    UIProcess/Automation/cairo/WebAutomationSessionCairo.cpp
    9494
     
    105105    UIProcess/libwpe/WebPasteboardProxyLibWPE.cpp
    106106
     107    UIProcess/playstation/PageClientImpl.cpp
     108    UIProcess/playstation/PlayStationWebView.cpp
    107109    UIProcess/playstation/WebPageProxyPlayStation.cpp
    108110    UIProcess/playstation/WebProcessPoolPlayStation.cpp
     
    139141    "${WEBKIT_DIR}/UIProcess/API/C/playstation"
    140142    "${WEBKIT_DIR}/UIProcess/CoordinatedGraphics"
     143    "${WEBKIT_DIR}/UIProcess/playstation"
    141144    "${WEBKIT_DIR}/WebProcess/WebCoreSupport/curl"
    142145    "${WEBKIT_DIR}/WebProcess/WebPage/CoordinatedGraphics"
     
    151154
    152155    Shared/API/c/playstation/WKBasePlayStation.h
     156    Shared/API/c/playstation/WKEventPlayStation.h
    153157
    154158    UIProcess/API/C/curl/WKProtectionSpaceCurl.h
    155159    UIProcess/API/C/curl/WKWebsiteDataStoreRefCurl.h
    156160
     161    UIProcess/API/C/playstation/WKContextConfigurationPlayStation.h
     162    UIProcess/API/C/playstation/WKPagePrivatePlayStation.h
    157163    UIProcess/API/C/playstation/WKView.h
    158164)
     
    164170    $<TARGET_OBJECTS:PAL>
    165171    $<TARGET_OBJECTS:WebCore>
     172    WebKitRequirements::ProcessLauncher
    166173)
  • trunk/Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.cpp

    r260065 r262022  
    7272    copy->m_useSystemAppearanceForScrollbars = m_useSystemAppearanceForScrollbars;
    7373#endif
    74 
     74#if PLATFORM(PLAYSTATION)
     75    copy->m_webProcessPath = this->m_webProcessPath;
     76    copy->m_networkProcessPath = this->m_networkProcessPath;
     77    copy->m_userId = this->m_userId;
     78#endif
    7579    return copy;
    7680}
  • trunk/Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.h

    r260065 r262022  
    137137#endif
    138138
     139#if PLATFORM(PLAYSTATION)
     140    const WTF::String& webProcessPath() const { return m_webProcessPath; }
     141    void setWebProcessPath(const WTF::String& webProcessPath) { m_webProcessPath = webProcessPath; }
     142
     143    const WTF::String& networkProcessPath() const { return m_networkProcessPath; }
     144    void setNetworkProcessPath(const WTF::String& networkProcessPath) { m_networkProcessPath = networkProcessPath; }
     145
     146    int32_t userId() const { return m_userId; }
     147    void setUserId(const int32_t userId) { m_userId = userId; }
     148#endif
     149
    139150private:
    140151    WTF::String m_injectedBundlePath;
     
    166177    bool m_useSystemAppearanceForScrollbars { false };
    167178#endif
     179#if PLATFORM(PLAYSTATION)
     180    WTF::String m_webProcessPath;
     181    WTF::String m_networkProcessPath;
     182    int32_t m_userId { -1 };
     183#endif
    168184};
    169185
  • trunk/Source/WebKit/UIProcess/API/C/playstation/WKAPICastPlayStation.h

    r255685 r262022  
    3131#endif
    3232
     33namespace WebKit {
     34
     35class PlayStationWebView;
     36
     37WK_ADD_API_MAPPING(WKViewRef, PlayStationWebView)
     38
     39template<>
     40inline WKViewRef toAPI<>(PlayStationWebView* view)
     41{
     42    return reinterpret_cast<WKViewRef>(static_cast<void*>(view));
     43}
     44
     45template<>
     46inline PlayStationWebView* toImpl<>(WKViewRef view)
     47{
     48    return static_cast<PlayStationWebView*>(static_cast<void*>(const_cast<typename std::remove_const<typename std::remove_pointer<WKViewRef>::type>::type*>(view)));
     49}
     50
     51}
     52
    3353#endif /* WKAPICastPlayStation_h */
  • trunk/Source/WebKit/UIProcess/API/C/playstation/WKContextConfigurationPlayStation.cpp

    r262021 r262022  
    2525
    2626#include "config.h"
    27 #include "PlatformUtilities.h"
     27#include "WKContextConfigurationPlayStation.h"
    2828
    29 #include <wtf/FileSystem.h>
    30 #include <wtf/URL.h>
     29#include "APIProcessPoolConfiguration.h"
     30#include "WKAPICast.h"
    3131
    32 namespace TestWebKitAPI {
    33 namespace Util {
    34 
    35 WKStringRef createInjectedBundlePath()
     32void WKContextConfigurationSetWebProcessPath(WKContextConfigurationRef configuration, WKStringRef webProcessPath)
    3633{
    37     return WKStringCreateWithUTF8CString("injectedbundle");
     34    WebKit::toImpl(configuration)->setWebProcessPath(WebKit::toImpl(webProcessPath)->string());
    3835}
    3936
    40 WKURLRef createURLForResource(const char* resource, const char* extension)
     37WKStringRef WKContextConfigurationCopyWebProcessPath(WKContextConfigurationRef configuration)
    4138{
    42     String filename = makeString(resource, '.', extension);
    43     auto url = URL::fileURLWithFileSystemPath(filename);
    44     return WKURLCreateWithUTF8CString(url.string().utf8().data());
     39    return WebKit::toCopiedAPI(WebKit::toImpl(configuration)->webProcessPath());
    4540}
    4641
    47 WKURLRef URLForNonExistentResource()
     42void WKContextConfigurationSetNetworkProcessPath(WKContextConfigurationRef configuration, WKStringRef networkProcessPath)
    4843{
    49     return WKURLCreateWithUTF8CString("file:///does-not-exist.html");
     44    WebKit::toImpl(configuration)->setNetworkProcessPath(WebKit::toImpl(networkProcessPath)->string());
    5045}
    5146
    52 bool isKeyDown(WKNativeEventPtr event)
     47WKStringRef WKContextConfigurationCopyNetworkProcessPath(WKContextConfigurationRef configuration)
    5348{
    54     // FIXME: implement this.
    55     return false;
     49    return WebKit::toCopiedAPI(WebKit::toImpl(configuration)->networkProcessPath());
    5650}
    5751
    58 } // namespace Util
    59 } // namespace TestWebKitAPI
     52void WKContextConfigurationSetUserId(WKContextConfigurationRef configuration, int32_t userId)
     53{
     54    WebKit::toImpl(configuration)->setUserId(userId);
     55}
     56
     57int32_t WKContextConfigurationGetUserId(WKContextConfigurationRef configuration)
     58{
     59    return WebKit::toImpl(configuration)->userId();
     60}
  • trunk/Source/WebKit/UIProcess/API/C/playstation/WKContextConfigurationPlayStation.h

    r262021 r262022  
    2424 */
    2525
    26 #ifndef WKView_h
    27 #define WKView_h
     26#pragma once
    2827
    2928#include <WebKit/WKBase.h>
     29#include <WebKit/WKContextConfigurationRef.h>
    3030
    3131#ifdef __cplusplus
     
    3333#endif
    3434
     35WK_EXPORT void WKContextConfigurationSetWebProcessPath(WKContextConfigurationRef configuration, WKStringRef webProcessPath);
     36WK_EXPORT WKStringRef WKContextConfigurationCopyWebProcessPath(WKContextConfigurationRef configuration);
     37
     38WK_EXPORT void WKContextConfigurationSetNetworkProcessPath(WKContextConfigurationRef configuration, WKStringRef networkProcessPath);
     39WK_EXPORT WKStringRef WKContextConfigurationCopyNetworkProcessPath(WKContextConfigurationRef configuration);
     40
     41WK_EXPORT void WKContextConfigurationSetUserId(WKContextConfigurationRef configuration, int32_t userId);
     42WK_EXPORT int32_t WKContextConfigurationGetUserId(WKContextConfigurationRef configuration);
     43
    3544#ifdef __cplusplus
    3645}
    3746#endif
    38 
    39 #endif /* WKView_h */
  • trunk/Source/WebKit/UIProcess/API/C/playstation/WKPagePrivatePlayStation.h

    r262021 r262022  
    2424 */
    2525
    26 #ifndef WKView_h
    27 #define WKView_h
     26#pragma once
    2827
    2928#include <WebKit/WKBase.h>
     29#include <WebKit/WKEventPlayStation.h>
    3030
    3131#ifdef __cplusplus
     
    3333#endif
    3434
     35WK_EXPORT void WKPageHandleKeyboardEvent(WKPageRef page, WKKeyboardEvent);
     36WK_EXPORT void WKPageHandleMouseEvent(WKPageRef page, WKMouseEvent);
     37WK_EXPORT void WKPageHandleWheelEvent(WKPageRef page, WKWheelEvent);
     38
    3539#ifdef __cplusplus
    3640}
    3741#endif
    38 
    39 #endif /* WKView_h */
  • trunk/Source/WebKit/UIProcess/API/C/playstation/WKView.cpp

    r262021 r262022  
    2525
    2626#include "config.h"
    27 #include "InjectedBundle.h"
     27#include "WKView.h"
    2828
    29 namespace WebKit {
     29#include "APIPageConfiguration.h"
     30#include "PlayStationWebView.h"
     31#include "WKAPICast.h"
    3032
    31 bool InjectedBundle::initialize(const WebProcessCreationParameters&, API::Object* initializationUserData)
     33WKViewRef WKViewCreate(WKPageConfigurationRef configuration)
    3234{
    33     return false;
     35    return WebKit::toAPI(WebKit::PlayStationWebView::create(*WebKit::toImpl(configuration)).leakRef());
    3436}
    3537
    36 void InjectedBundle::setBundleParameter(WTF::String const&, IPC::DataReference const&)
     38WKPageRef WKViewGetPage(WKViewRef viewRef)
    3739{
     40    return WebKit::toAPI(WebKit::toImpl(viewRef)->page());
    3841}
    39 
    40 void InjectedBundle::setBundleParameters(const IPC::DataReference&)
    41 {
    42 }
    43 
    44 } // namespace WebKit
  • trunk/Source/WebKit/UIProcess/API/C/playstation/WKView.h

    r255685 r262022  
    2424 */
    2525
    26 #ifndef WKView_h
    27 #define WKView_h
     26#pragma once
    2827
    2928#include <WebKit/WKBase.h>
     
    3332#endif
    3433
     34WK_EXPORT WKViewRef WKViewCreate(WKPageConfigurationRef configuration);
     35WK_EXPORT WKPageRef WKViewGetPage(WKViewRef view);
     36
    3537#ifdef __cplusplus
    3638}
    3739#endif
    38 
    39 #endif /* WKView_h */
  • trunk/Source/WebKit/UIProcess/Launcher/ProcessLauncher.h

    r253098 r262022  
    8686#endif
    8787#endif
     88
     89#if PLATFORM(PLAYSTATION)
     90        String processPath;
     91        int32_t userId { -1 };
     92#endif
    8893    };
    8994
  • trunk/Source/WebKit/UIProcess/Launcher/playstation/ProcessLauncherPlayStation.cpp

    r254713 r262022  
    3030#include "ProcessLauncher.h"
    3131
     32#include <process-launcher.h>
     33#include <stdint.h>
     34#include <sys/socket.h>
     35
    3236namespace WebKit {
     37
     38#define MAKE_PROCESS_PATH(x) "/app0/" #x "Process.self"
     39static const char* defaultProcessPath(ProcessLauncher::ProcessType processType)
     40{
     41    switch (processType) {
     42    case ProcessLauncher::ProcessType::Network:
     43        return MAKE_PROCESS_PATH(Network);
     44#if ENABLE(GPU_PROCESS)
     45    case ProcessLauncher::ProcessType::GPU:
     46        return MAKE_PROCESS_PATH(GPU);
     47#endif
     48    case ProcessLauncher::ProcessType::Web:
     49    default:
     50        return MAKE_PROCESS_PATH(Web);
     51    }
     52}
    3353
    3454void ProcessLauncher::launchProcess()
    3555{
     56    IPC::Connection::Identifier serverIdentifier;
     57    IPC::Connection::SocketPair socketPair = IPC::Connection::createPlatformConnection(IPC::Connection::ConnectionOptions::SetCloexecOnServer);
     58
     59    int sendBufSize = 32 * 1024;
     60    setsockopt(socketPair.server, SOL_SOCKET, SO_SNDBUF, &sendBufSize, 4);
     61    setsockopt(socketPair.client, SOL_SOCKET, SO_SNDBUF, &sendBufSize, 4);
     62
     63    int recvBufSize = 32 * 1024;
     64    setsockopt(socketPair.server, SOL_SOCKET, SO_RCVBUF, &recvBufSize, 4);
     65    setsockopt(socketPair.client, SOL_SOCKET, SO_RCVBUF, &recvBufSize, 4);
     66
     67    char coreProcessIdentifierString[16];
     68    snprintf(coreProcessIdentifierString, sizeof coreProcessIdentifierString, "%ld", m_launchOptions.processIdentifier.toUInt64());
     69
     70    char* argv[] = {
     71        coreProcessIdentifierString,
     72        nullptr
     73    };
     74
     75    PlayStation::LaunchParam param { socketPair.client, m_launchOptions.userId };
     76    int32_t appLocalPid = PlayStation::launchProcess(
     77        !m_launchOptions.processPath.isEmpty() ? m_launchOptions.processPath.utf8().data() : defaultProcessPath(m_launchOptions.processType),
     78        argv, param);
     79    if (appLocalPid < 0) {
     80#ifndef NDEBUG
     81        fprintf(stderr, "Failed to launch process. err=0x%08x path=%s\n", appLocalPid, m_launchOptions.processPath.utf8().data());
     82#endif
     83        return;
     84    }
     85    close(socketPair.client);
     86    serverIdentifier = socketPair.server;
     87
     88    // We've finished launching the process, message back to the main run loop.
     89    RefPtr<ProcessLauncher> protectedThis(this);
     90    RunLoop::main().dispatch([=] {
     91        protectedThis->didFinishLaunchingProcess(appLocalPid, serverIdentifier);
     92    });
    3693}
    3794
    3895void ProcessLauncher::terminateProcess()
    3996{
     97    if (!m_processIdentifier)
     98        return;
     99
     100    PlayStation::terminateProcess(m_processIdentifier);
    40101}
    41102
    42103void ProcessLauncher::platformInvalidate()
    43104{
     105    m_processIdentifier = 0;
    44106}
    45107
  • trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp

    r261963 r262022  
    110110        launchOptions.shouldMakeProcessLaunchFailForTesting = true;
    111111    }
     112
     113#if PLATFORM(PLAYSTATION)
     114    launchOptions.processPath = m_processPool.networkProcessPath();
     115    launchOptions.userId = m_processPool.userId();
     116#endif
    112117}
    113118
  • trunk/Source/WebKit/UIProcess/WebProcessPool.h

    r261948 r262022  
    536536#endif
    537537
     538#if PLATFORM(PLAYSTATION)
     539    const String& webProcessPath() const { return m_resolvedPaths.webProcessPath; }
     540    const String& networkProcessPath() const { return m_resolvedPaths.networkProcessPath; }
     541    int32_t userId() const { return m_userId; }
     542#endif
     543
    538544private:
    539545    void platformInitialize();
     
    763769#endif
    764770
     771#if PLATFORM(PLAYSTATION)
     772        String webProcessPath;
     773        String networkProcessPath;
     774#endif
     775
    765776        Vector<String> additionalWebProcessSandboxExtensionPaths;
    766777    };
     
    799810    };
    800811    Optional<AudibleMediaActivity> m_audibleMediaActivity;
     812
     813#if PLATFORM(PLAYSTATION)
     814    int32_t m_userId { -1 };
     815#endif
    801816
    802817#if PLATFORM(IOS)
  • trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp

    r261288 r262022  
    333333        launchOptions.extraInitializationData.add("is-prewarmed"_s, "1"_s);
    334334
     335#if PLATFORM(PLAYSTATION)
     336    launchOptions.processPath = m_processPool->webProcessPath();
     337    launchOptions.userId = m_processPool->userId();
     338#endif
     339
    335340    if (processPool().shouldMakeNextWebProcessLaunchFailForTesting()) {
    336341        processPool().setShouldMakeNextWebProcessLaunchFailForTesting(false);
  • trunk/Source/WebKit/UIProcess/playstation/PlayStationWebView.cpp

    r262021 r262022  
    1111 *    documentation and/or other materials provided with the distribution.
    1212 *
    13  * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS AS IS''
     13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
    1414 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
    1515 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     
    2525
    2626#include "config.h"
     27#include "PlayStationWebView.h"
     28
     29#include "APIPageConfiguration.h"
     30#include "DrawingAreaProxyCoordinatedGraphics.h"
    2731#include "WebProcessPool.h"
    2832
    2933namespace WebKit {
    3034
    31 void WebProcessPool::platformInitialize()
     35RefPtr<PlayStationWebView> PlayStationWebView::create(const API::PageConfiguration& configuration)
     36{
     37    return adoptRef(*new PlayStationWebView(configuration));
     38}
     39
     40PlayStationWebView::PlayStationWebView(const API::PageConfiguration& conf)
     41    : m_pageClient(makeUnique<PageClientImpl>(*this))
     42{
     43    auto configuration = conf.copy();
     44    auto* pool = configuration->processPool();
     45    m_page = pool->createWebPage(*m_pageClient, WTFMove(configuration));
     46
     47    m_page->initializeWebPage();
     48}
     49
     50PlayStationWebView::~PlayStationWebView()
    3251{
    3352}
    3453
    35 void WebProcessPool::platformInitializeNetworkProcess(NetworkProcessCreationParameters&)
     54bool PlayStationWebView::isActive() const
    3655{
    37     notImplemented();
     56    return m_active;
    3857}
    3958
    40 void WebProcessPool::platformInitializeWebProcess(const WebProcessProxy&, WebProcessCreationParameters&)
     59bool PlayStationWebView::isFocused() const
    4160{
    42     notImplemented();
     61    return m_focused;
    4362}
    4463
    45 void WebProcessPool::platformInvalidateContext()
     64bool PlayStationWebView::isVisible() const
    4665{
    47     notImplemented();
    48 }
    49 
    50 void WebProcessPool::platformResolvePathsForSandboxExtensions()
    51 {
     66    return m_visible;
    5267}
    5368
  • trunk/Source/WebKit/UIProcess/playstation/PlayStationWebView.h

    r262021 r262022  
    2424 */
    2525
    26 #include "config.h"
    27 #include "InjectedBundle.h"
     26#pragma once
     27
     28#include "APIObject.h"
     29#include "PageClientImpl.h"
     30#include "WKView.h"
     31#include "WebPageProxy.h"
    2832
    2933namespace WebKit {
    3034
    31 bool InjectedBundle::initialize(const WebProcessCreationParameters&, API::Object* initializationUserData)
    32 {
    33     return false;
    34 }
     35class PlayStationWebView : public API::ObjectImpl<API::Object::Type::View> {
     36    WTF_MAKE_FAST_ALLOCATED;
     37public:
     38    static RefPtr<PlayStationWebView> create(const API::PageConfiguration&);
     39    virtual ~PlayStationWebView();
    3540
    36 void InjectedBundle::setBundleParameter(WTF::String const&, IPC::DataReference const&)
    37 {
    38 }
     41    WebPageProxy* page() { return m_page.get(); }
    3942
    40 void InjectedBundle::setBundleParameters(const IPC::DataReference&)
    41 {
    42 }
     43    bool isActive() const;
     44    bool isFocused() const;
     45    bool isVisible() const;
     46
     47private:
     48    PlayStationWebView(const API::PageConfiguration&);
     49
     50    std::unique_ptr<WebKit::PageClientImpl> m_pageClient;
     51    RefPtr<WebPageProxy> m_page;
     52
     53    bool m_active { false };
     54    bool m_focused { false };
     55    bool m_visible { false };
     56#if ENABLE(FULLSCREEN_API)
     57    bool m_isFullScreen { false };
     58#endif
     59};
    4360
    4461} // namespace WebKit
  • trunk/Source/WebKit/UIProcess/playstation/WebProcessPoolPlayStation.cpp

    r254713 r262022  
    3131void WebProcessPool::platformInitialize()
    3232{
     33    m_userId = m_configuration->userId();
    3334}
    3435
  • trunk/Source/WebKit/WebProcess/EntryPoint/playstation/WebProcessMain.cpp

    r262021 r262022  
    2525
    2626#include "config.h"
    27 #include "TestsController.h"
    28 #include "process-initialization/nk-testwebkitapi.h"
     27#include "WebProcessMain.h"
     28
    2929#include <dlfcn.h>
     30#include <process-initialization/nk-webprocess.h>
     31#include <stdio.h>
     32#include <stdlib.h>
     33#include <unistd.h>
     34
     35static void loadLibraryOrExit(const char* name)
     36{
     37    if (!dlopen(name, RTLD_NOW)) {
     38        fprintf(stderr, "Failed to load %s.\n", name);
     39        exit(EXIT_FAILURE);
     40    }
     41}
    3042
    3143int main(int argc, char** argv)
    3244{
    33     dlopen("libicu", RTLD_NOW);
    34 #if defined(BUILDING_TestWebCore) || defined(BUILDING_TestWebKit)
    35     dlopen("libpng16", RTLD_NOW);
    36     dlopen("libfontconfig", RTLD_NOW);
    37     dlopen("libfreetype", RTLD_NOW);
    38     dlopen("libharfbuzz", RTLD_NOW);
    39     dlopen("libcairo", RTLD_NOW);
    40     dlopen("libSceNKWebKitRequirements", RTLD_NOW);
    41     dlopen("libJavaScriptCore", RTLD_NOW);
    42 #endif
    43 #if defined(BUILDING_TestWebKit)
    44     (dlopen("libcrypto", RTLD_NOW) && dlopen("libssl", RTLD_NOW)) || dlopen("LibreSSL", RTLD_NOW);
    45     dlopen("libcurl", RTLD_NOW);
    46     dlopen("libWebKit", RTLD_NOW);
    47 #endif
    48     return TestWebKitAPI::TestsController::singleton().run(argc, argv) ? EXIT_SUCCESS : EXIT_FAILURE;
     45    if (argc < 2) {
     46        fprintf(stderr, "Unexpected argument count %d\n", argc);
     47        exit(EXIT_FAILURE);
     48    }
     49
     50    loadLibraryOrExit("libpng16");
     51    loadLibraryOrExit("libicu");
     52    loadLibraryOrExit("libfreetype");
     53    loadLibraryOrExit("libfontconfig");
     54    loadLibraryOrExit("libharfbuzz");
     55    loadLibraryOrExit("libcairo");
     56    loadLibraryOrExit("libSceNKWebKitRequirements");
     57    loadLibraryOrExit("libJavaScriptCore");
     58    loadLibraryOrExit("libWebKit");
     59
     60    char* coreProcessIdentifier = argv[1];
     61
     62    char connectionIdentifier[16];
     63    snprintf(connectionIdentifier, sizeof(connectionIdentifier), "%d", PlayStation::getConnectionIdentifier());
     64
     65    char program[] = "dummy";
     66    char* internalArgv[] = {
     67        program,
     68        coreProcessIdentifier,
     69        connectionIdentifier,
     70        0
     71    };
     72    return WebKit::WebProcessMain(sizeof(internalArgv) / sizeof(char*), internalArgv);
    4973}
  • trunk/Source/WebKit/WebProcess/InjectedBundle/playstation/InjectedBundlePlayStation.cpp

    r254713 r262022  
    2727#include "InjectedBundle.h"
    2828
     29#include "WKBundleAPICast.h"
     30#include "WKBundleInitialize.h"
     31#include "library-bundle.h"
     32
    2933namespace WebKit {
    3034
    31 bool InjectedBundle::initialize(const WebProcessCreationParameters&, API::Object* initializationUserData)
     35bool InjectedBundle::initialize(const WebProcessCreationParameters& parameters, API::Object* initializationUserData)
    3236{
    33     return false;
     37    auto bundle = LibraryBundle::create(m_path.utf8().data());
     38    m_platformBundle = bundle;
     39    if (!m_platformBundle) {
     40        printf("PlayStation::Bundle::create failed\n");
     41        return false;
     42    }
     43    WKBundleInitializeFunctionPtr initializeFunction = reinterpret_cast<WKBundleInitializeFunctionPtr>(bundle->resolve("WKBundleInitialize"));
     44    if (!initializeFunction) {
     45        printf("PlayStation::Bundle::resolve failed\n");
     46        return false;
     47    }
     48    initializeFunction(toAPI(this), toAPI(initializationUserData));
     49    return true;
    3450}
    3551
    3652void InjectedBundle::setBundleParameter(WTF::String const&, IPC::DataReference const&)
    3753{
     54
    3855}
    3956
  • trunk/Source/WebKit/WebProcess/WebPage/AcceleratedSurface.cpp

    r246308 r262022  
    5959        return AcceleratedSurfaceX11::create(webPage, client);
    6060#endif
    61 #if USE(LIBWPE)
     61#if USE(WPE_RENDERER)
    6262    if (PlatformDisplay::sharedDisplay().type() == PlatformDisplay::Type::WPE)
    6363        return AcceleratedSurfaceLibWPE::create(webPage, client);
  • trunk/Source/cmake/OptionsPlayStation.cmake

    r261462 r262022  
    6060WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_VARIATION_FONTS PRIVATE OFF)
    6161
     62# Enable in the future
     63WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_FULLSCREEN_API PRIVATE OFF)
     64WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CONTEXT_MENUS PRIVATE OFF)
     65
    6266# No support planned
    6367WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_FTPDIR PRIVATE OFF)
     
    104108find_library(C_STD_LIBRARY c)
    105109find_library(KERNEL_LIBRARY kernel)
     110find_package(WebKitRequirements REQUIRED
     111    COMPONENTS
     112        JPEG
     113        LibPSL
     114        LibXml2
     115        ProcessLauncher
     116        SQLite3
     117        ZLIB
     118        libwpe
     119)
    106120
    107121find_package(Cairo REQUIRED)
     
    112126find_package(HarfBuzz REQUIRED COMPONENTS ICU)
    113127find_package(ICU 60.2 REQUIRED COMPONENTS data i18n uc)
    114 find_package(JPEG REQUIRED)
    115 find_package(LibPSL REQUIRED)
    116 find_package(LibXml2 REQUIRED)
    117128find_package(OpenSSL REQUIRED)
    118129find_package(PNG REQUIRED)
    119 find_package(SQLite3 REQUIRED)
    120130find_package(Threads REQUIRED)
    121131find_package(WebP REQUIRED COMPONENTS demux)
    122 find_package(WPE REQUIRED)
    123 find_package(ZLIB REQUIRED)
     132
     133set(CMAKE_C_STANDARD_LIBRARIES
     134    "${CMAKE_C_STANDARD_LIBRARIES} ${C_STD_LIBRARY}"
     135  )
     136set(CMAKE_CXX_STANDARD_LIBRARIES
     137    "${CMAKE_CXX_STANDARD_LIBRARIES} ${C_STD_LIBRARY}"
     138  )
    124139
    125140# TODO: Add a check for HAVE_RSA_PSS for support of CryptoAlgorithmRSA_PSS
     
    134149SET_AND_EXPOSE_TO_BUILD(USE_LIBWPE ON)
    135150SET_AND_EXPOSE_TO_BUILD(USE_OPENSSL ON)
    136 SET_AND_EXPOSE_TO_BUILD(USE_WPE_RENDERER ON)
     151SET_AND_EXPOSE_TO_BUILD(USE_WPE_RENDERER OFF)
    137152
    138153SET_AND_EXPOSE_TO_BUILD(USE_INSPECTOR_SOCKET_SERVER ${ENABLE_REMOTE_INSPECTOR})
  • trunk/Tools/ChangeLog

    r262018 r262022  
     12020-05-21  Yoshiaki Jitsukawa  <yoshiaki.jitsukawa@sony.com>
     2
     3        [PlayStation] Add minimal WKView API to enable TestWebKitAPI
     4        https://bugs.webkit.org/show_bug.cgi?id=211868
     5
     6        Reviewed by Alex Christensen.
     7
     8        Enable TestWebKitAPI
     9
     10        * TestWebKitAPI/PlatformPlayStation.cmake:
     11        * TestWebKitAPI/PlatformWebView.h:
     12        * TestWebKitAPI/playstation/PlatformUtilitiesPlayStation.cpp:
     13        (TestWebKitAPI::Util::createInjectedBundlePath):
     14        (TestWebKitAPI::Util::createURLForResource):
     15        * TestWebKitAPI/playstation/PlatformWebViewPlayStation.cpp:
     16        (TestWebKitAPI::PlatformWebView::PlatformWebView):
     17        (TestWebKitAPI::PlatformWebView::~PlatformWebView):
     18        (TestWebKitAPI::PlatformWebView::initialize):
     19        (TestWebKitAPI::PlatformWebView::resizeTo):
     20        (TestWebKitAPI::PlatformWebView::page const):
     21        (TestWebKitAPI::PlatformWebView::simulateSpacebarKeyPress):
     22        (TestWebKitAPI::PlatformWebView::simulateMouseMove):
     23        (TestWebKitAPI::PlatformWebView::simulateRightClick):
     24        (TestWebKitAPI::PlatformWebView::simulateButtonClick):
     25        * TestWebKitAPI/playstation/main.cpp:
     26        (loadLibraryOrExit):
     27        (main):
     28        Add PlayStation Platform support.
     29
     30        * TestWebKitAPI/Tests/WebKit/WKPreferences.cpp:
     31        (TestWebKitAPI::TEST):
     32        Use the same expected default font preferences as GTK's.
     33
    1342020-05-21  Alex Christensen  <achristensen@webkit.org>
    235
  • trunk/Tools/TestWebKitAPI/PlatformPlayStation.cmake

    r260738 r262022  
    4949        playstation/PlatformWebViewPlayStation.cpp
    5050    )
     51
     52    # Exclude tests which don't finish.
     53    list(REMOVE_ITEM TestWebKit_SOURCES
     54        Tests/WebKit/ForceRepaint.cpp
     55        Tests/WebKit/Geolocation.cpp
     56    )
    5157endif ()
    5258
     
    5662    set_target_properties(TestWTF TestWebCore TestWebKit PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
    5763endif ()
     64
     65add_definitions(
     66    -DTEST_WEBKIT_RESOURCES_DIR=\"${TOOLS_DIR}/TestWebKitAPI/Tests/WebKit\"
     67)
  • trunk/Tools/TestWebKitAPI/PlatformWebView.h

    r255899 r262022  
    6161typedef HWND PlatformWindow;
    6262#elif PLATFORM(PLAYSTATION)
    63 typedef void* PlatformWKView;
     63typedef WKViewRef PlatformWKView;
    6464typedef void* PlatformWindow;
    6565#endif
     
    8888    void simulateRightClick(unsigned x, unsigned y);
    8989    void simulateMouseMove(unsigned x, unsigned y, WKEventModifiers = 0);
    90 #if PLATFORM(MAC)
     90#if PLATFORM(MAC) || PLATFORM(PLAYSTATION)
    9191    void simulateButtonClick(WKEventMouseButton, unsigned x, unsigned y, WKEventModifiers);
    9292#endif
  • trunk/Tools/TestWebKitAPI/Tests/WebKit/WKPreferences.cpp

    r250345 r262022  
    4545TEST(WebKit, WKPreferencesDefaults)
    4646{
    47 #if PLATFORM(GTK)
     47#if PLATFORM(GTK) || PLATFORM(PLAYSTATION)
    4848    static const char* expectedStandardFontFamily = "Times";
    4949    static const char* expectedFixedFontFamily = "Courier New";
  • trunk/Tools/TestWebKitAPI/playstation/PlatformUtilitiesPlayStation.cpp

    r255708 r262022  
    3535WKStringRef createInjectedBundlePath()
    3636{
    37     return WKStringCreateWithUTF8CString("injectedbundle");
     37    return WKStringCreateWithUTF8CString("/app0/libTestWebKitAPIInjectedBundle.sprx");
    3838}
    3939
    4040WKURLRef createURLForResource(const char* resource, const char* extension)
    4141{
    42     String filename = makeString(resource, '.', extension);
    43     auto url = URL::fileURLWithFileSystemPath(filename);
    44     return WKURLCreateWithUTF8CString(url.string().utf8().data());
     42    char url[512]; // Sufficient buffer size for the prefix and the actual path.
     43    snprintf(url, sizeof(url), "file:///host/%s/%s.%s", TEST_WEBKIT_RESOURCES_DIR, resource, extension);
     44    return WKURLCreateWithUTF8CString(url);
    4545}
    4646
  • trunk/Tools/TestWebKitAPI/playstation/PlatformWebViewPlayStation.cpp

    r255708 r262022  
    2727#include "PlatformWebView.h"
    2828
     29#include <KeyboardEvents.h>
     30#include <WebKit/WKContextConfigurationPlayStation.h>
     31#include <WebKit/WKPageConfigurationRef.h>
     32#include <WebKit/WKPagePrivatePlayStation.h>
     33#include <WebKit/WKRetainPtr.h>
     34#include <WebKit/WebKit2_C.h>
     35
    2936namespace TestWebKitAPI {
     37PlatformWebView::PlatformWebView(WKContextRef contextRef, WKPageGroupRef pageGroupRef)
     38{
     39    WKRetainPtr<WKPageConfigurationRef> configuration = adoptWK(WKPageConfigurationCreate());
     40    WKPageConfigurationSetContext(configuration.get(), contextRef);
     41    WKPageConfigurationSetPageGroup(configuration.get(), pageGroupRef);
    3042
    31 PlatformWebView::PlatformWebView(WKContextRef, WKPageGroupRef)
    32 {
     43    initialize(configuration.get());
    3344}
    3445
    35 PlatformWebView::PlatformWebView(WKPageConfigurationRef)
     46PlatformWebView::PlatformWebView(WKPageConfigurationRef configuration)
    3647{
     48    initialize(configuration);
    3749}
    3850
    39 PlatformWebView::PlatformWebView(WKPageRef)
     51PlatformWebView::PlatformWebView(WKPageRef relatedPage)
    4052{
     53    WKRetainPtr<WKPageConfigurationRef> configuration = adoptWK(WKPageConfigurationCreate());
     54    WKPageConfigurationSetContext(configuration.get(), WKPageGetContext(relatedPage));
     55    WKPageConfigurationSetPageGroup(configuration.get(), WKPageGetPageGroup(relatedPage));
     56    WKPageConfigurationSetRelatedPage(configuration.get(), relatedPage);
     57
     58    initialize(configuration.get());
    4159}
    4260
    4361PlatformWebView::~PlatformWebView()
    4462{
     63    WKPageClose(page());
     64    WKRelease(m_view);
    4565}
    4666
    47 void PlatformWebView::initialize(WKPageConfigurationRef)
     67void PlatformWebView::initialize(WKPageConfigurationRef configuration)
    4868{
     69    m_view = WKViewCreate(configuration);
     70    resizeTo(800, 600);
     71}
     72
     73void PlatformWebView::resizeTo(unsigned width, unsigned height)
     74{
     75    // Not implemented.
    4976}
    5077
    5178WKPageRef PlatformWebView::page() const
    5279{
    53     return nullptr;
    54 }
    55 
    56 void PlatformWebView::resizeTo(unsigned, unsigned)
    57 {
    58 }
    59 
    60 void PlatformWebView::focus()
    61 {
     80    return WKViewGetPage(m_view);
    6281}
    6382
    6483void PlatformWebView::simulateSpacebarKeyPress()
    6584{
     85    WKPageHandleKeyboardEvent(page(), WKKeyboardEventMake(kWKEventKeyDown, kWKInputTypeNormal, " ", 1, keyIdentifierForKeyCode(0x20), 0x20, -1, 0, 0));
     86    WKPageHandleKeyboardEvent(page(), WKKeyboardEventMake(kWKEventKeyUp, kWKInputTypeNormal, " ", 1, keyIdentifierForKeyCode(0x20), 0x20, -1, 0, 0));
    6687}
    6788
    68 void PlatformWebView::simulateAltKeyPress()
     89void PlatformWebView::simulateMouseMove(unsigned x, unsigned y, WKEventModifiers modifiers)
    6990{
     91    WKPageHandleMouseEvent(page(), WKMouseEventMake(kWKEventMouseMove, kWKEventMouseButtonNoButton, WKPointMake(x, y), 0, modifiers));
    7092}
    7193
    72 void PlatformWebView::simulateMouseMove(unsigned, unsigned, WKEventModifiers)
     94void PlatformWebView::simulateRightClick(unsigned x, unsigned y)
    7395{
     96    simulateButtonClick(kWKEventMouseButtonRightButton, x, y, 0);
    7497}
    7598
    76 void PlatformWebView::simulateRightClick(unsigned, unsigned)
     99void PlatformWebView::simulateButtonClick(WKEventMouseButton button, unsigned x, unsigned y, WKEventModifiers modifiers)
    77100{
     101    WKPageHandleMouseEvent(page(), WKMouseEventMake(kWKEventMouseDown, button, WKPointMake(x, y), 0, modifiers));
     102    WKPageHandleMouseEvent(page(), WKMouseEventMake(kWKEventMouseUp, button, WKPointMake(x, y), 0, modifiers));
    78103}
    79104
  • trunk/Tools/TestWebKitAPI/playstation/main.cpp

    r260738 r262022  
    2929#include <dlfcn.h>
    3030
     31static void loadLibraryOrExit(const char* name)
     32{
     33    if (!dlopen(name, RTLD_NOW)) {
     34        fprintf(stderr, "Failed to load %s.\n", name);
     35        exit(EXIT_FAILURE);
     36    }
     37}
     38
    3139int main(int argc, char** argv)
    3240{
    33     dlopen("libicu", RTLD_NOW);
     41    loadLibraryOrExit("libicu");
    3442#if defined(BUILDING_TestWebCore) || defined(BUILDING_TestWebKit)
    35     dlopen("libpng16", RTLD_NOW);
    36     dlopen("libfontconfig", RTLD_NOW);
    37     dlopen("libfreetype", RTLD_NOW);
    38     dlopen("libharfbuzz", RTLD_NOW);
    39     dlopen("libcairo", RTLD_NOW);
    40     dlopen("libSceNKWebKitRequirements", RTLD_NOW);
    41     dlopen("libJavaScriptCore", RTLD_NOW);
     43    loadLibraryOrExit("libpng16");
     44    loadLibraryOrExit("libfontconfig");
     45    loadLibraryOrExit("libfreetype");
     46    loadLibraryOrExit("libharfbuzz");
     47    loadLibraryOrExit("libcairo");
     48    loadLibraryOrExit("libSceNKWebKitRequirements");
     49    loadLibraryOrExit("libJavaScriptCore");
    4250#endif
    4351#if defined(BUILDING_TestWebKit)
    44     (dlopen("libcrypto", RTLD_NOW) && dlopen("libssl", RTLD_NOW)) || dlopen("LibreSSL", RTLD_NOW);
    45     dlopen("libcurl", RTLD_NOW);
    46     dlopen("libWebKit", RTLD_NOW);
     52    if (!((dlopen("libcrypto", RTLD_NOW) && dlopen("libssl", RTLD_NOW)) || dlopen("LibreSSL", RTLD_NOW))) {
     53        fprintf(stderr, "Failed to load SSL library.\n");
     54        exit(EXIT_FAILURE);
     55    }
     56    loadLibraryOrExit("libcurl");
     57    loadLibraryOrExit("libWebKit");
    4758#endif
    4859    return TestWebKitAPI::TestsController::singleton().run(argc, argv) ? EXIT_SUCCESS : EXIT_FAILURE;
Note: See TracChangeset for help on using the changeset viewer.