public object SendRequest(XrayAction action, XrayHandle thisArg, params object[] args)
        {
            var sqi = new ScriptableRequestInfo();
            CefProcessMessage msg = null;

            try
            {
                msg = new CefProcessMessage(CefNetApplication.XrayRequestKey);
                CefListValue argList = msg.ArgumentList;
                if (!argList.SetSize(3 + args.Length))
                {
                    throw new InvalidOperationException();
                }
                argList.SetInt(0, sqi.RequestId);
                argList.SetInt(1, (int)action);
                argList.SetBinary(2, ValidateXrayHandle(thisArg).ToCfxBinaryValue());
                AppendArgs(argList, 3, args);

                CefFrame frame = this.Frame;
                if (!frame.IsValid || frame.Identifier != _frameId)
                {
                    throw new ObjectDeadException();
                }
                frame.SendProcessMessage(CefProcessId.Renderer, msg);
                sqi.Wait();
                return(sqi.GetResult());
            }
            finally
            {
                msg?.Dispose();
                sqi.Dispose();
            }
        }
 public void showdetails(string url)
 {
     using (CefBrowser browser = CefV8Context.GetCurrentContext().GetBrowser())
     {
         CefProcessMessage message = CefProcessMessage.Create(url);
         browser.SendProcessMessage(CefProcessId.Browser, message);
         message.Dispose();
     }
 }
 public void getimpressionid(string impressionId)
 {
     Logger.Info("Get call from browser of impression_id :" + impressionId);
     using (CefProcessMessage message = CefProcessMessage.Create("GetImpressionId"))
     {
         message.Arguments.SetString(0, impressionId);
         CefV8Context.GetCurrentContext().GetBrowser().SendProcessMessage(CefProcessId.Browser, message);
         message.Dispose();
     }
 }
        public void ReleaseObject(XrayHandle handle)
        {
            if (CefNetApplication.ProcessType == ProcessType.Renderer)
            {
                if (CefApi.CurrentlyOn(CefThreadId.Renderer))
                {
                    handle.Release();
                }
                else
                {
                    CefApi.PostTask(CefThreadId.Renderer, new V8CallTask(handle.Release));
                }
                return;
            }

            CefBinaryValue obj = null;

            CefProcessMessage msg = null;

            try
            {
                if (_frameId != handle.frame)
                {
                    return;
                }
                obj = handle.ToCfxBinaryValue();

                msg = new CefProcessMessage(CefNetApplication.XrayReleaseKey);
                using (CefListValue args = msg.ArgumentList)
                {
                    if (!args.SetSize(1))
                    {
                        return;
                    }
                    args.SetBinary(0, obj);
                }
                _frame.SendProcessMessage(CefProcessId.Renderer, msg);
            }
            finally
            {
                if (msg != null)
                {
                    msg.Dispose();
                }
                if (obj != null)
                {
                    obj.Dispose();
                }
            }
        }
 private static XrayHandle GetGlobal(CefFrame frame)
 {
     if (CefNetApplication.ProcessType == ProcessType.Renderer)
     {
         return(GetGlobalInternal(frame));
     }
     else
     {
         var sqi = new ScriptableRequestInfo();
         CefProcessMessage msg = null;
         try
         {
             msg = new CefProcessMessage(CefNetApplication.XrayRequestKey);
             using (CefListValue args = msg.ArgumentList)
             {
                 if (!args.SetSize(3))
                 {
                     throw new InvalidOperationException();
                 }
                 args.SetInt(0, sqi.RequestId);
                 args.SetInt(1, (int)XrayAction.GetGlobal);
             }
             if (!frame.IsValid)
             {
                 throw new ObjectDeadException();
             }
             frame.SendProcessMessage(CefProcessId.Renderer, msg);
             sqi.Wait();
             return((XrayHandle)sqi.GetResult());
         }
         finally
         {
             msg?.Dispose();
             sqi.Dispose();
         }
     }
 }