bool BindFunctions(string objName, string[] funcNames)
        {
            if (remoteBrowser == null)
            {
                return(false);
            }
            try
            {
                var ctx = remoteBrowser.CreateRemoteCallContext();
                ctx.Enter();
                try
                {
                    // if (v8Handler != null) v8Handler.Dispose(); // unbind

                    v8Handler          = new CfrV8Handler();
                    v8Handler.Execute += new CfrV8HandlerExecuteEventHandler(JavascriptCallback);

                    CfrTaskRunner.GetForThread(CfxThreadId.Renderer).PostTask(new BindFunctionsTask(remoteBrowser, objName, funcNames, v8Handler));

                    return(true);
                }
                finally
                {
                    ctx.Exit();
                }
            }
            catch (System.IO.IOException)
            {
                return(false);
            }
        }
Exemplo n.º 2
0
 public ChromiumFxDispatcher(CfrBrowser browser, CfrV8Context context, IWebSessionLogger logger)
 {
     _Logger            = logger;
     _Browser           = browser;
     _Context           = context;
     _RemoteCallContext = _Browser.CreateRemoteCallContext();
 }
Exemplo n.º 3
0
        void CfrTaskStressTest()
        {
            if (remoteBrowser == null)
            {
                return;
            }

            var ctx = remoteBrowser.CreateRemoteCallContext();

            ctx.Enter();
            try {
                int taskExecutionCounter = 0;

                for (int i = 0; i < 10000; ++i)
                {
                    var task = new CfrTask();
                    task.Execute += (s, e1) => {
                        ++taskExecutionCounter;
                        if (taskExecutionCounter % 1000 == 0)
                        {
                            LogWriteLine($"CfrTask stress test: {taskExecutionCounter}/10000 tasks executed.");
                        }
                    };
                    if (i % 2 == 0)
                    {
                        CfrRuntime.PostTask(CfxThreadId.Renderer, task);
                    }
                    else
                    {
                        var tr = CfrTaskRunner.GetForThread(CfxThreadId.Renderer);
                        tr.PostTask(task);
                    }
                    if (i % 1000 == 0)
                    {
                        LogWriteLine($"CfrTask stress test: {i}/10000 tasks posted.");
                    }
                }
            } catch {
                LogWriteLine($"CfrTask stress test: Exception cought, aborting.");
            } finally {
                ctx.Exit();
            }
        }
 public ChromiumFxCRemoteContext(CfrBrowser browser)
 {
     _CfxRemoteCallContext = browser.CreateRemoteCallContext();
     _CfxRemoteCallContext.Enter();
 }
Exemplo n.º 5
0
 public ChromiumFxCRemoteContext(CfrBrowser browser)
 {
     IsInContext           = CfxRemoteCallContext.IsInContext;
     _CfxRemoteCallContext = IsInContext ? null : browser.CreateRemoteCallContext();
     _CfxRemoteCallContext?.Enter();
 }
 public ChromiumFxCRemoteContext(CfrBrowser browser) 
 {
     _CfxRemoteCallContext = (CfxRemoteCallContext.IsInContext) ? null : browser.CreateRemoteCallContext();
     _CfxRemoteCallContext?.Enter();
 }