ipc/app/MozillaRuntimeMainAndroid.cpp

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/ipc/app/MozillaRuntimeMainAndroid.cpp	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,35 @@
     1.4 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
     1.5 + * vim: sw=4 ts=4 et :
     1.6 + * This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +#include <dlfcn.h>
    1.11 +#include <android/log.h>
    1.12 +
    1.13 +int
    1.14 +main(int argc, char* argv[])
    1.15 +{
    1.16 +    // Check for the absolute minimum number of args we need to move
    1.17 +    // forward here. We expect the last arg to be the child process type.
    1.18 +    if (argc < 2)
    1.19 +        return 1;
    1.20 +
    1.21 +    void *mozloader_handle = dlopen("libmozglue.so", RTLD_LAZY);
    1.22 +    if (!mozloader_handle) {
    1.23 +      __android_log_print(ANDROID_LOG_ERROR, "GeckoChildLoad",
    1.24 +                          "Couldn't load mozloader because %s", dlerror());
    1.25 +        return 1;
    1.26 +    }
    1.27 +
    1.28 +    typedef int (*ChildProcessInit_t)(int, char**);
    1.29 +    ChildProcessInit_t fChildProcessInit =
    1.30 +        (ChildProcessInit_t)dlsym(mozloader_handle, "ChildProcessInit");
    1.31 +    if (!fChildProcessInit) {
    1.32 +        __android_log_print(ANDROID_LOG_ERROR, "GeckoChildLoad",
    1.33 +                            "Couldn't load cpi_t because %s", dlerror());
    1.34 +        return 1;
    1.35 +    }
    1.36 +
    1.37 +    return fChildProcessInit(argc, argv);
    1.38 +}

mercurial