Exemple #1
0
        internal static void on_before_child_process_launch(IntPtr gcHandlePtr, IntPtr command_line, out int command_line_release)
        {
            var self = (CfxBrowserProcessHandler)System.Runtime.InteropServices.GCHandle.FromIntPtr(gcHandlePtr).Target;

            if (self == null || self.CallbacksDisabled)
            {
                command_line_release = 1;
                return;
            }
            var e = new CfxOnBeforeChildProcessLaunchEventArgs(command_line);

            self.m_OnBeforeChildProcessLaunch?.Invoke(self, e);
            e.m_isInvalid        = true;
            command_line_release = e.m_command_line_wrapped == null? 1 : 0;
        }
        internal static void on_before_child_process_launch(IntPtr gcHandlePtr, IntPtr command_line)
        {
            var self = (CfxBrowserProcessHandler)System.Runtime.InteropServices.GCHandle.FromIntPtr(gcHandlePtr).Target;

            if (self == null)
            {
                return;
            }
            var e            = new CfxOnBeforeChildProcessLaunchEventArgs(command_line);
            var eventHandler = self.m_OnBeforeChildProcessLaunch;

            if (eventHandler != null)
            {
                eventHandler(self, e);
            }
            e.m_isInvalid = true;
            if (e.m_command_line_wrapped == null)
            {
                CfxApi.cfx_release(e.m_command_line);
            }
        }
        private static void ProcessHandler_OnBeforeChildProcessLaunch(object sender, CfxOnBeforeChildProcessLaunchEventArgs e)
        {
            //to fix that the  mono run in linux
            //Console.WriteLine("child cmdline:"+e.CommandLine.CommandLineString);
//			Console.WriteLine("child cmdline:" + e.CommandLine.CommandLineString);
//			Console.WriteLine("program: "+e.CommandLine.Program);

            var programPath = new Uri(Assembly.GetEntryAssembly().CodeBase).LocalPath;

//			Console.WriteLine (programPath);

            if (e.CommandLine.GetSwitchValue("type") == "gpu-process")
            {
                e.CommandLine.Program = programPath;
            }
            else
            {
                if (_mono)
                {
//				    var monoPath = "mono";
//					e.CommandLine.Program=programPath;
//
//					e.CommandLine.PrependWrapper("--llvm");
//					e.CommandLine.Program=monoPath;

                    var currentP = System.Diagnostics.Process.GetCurrentProcess();


//					Console.WriteLine ("Main CMDLINE : -- "+currentP.MainModule.FileName+"|| modulename: "+currentP.MainModule.ModuleName);
//					Console.WriteLine ("---------------------------------------------");

                    //System.Diagnostics.Process.GetCurrentProcess().StartInfo.FileName
                    if (currentP.MainModule.FileName == currentP.MainModule.ModuleName)
                    {
                        Console.WriteLine("------native mkbundle mode--------------");
                        e.CommandLine.Program = currentP.MainModule.FileName;
                    }
                    else
                    {
                        Console.WriteLine("------mono runtime mode--------------");
                        //e.CommandLine.Program = Path.Combine (new System.IO.FileInfo (programPath).Directory.FullName, "cef", "Release64", "cefclient");
                        e.CommandLine.Program = ProcessBundleClientHelper();
                        //
                        //					//e.CommandLine.AppendSwitch ("multi-threaded-message-loop");
                        ////					e.CommandLine.AppendSwitch ("off-screen-rendering-enabled");
                        //					e.CommandLine.AppendSwitch("renderer-cmd-prefix");


                        //e.CommandLine.AppendSwitch("disable-text-input-focus-manager");
                        //e.CommandLine.AppendSwitch("no-zygote");
                        //e.CommandLine.AppendSwitchWithValue("type","utility");
                        //e.CommandLine.AppendSwitch("use-views");

                        //--no-zygote
                    }
                }
            }

            Console.WriteLine("child cmdline:" + e.CommandLine.CommandLineString);
            Console.WriteLine("program: " + e.CommandLine.Program);
        }