/// <summary> /// Create a new CfrXmlReader object. The returned object's functions can /// only be called from the thread that created the object. /// </summary> /// <remarks> /// See also the original CEF documentation in /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_xml_reader_capi.h">cef/include/capi/cef_xml_reader_capi.h</see>. /// </remarks> public static CfrXmlReader Create(CfrStreamReader stream, CfxXmlEncodingType encodingType, string uri) { var call = new CfxXmlReaderCreateRemoteCall(); call.stream = CfrObject.Unwrap(stream).ptr; call.encodingType = (int)encodingType; call.uri = uri; call.RequestExecution(); return(CfrXmlReader.Wrap(new RemotePtr(call.__retval))); }
/// <summary> /// Create a new CfrXmlReader object. The returned object's functions can /// only be called from the thread that created the object. /// </summary> /// <remarks> /// See also the original CEF documentation in /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_xml_reader_capi.h">cef/include/capi/cef_xml_reader_capi.h</see>. /// </remarks> public static CfrXmlReader Create(CfrStreamReader stream, CfxXmlEncodingType encodingType, string uri) { var connection = CfxRemoteCallContext.CurrentContext.connection; var call = new CfxXmlReaderCreateRemoteCall(); if (!CfrObject.CheckConnection(stream, connection)) { throw new ArgumentException("Render process connection mismatch.", "stream"); } call.stream = CfrObject.Unwrap(stream).ptr; call.encodingType = (int)encodingType; call.uri = uri; call.RequestExecution(connection); return(CfrXmlReader.Wrap(new RemotePtr(connection, call.__retval))); }
internal static CfrXmlReader Wrap(RemotePtr remotePtr) { if (remotePtr == RemotePtr.Zero) { return(null); } var weakCache = CfxRemoteCallContext.CurrentContext.connection.weakCache; lock (weakCache) { var cfrObj = (CfrXmlReader)weakCache.Get(remotePtr.ptr); if (cfrObj == null) { cfrObj = new CfrXmlReader(remotePtr); weakCache.Add(remotePtr.ptr, cfrObj); } return(cfrObj); } }