| Differences between
and this patch
- WebKit2/gtk/MainGtk.cpp +32 lines
Line 0 WebKit2/gtk/MainGtk.cpp_sec1
1
/*
2
 * Copyright (C) 2010 Apple Inc. All rights reserved.
3
 * Portions Copyright (c) 2010 Motorola Mobility, Inc.  All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
15
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
16
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
18
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
24
 * THE POSSIBILITY OF SUCH DAMAGE.
25
 */
26
27
#include "WebProcessMainGtk.h"
28
29
int main(int argc, char** argv)
30
{
31
    return WebKit::WebProcessMainGtk(argc, argv);
32
}
- WebKit2/ChangeLog +25 lines
Lines 1-3 WebKit2/ChangeLog_sec1
1
2010-10-29  Amruth Raj  <amruthraj@motorola.com> and Ravi Kasibhatla  <ravi.kasibhatla@motorola.com>
2
3
        Reviewed by NOBODY (OOPS!).
4
5
        Changes to add Process Launcher and Thread Launcher to the WebKit2 GTK port.
6
        Changes to create the WebKitWebProcess binary to launch Web process from UI process.
7
        (https://bugs.webkit.org/show_bug.cgi?id=48511)
8
9
        * UIProcess/Launcher/gtk: Added.
10
        * UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp: Added. GTK (UNIX_X11 specific) implementation for launching Web Process from UI Process in async manner.
11
        Creates a socket-pair and sends an fd to each process.
12
        (WebKit::ProcessLauncher::launchProcess):
13
        (WebKit::ProcessLauncher::terminateProcess):
14
        (WebKit::ProcessLauncher::platformInvalidate):
15
        * UIProcess/Launcher/gtk/ThreadLauncherGtk.cpp: Added. Stubbed implementation for GTK port. Yet to implement.
16
        (WebKit::ThreadLauncher::createWebThread):
17
        * WebProcess/gtk: Added.
18
        * WebProcess/gtk/WebProcessMainGtk.cpp: Added. The WebProcessMain call which initiates the Web Process for GTK port.
19
        (WebKit::WebProcess::platformSetCacheModel):
20
        (WebKit::WebProcessMainGtk):
21
        * WebProcess/gtk/WebProcessMainGtk.h: Added. The WebProcessMain declarations for Web Process for GTK port.
22
        * gtk: Added.
23
        * gtk/MainGtk.cpp: Added. The main function implementation for binary WebKitWebProcess.
24
        (main):
25
1
2010-10-27  Kimmo Kinnunen  <kimmo.t.kinnunen@nokia.com>
26
2010-10-27  Kimmo Kinnunen  <kimmo.t.kinnunen@nokia.com>
2
27
3
        Reviewed by Andreas Kling.
28
        Reviewed by Andreas Kling.
- WebKit2/UIProcess/Launcher/gtk/ThreadLauncherGtk.cpp +41 lines
Line 0 WebKit2/UIProcess/Launcher/gtk/ThreadLauncherGtk.cpp_sec1
1
/*
2
 * Copyright (C) 2010 Apple Inc. All rights reserved.
3
 * Portions Copyright (c) 2010 Motorola Mobility, Inc.  All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
15
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
16
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
18
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
24
 * THE POSSIBILITY OF SUCH DAMAGE.
25
 */
26
27
#include "ThreadLauncher.h"
28
29
#include "NotImplemented.h"
30
31
using namespace WebCore;
32
33
namespace WebKit {
34
35
CoreIPC::Connection::Identifier ThreadLauncher::createWebThread()
36
{
37
    notImplemented();
38
    return -1;
39
}
40
41
} // namespace WebKit
- WebKit2/UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp +84 lines
Line 0 WebKit2/UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp_sec1
1
/*
2
 * Copyright (C) 2010 Apple Inc. All rights reserved.
3
 * Portions Copyright (c) 2010 Motorola Mobility, Inc.  All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY MOTOROLA INC. AND ITS CONTRIBUTORS ``AS IS''
15
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
16
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MOTOROLA INC. OR ITS CONTRIBUTORS
18
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
24
 * THE POSSIBILITY OF SUCH DAMAGE.
25
 */
26
27
#include "ProcessLauncher.h"
28
29
#include "Connection.h"
30
#include "NotImplemented.h"
31
#include "RunLoop.h"
32
#include "WebProcess.h"
33
34
#include <WebCore/PlatformString.h>
35
#include <WebCore/ResourceHandle.h>
36
#include <runtime/InitializeThreading.h>
37
#include <wtf/Threading.h>
38
#include <wtf/text/CString.h>
39
40
using namespace WebCore;
41
42
namespace WebKit {
43
44
#define WEBKIT_WEB_PROCESS_NAME "WebKitWebProcess" 
45
#define WEBKIT_WEB_PROCESS_PATH "/usr/local/bin/WebKitWebProcess" 
46
47
void ProcessLauncher::launchProcess()
48
{
49
    pid_t pid = 0;
50
51
    int sockets[2];
52
    if (socketpair(AF_UNIX, SOCK_STREAM, 0, sockets) < 0) 
53
        return;
54
55
    String commandLine(WEBKIT_WEB_PROCESS_PATH);
56
    pid = fork();
57
    if (!pid) { // child process
58
        close(sockets[1]);
59
        String socket = String::format("%d", sockets[0]);
60
        execl(commandLine.utf8().data(), WEBKIT_WEB_PROCESS_NAME, socket.utf8().data(), (char*)0);
61
    } else if (pid > 0) { // parent process
62
        close(sockets[0]);
63
        m_processIdentifier = pid;
64
        // We've finished launching the process, message back to the main run loop.
65
        RunLoop::main()->scheduleWork(WorkItem::create(this, &ProcessLauncher::didFinishLaunchingProcess, pid, sockets[1]));
66
    } else {
67
        ASSERT_NOT_REACHED();
68
    }
69
}
70
71
void ProcessLauncher::terminateProcess()
72
{   
73
    if (!m_processIdentifier)
74
        return;
75
76
    kill(m_processIdentifier, SIGKILL);
77
}
78
79
void ProcessLauncher::platformInvalidate()
80
{
81
    notImplemented();
82
}
83
84
} // namespace WebKit
- WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp +69 lines
Line 0 WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp_sec1
1
/*
2
 * Copyright (C) 2010 Apple Inc. All rights reserved.
3
 * Portions Copyright (c) 2010 Motorola Mobility, Inc.  All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
15
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
16
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
18
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
24
 * THE POSSIBILITY OF SUCH DAMAGE.
25
 */
26
27
#include "WebProcessMainGtk.h"
28
29
#include "WKBase.h"
30
#include <WebCore/ResourceHandle.h>
31
#include <WebKit2/RunLoop.h>
32
#include <WebKit2/WebProcess.h>
33
#include <gtk/gtk.h>
34
#include <runtime/InitializeThreading.h>
35
#include <unistd.h>
36
#include <wtf/Threading.h>
37
38
39
namespace WebKit {
40
41
void WebProcess::platformSetCacheModel(CacheModel cacheModel)
42
{
43
    // FIXME: Implement.
44
}
45
46
WK_EXPORT int WebProcessMainGtk(int argc, char* argv[])
47
{
48
    ASSERT(argc == 2);
49
50
    if (getenv("WEBKIT2_DEBUG_MODE"))
51
        sleep(30);
52
53
    gtk_init(&argc, &argv);
54
    g_type_init();
55
56
    JSC::initializeThreading();
57
    WTF::initializeMainThread();
58
    
59
    RunLoop::initializeMainRunLoop();
60
    WebCore::ResourceHandle::defaultSession();
61
   
62
    int socket = atoi(argv[1]);
63
    WebProcess::shared().initialize(socket, RunLoop::main());
64
    RunLoop::run();
65
66
    return 0;
67
}
68
69
} // namespace WebKit
- WebKit2/WebProcess/gtk/WebProcessMainGtk.h +42 lines
Line 0 WebKit2/WebProcess/gtk/WebProcessMainGtk.h_sec1
1
/*
2
 * Copyright (C) 2010 Apple Inc. All rights reserved.
3
 * Portions Copyright (c) 2010 Motorola Mobility, Inc.  All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
15
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
16
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
18
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
24
 * THE POSSIBILITY OF SUCH DAMAGE.
25
 */
26
27
#ifndef WebProcessMainGtk_h
28
#define WebProcessMainGtk_h
29
30
#include <WebKit2/WKBase.h>
31
32
namespace WebKit {
33
34
#ifdef __cplusplus
35
extern "C" {
36
WK_EXPORT int WebProcessMainGtk(int argc, char* argv[]);
37
} // extern "C"
38
#endif // __cplusplus
39
40
} // namespace WebKit
41
42
#endif // WebProcessMain_h

Return to Bug 48511