private void CheckSelf(cef_frame_handler_t *self) { if (_self != self) { throw ExceptionBuilder.InvalidSelfReference(); } }
protected virtual void Dispose(bool disposing) { if (_self != null) { cef_frame_handler_t.Free(_self); _self = null; } }
private void on_frame_attached(cef_frame_handler_t *self, cef_browser_t *browser, cef_frame_t *frame, int reattached) { CheckSelf(self); var mBrowser = CefBrowser.FromNative(browser); var mFrame = CefFrame.FromNative(frame); OnFrameAttached(mBrowser, mFrame, reattached != 0); }
private void on_frame_created(cef_frame_handler_t *self, cef_browser_t *browser, cef_frame_t *frame) { CheckSelf(self); var mBrowser = CefBrowser.FromNative(browser); var mFrame = CefFrame.FromNative(frame); OnFrameCreated(mBrowser, mFrame); }
private void on_main_frame_changed(cef_frame_handler_t *self, cef_browser_t *browser, cef_frame_t *old_frame, cef_frame_t *new_frame) { CheckSelf(self); var mBrowser = CefBrowser.FromNative(browser); var mOldFrame = CefFrame.FromNativeOrNull(old_frame); var mNewFrame = CefFrame.FromNativeOrNull(new_frame); OnMainFrameChanged(mBrowser, mOldFrame, mNewFrame); }
private void add_ref(cef_frame_handler_t *self) { lock (SyncRoot) { var result = ++_refct; if (result == 1) { lock (_roots) { _roots.Add((IntPtr)_self, this); } } } }
private static unsafe void OnFrameDetachedImpl(cef_frame_handler_t *self, cef_browser_t *browser, cef_frame_t *frame) { var instance = GetInstance((IntPtr)self) as CefFrameHandler; if (instance == null || ((ICefFrameHandlerPrivate)instance).AvoidOnFrameDetached()) { ReleaseIfNonNull((cef_base_ref_counted_t *)browser); ReleaseIfNonNull((cef_base_ref_counted_t *)frame); return; } instance.OnFrameDetached(CefBrowser.Wrap(CefBrowser.Create, browser), CefFrame.Wrap(CefFrame.Create, frame)); }
private int release(cef_frame_handler_t *self) { lock (SyncRoot) { var result = --_refct; if (result == 0) { lock (_roots) { _roots.Remove((IntPtr)_self); } return(1); } return(0); } }
public CefFrameHandler() { cef_frame_handler_t *self = this.NativeInstance; #if NET_LESS_5_0 self->on_frame_created = (void *)Marshal.GetFunctionPointerForDelegate(fnOnFrameCreated); self->on_frame_attached = (void *)Marshal.GetFunctionPointerForDelegate(fnOnFrameAttached); self->on_frame_detached = (void *)Marshal.GetFunctionPointerForDelegate(fnOnFrameDetached); self->on_main_frame_changed = (void *)Marshal.GetFunctionPointerForDelegate(fnOnMainFrameChanged); #else self->on_frame_created = (delegate * unmanaged[Stdcall] < cef_frame_handler_t *, cef_browser_t *, cef_frame_t *, void >) & OnFrameCreatedImpl; self->on_frame_attached = (delegate * unmanaged[Stdcall] < cef_frame_handler_t *, cef_browser_t *, cef_frame_t *, void >) & OnFrameAttachedImpl; self->on_frame_detached = (delegate * unmanaged[Stdcall] < cef_frame_handler_t *, cef_browser_t *, cef_frame_t *, void >) & OnFrameDetachedImpl; self->on_main_frame_changed = (delegate * unmanaged[Stdcall] < cef_frame_handler_t *, cef_browser_t *, cef_frame_t *, cef_frame_t *, void >) & OnMainFrameChangedImpl; #endif }
protected CefFrameHandler() { _self = cef_frame_handler_t.Alloc(); _ds0 = new cef_frame_handler_t.add_ref_delegate(add_ref); _self->_base._add_ref = Marshal.GetFunctionPointerForDelegate(_ds0); _ds1 = new cef_frame_handler_t.release_delegate(release); _self->_base._release = Marshal.GetFunctionPointerForDelegate(_ds1); _ds2 = new cef_frame_handler_t.has_one_ref_delegate(has_one_ref); _self->_base._has_one_ref = Marshal.GetFunctionPointerForDelegate(_ds2); _ds3 = new cef_frame_handler_t.has_at_least_one_ref_delegate(has_at_least_one_ref); _self->_base._has_at_least_one_ref = Marshal.GetFunctionPointerForDelegate(_ds3); _ds4 = new cef_frame_handler_t.on_frame_created_delegate(on_frame_created); _self->_on_frame_created = Marshal.GetFunctionPointerForDelegate(_ds4); _ds5 = new cef_frame_handler_t.on_frame_attached_delegate(on_frame_attached); _self->_on_frame_attached = Marshal.GetFunctionPointerForDelegate(_ds5); _ds6 = new cef_frame_handler_t.on_frame_detached_delegate(on_frame_detached); _self->_on_frame_detached = Marshal.GetFunctionPointerForDelegate(_ds6); _ds7 = new cef_frame_handler_t.on_main_frame_changed_delegate(on_main_frame_changed); _self->_on_main_frame_changed = Marshal.GetFunctionPointerForDelegate(_ds7); }
public CefFrameHandler(cef_frame_handler_t *instance) : base((cef_base_ref_counted_t *)instance) { }
internal static void Free(cef_frame_handler_t *ptr) { Marshal.FreeHGlobal((IntPtr)ptr); }
private int has_at_least_one_ref(cef_frame_handler_t *self) { lock (SyncRoot) { return(_refct != 0 ? 1 : 0); } }
private int has_one_ref(cef_frame_handler_t *self) { lock (SyncRoot) { return(_refct == 1 ? 1 : 0); } }