Esempio n. 1
0
        /// <summary>
        /// Create a new CfrStreamWriter object for 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 CfrStreamWriter CreateForFile(string fileName)
        {
            var call = new CfxStreamWriterCreateForFileRemoteCall();

            call.fileName = fileName;
            call.RequestExecution();
            return(CfrStreamWriter.Wrap(new RemotePtr(call.__retval)));
        }
Esempio n. 2
0
        /// <summary>
        /// Create a new CfrStreamWriter object for 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 CfrStreamWriter CreateForHandler(CfrWriteHandler handler)
        {
            var call = new CfxStreamWriterCreateForHandlerRemoteCall();

            call.handler = CfrObject.Unwrap(handler).ptr;
            call.RequestExecution();
            return(CfrStreamWriter.Wrap(new RemotePtr(call.__retval)));
        }
        /// <summary>
        /// Create a new CfrStreamWriter object for 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 CfrStreamWriter CreateForFile(string fileName)
        {
            var connection = CfxRemoteCallContext.CurrentContext.connection;
            var call       = new CfxStreamWriterCreateForFileRemoteCall();

            call.fileName = fileName;
            call.RequestExecution(connection);
            return(CfrStreamWriter.Wrap(new RemotePtr(connection, call.__retval)));
        }
        /// <summary>
        /// Create a new CfrStreamWriter object for 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 CfrStreamWriter CreateForHandler(CfrWriteHandler handler)
        {
            var connection = CfxRemoteCallContext.CurrentContext.connection;
            var call       = new CfxStreamWriterCreateForHandlerRemoteCall();

            if (!CfrObject.CheckConnection(handler, connection))
            {
                throw new ArgumentException("Render process connection mismatch.", "handler");
            }
            call.handler = CfrObject.Unwrap(handler).ptr;
            call.RequestExecution(connection);
            return(CfrStreamWriter.Wrap(new RemotePtr(connection, call.__retval)));
        }
Esempio n. 5
0
        internal static CfrStreamWriter Wrap(RemotePtr remotePtr)
        {
            if (remotePtr == RemotePtr.Zero)
            {
                return(null);
            }
            var weakCache = CfxRemoteCallContext.CurrentContext.connection.weakCache;

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