SHARE
TWEET

Untitled

a guest Apr 25th, 2019 17 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.  *  Copyright (C) 2019 Haiku, Inc.
  3.  *
  4.  * Redistribution and use in source and binary forms, with or without
  5.  * modification, are permitted provided that the following conditions
  6.  * are met:
  7.  * 1. Redistributions of source code must retain the above copyright
  8.  *    notice, this list of conditions and the following disclaimer.
  9.  * 2. Redistributions in binary form must reproduce the above copyright
  10.  *    notice, this list of conditions and the following disclaimer in the
  11.  *    documentation and/or other materials provided with the distribution.
  12.  *
  13.  * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
  14.  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
  15.  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  16.  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
  17.  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  18.  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  19.  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  20.  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  21.  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  22.  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  23.  * THE POSSIBILITY OF SUCH DAMAGE.
  24.  */
  25.  
  26. #include "config.h"
  27. #include "ProcessLauncher.h"
  28.  
  29. #include "WebProcessMainUnix.h"
  30.  
  31. #include <cstdlib>
  32. #include<Application.h>
  33. #include<Message.h>
  34.  
  35.  
  36. using namespace WebCore;
  37.  
  38. namespace WebKit {
  39.  class WebProcessDispatch : public BApplication
  40.  {
  41.     public:
  42.     WebProcessDispatch();
  43.     int Dispatch(int32 argc,char** argv);
  44.    
  45.     void MessageReceived(BMessage* msg);
  46.     void ReadyToRun();
  47.     void ArgvReceived(int32 argc,char** argv);
  48.    
  49.    
  50.     private:
  51.     int32 m_argc;
  52.     char** m_argv;
  53.  };
  54.  WebProcessDispatch::WebProcessDispatch()
  55.  :BApplication("application/x-vnd.lh-WebProcess")
  56.  {
  57.  }
  58.  void WebProcessDispatch::MessageReceived(BMessage* msg)
  59.  {
  60.     switch(msg->what)
  61.     {
  62.         default:
  63.         {  
  64.             BApplication::MessageReceived(msg);
  65.             break;
  66.         }  
  67.     }  
  68.  }
  69.  void WebProcessDispatch::ArgvReceived(int32 argc, char** argv)
  70.  {
  71.     m_argc = argc;
  72.     m_argv = argv;
  73.  }
  74.  void WebProcessDispatch::ReadyToRun()
  75.  {
  76.     int status = Dispatch(m_argc,m_argv);
  77.  }
  78.  int WebProcessDispatch::Dispatch(int32 argc, char** argv)
  79.  {
  80.     setenv("G_TLS_GNUTLS_PRIORITY", "NORMAL:%COMPAT:!VERS-SSL3.0:!ARCFOUR-128", 0);
  81.     return WebProcessMainUnix(argc,argv);
  82.  }
  83. void ProcessLauncher::launchProcess()
  84. {
  85.     ProcessLauncher::ProcessType processType;
  86.     switch(processType)
  87.     {
  88.         case ProcessLauncher::ProcessType::Web:
  89.         //debug later will be taken system based absolute path
  90.         //return "/WebKit/webkit/WebKitBuild/Release/bin/WebProcess";
  91.         {
  92.             WebProcessDispatch* WebProcessApp = new WebProcessDispatch();
  93.             WebProcessApp->Run();
  94.             break;
  95.         }
  96.         case ProcessLauncher::ProcessType::Network:
  97.         //return "/WebKit/webkit/WebKitBuild/Release/bin/NetworkProcess";
  98.         fprintf(stderr,"Network stuff\n");
  99.         break;
  100.     }
  101. }
  102.  
  103. void ProcessLauncher::terminateProcess()
  104. {
  105. }
  106.  
  107. void ProcessLauncher::platformInvalidate()
  108. {
  109. }
  110.  
  111. } // namespace WebKit
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top