示例#1
0
 protected internal virtual void OnClosed(BrowserClosedEventArgs e)
 {
     var handler = Closed;
     if (handler != null) {
         handler(this, e);
     }
 }
示例#2
0
        private void OnBeforeClose(IntPtr self, IntPtr browser)
        {
            var b = Browser.FromHandle(browser);
            var e = new BrowserClosedEventArgs(b);
            _delegate.OnClosed(e);

            // Need to call Dispose manually, since the GC will not be able to free the browser instance b above, for it will be still referenced by local scope.
            b.Dispose();

            //// CEF requires all objects to be freed before the window is actually closed.
            //// Since this is a non recurring event, calling the GC should not affect performance, but reclaim tons of memory.
            //// http://blogs.msdn.com/b/ricom/archive/2004/11/29/271829.aspx
            GC.Collect();
            GC.WaitForPendingFinalizers();
            GC.Collect();
        }