CefMenuModelDelegate.g.cs 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. //
  2. // DO NOT MODIFY! THIS IS AUTOGENERATED FILE!
  3. //
  4. namespace Xilium.CefGlue
  5. {
  6. using System;
  7. using System.Collections.Generic;
  8. using System.Diagnostics;
  9. using System.Runtime.InteropServices;
  10. using System.Threading;
  11. using Xilium.CefGlue.Interop;
  12. // Role: HANDLER
  13. public abstract unsafe partial class CefMenuModelDelegate
  14. {
  15. private static Dictionary<IntPtr, CefMenuModelDelegate> _roots = new Dictionary<IntPtr, CefMenuModelDelegate>();
  16. private int _refct;
  17. private cef_menu_model_delegate_t* _self;
  18. private cef_menu_model_delegate_t.add_ref_delegate _ds0;
  19. private cef_menu_model_delegate_t.release_delegate _ds1;
  20. private cef_menu_model_delegate_t.has_one_ref_delegate _ds2;
  21. private cef_menu_model_delegate_t.has_at_least_one_ref_delegate _ds3;
  22. private cef_menu_model_delegate_t.execute_command_delegate _ds4;
  23. private cef_menu_model_delegate_t.mouse_outside_menu_delegate _ds5;
  24. private cef_menu_model_delegate_t.unhandled_open_submenu_delegate _ds6;
  25. private cef_menu_model_delegate_t.unhandled_close_submenu_delegate _ds7;
  26. private cef_menu_model_delegate_t.menu_will_show_delegate _ds8;
  27. private cef_menu_model_delegate_t.menu_closed_delegate _ds9;
  28. private cef_menu_model_delegate_t.format_label_delegate _dsa;
  29. protected CefMenuModelDelegate()
  30. {
  31. _self = cef_menu_model_delegate_t.Alloc();
  32. _ds0 = new cef_menu_model_delegate_t.add_ref_delegate(add_ref);
  33. _self->_base._add_ref = Marshal.GetFunctionPointerForDelegate(_ds0);
  34. _ds1 = new cef_menu_model_delegate_t.release_delegate(release);
  35. _self->_base._release = Marshal.GetFunctionPointerForDelegate(_ds1);
  36. _ds2 = new cef_menu_model_delegate_t.has_one_ref_delegate(has_one_ref);
  37. _self->_base._has_one_ref = Marshal.GetFunctionPointerForDelegate(_ds2);
  38. _ds3 = new cef_menu_model_delegate_t.has_at_least_one_ref_delegate(has_at_least_one_ref);
  39. _self->_base._has_at_least_one_ref = Marshal.GetFunctionPointerForDelegate(_ds3);
  40. _ds4 = new cef_menu_model_delegate_t.execute_command_delegate(execute_command);
  41. _self->_execute_command = Marshal.GetFunctionPointerForDelegate(_ds4);
  42. _ds5 = new cef_menu_model_delegate_t.mouse_outside_menu_delegate(mouse_outside_menu);
  43. _self->_mouse_outside_menu = Marshal.GetFunctionPointerForDelegate(_ds5);
  44. _ds6 = new cef_menu_model_delegate_t.unhandled_open_submenu_delegate(unhandled_open_submenu);
  45. _self->_unhandled_open_submenu = Marshal.GetFunctionPointerForDelegate(_ds6);
  46. _ds7 = new cef_menu_model_delegate_t.unhandled_close_submenu_delegate(unhandled_close_submenu);
  47. _self->_unhandled_close_submenu = Marshal.GetFunctionPointerForDelegate(_ds7);
  48. _ds8 = new cef_menu_model_delegate_t.menu_will_show_delegate(menu_will_show);
  49. _self->_menu_will_show = Marshal.GetFunctionPointerForDelegate(_ds8);
  50. _ds9 = new cef_menu_model_delegate_t.menu_closed_delegate(menu_closed);
  51. _self->_menu_closed = Marshal.GetFunctionPointerForDelegate(_ds9);
  52. _dsa = new cef_menu_model_delegate_t.format_label_delegate(format_label);
  53. _self->_format_label = Marshal.GetFunctionPointerForDelegate(_dsa);
  54. }
  55. ~CefMenuModelDelegate()
  56. {
  57. Dispose(false);
  58. }
  59. protected virtual void Dispose(bool disposing)
  60. {
  61. if (_self != null)
  62. {
  63. cef_menu_model_delegate_t.Free(_self);
  64. _self = null;
  65. }
  66. }
  67. private void add_ref(cef_menu_model_delegate_t* self)
  68. {
  69. if (Interlocked.Increment(ref _refct) == 1)
  70. {
  71. lock (_roots) { _roots.Add((IntPtr)_self, this); }
  72. }
  73. }
  74. private int release(cef_menu_model_delegate_t* self)
  75. {
  76. if (Interlocked.Decrement(ref _refct) == 0)
  77. {
  78. lock (_roots) { _roots.Remove((IntPtr)_self); }
  79. return 1;
  80. }
  81. return 0;
  82. }
  83. private int has_one_ref(cef_menu_model_delegate_t* self)
  84. {
  85. return _refct == 1 ? 1 : 0;
  86. }
  87. private int has_at_least_one_ref(cef_menu_model_delegate_t* self)
  88. {
  89. return _refct != 0 ? 1 : 0;
  90. }
  91. internal cef_menu_model_delegate_t* ToNative()
  92. {
  93. add_ref(_self);
  94. return _self;
  95. }
  96. [Conditional("DEBUG")]
  97. private void CheckSelf(cef_menu_model_delegate_t* self)
  98. {
  99. if (_self != self) throw ExceptionBuilder.InvalidSelfReference();
  100. }
  101. }
  102. }