Example #1
0
        /// <summary>
        /// Create a new CfrZipReader 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_zip_reader_capi.h">cef/include/capi/cef_zip_reader_capi.h</see>.
        /// </remarks>
        public static CfrZipReader Create(CfrStreamReader stream)
        {
            var call = new CfxZipReaderCreateRemoteCall();

            call.stream = CfrObject.Unwrap(stream).ptr;
            call.RequestExecution();
            return(CfrZipReader.Wrap(new RemotePtr(call.__retval)));
        }
Example #2
0
        /// <summary>
        /// Create a new CfrStreamReader object from a custom handler.
        /// </summary>
        /// <remarks>
        /// See also the original CEF documentation in
        /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_stream_capi.h">cef/include/capi/cef_stream_capi.h</see>.
        /// </remarks>
        public static CfrStreamReader CreateForHandler(CfrReadHandler handler)
        {
            var call = new CfxStreamReaderCreateForHandlerRemoteCall();

            call.handler = CfrObject.Unwrap(handler).ptr;
            call.RequestExecution();
            return(CfrStreamReader.Wrap(new RemotePtr(call.__retval)));
        }
Example #3
0
        /// <summary>
        /// Create a new CfrStreamReader object from a file.
        /// </summary>
        /// <remarks>
        /// See also the original CEF documentation in
        /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_stream_capi.h">cef/include/capi/cef_stream_capi.h</see>.
        /// </remarks>
        public static CfrStreamReader CreateForFile(string fileName)
        {
            var call = new CfxStreamReaderCreateForFileRemoteCall();

            call.fileName = fileName;
            call.RequestExecution();
            return(CfrStreamReader.Wrap(new RemotePtr(call.__retval)));
        }
        /// <summary>
        /// Create a new CfrStreamReader object from a file.
        /// </summary>
        /// <remarks>
        /// See also the original CEF documentation in
        /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_stream_capi.h">cef/include/capi/cef_stream_capi.h</see>.
        /// </remarks>
        public static CfrStreamReader CreateForFile(string fileName)
        {
            var connection = CfxRemoteCallContext.CurrentContext.connection;
            var call       = new CfxStreamReaderCreateForFileRemoteCall();

            call.fileName = fileName;
            call.RequestExecution(connection);
            return(CfrStreamReader.Wrap(new RemotePtr(connection, call.__retval)));
        }
Example #5
0
        /// <summary>
        /// Create a new CfrStreamReader object from data.
        /// </summary>
        /// <remarks>
        /// See also the original CEF documentation in
        /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_stream_capi.h">cef/include/capi/cef_stream_capi.h</see>.
        /// </remarks>
        public static CfrStreamReader CreateForData(RemotePtr data, ulong size)
        {
            var call = new CfxStreamReaderCreateForDataRemoteCall();

            call.data = data.ptr;
            call.size = size;
            call.RequestExecution();
            return(CfrStreamReader.Wrap(new RemotePtr(call.__retval)));
        }
Example #6
0
        /// <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 CfrStreamReader object from a custom handler.
        /// </summary>
        /// <remarks>
        /// See also the original CEF documentation in
        /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_stream_capi.h">cef/include/capi/cef_stream_capi.h</see>.
        /// </remarks>
        public static CfrStreamReader CreateForHandler(CfrReadHandler handler)
        {
            var connection = CfxRemoteCallContext.CurrentContext.connection;
            var call       = new CfxStreamReaderCreateForHandlerRemoteCall();

            if (!CfrObject.CheckConnection(handler, connection))
            {
                throw new ArgumentException("Render process connection mismatch.", "handler");
            }
            call.handler = CfrObject.Unwrap(handler).ptr;
            call.RequestExecution(connection);
            return(CfrStreamReader.Wrap(new RemotePtr(connection, call.__retval)));
        }
        /// <summary>
        /// Create a new CfrZipReader 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_zip_reader_capi.h">cef/include/capi/cef_zip_reader_capi.h</see>.
        /// </remarks>
        public static CfrZipReader Create(CfrStreamReader stream)
        {
            var connection = CfxRemoteCallContext.CurrentContext.connection;
            var call       = new CfxZipReaderCreateRemoteCall();

            if (!CfrObject.CheckConnection(stream, connection))
            {
                throw new ArgumentException("Render process connection mismatch.", "stream");
            }
            call.stream = CfrObject.Unwrap(stream).ptr;
            call.RequestExecution(connection);
            return(CfrZipReader.Wrap(new RemotePtr(connection, call.__retval)));
        }
        /// <summary>
        /// Create a new CfrStreamReader object from data.
        /// </summary>
        /// <remarks>
        /// See also the original CEF documentation in
        /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_stream_capi.h">cef/include/capi/cef_stream_capi.h</see>.
        /// </remarks>
        public static CfrStreamReader CreateForData(RemotePtr data, ulong size)
        {
            var connection = CfxRemoteCallContext.CurrentContext.connection;
            var call       = new CfxStreamReaderCreateForDataRemoteCall();

            if (data.connection != connection)
            {
                throw new ArgumentException("Render process connection mismatch.", "data");
            }
            call.data = data.ptr;
            call.size = size;
            call.RequestExecution(connection);
            return(CfrStreamReader.Wrap(new RemotePtr(connection, call.__retval)));
        }
Example #10
0
        internal static CfrStreamReader Wrap(RemotePtr remotePtr)
        {
            if (remotePtr == RemotePtr.Zero)
            {
                return(null);
            }
            var weakCache = CfxRemoteCallContext.CurrentContext.connection.weakCache;

            lock (weakCache) {
                var cfrObj = (CfrStreamReader)weakCache.Get(remotePtr.ptr);
                if (cfrObj == null)
                {
                    cfrObj = new CfrStreamReader(remotePtr);
                    weakCache.Add(remotePtr.ptr, cfrObj);
                }
                return(cfrObj);
            }
        }