CefV8StackFrame.cs 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. namespace Xilium.CefGlue
  2. {
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Diagnostics;
  6. using System.Runtime.InteropServices;
  7. using Xilium.CefGlue.Interop;
  8. /// <summary>
  9. /// Class representing a V8 stack frame handle. V8 handles can only be accessed
  10. /// from the thread on which they are created. Valid threads for creating a V8
  11. /// handle include the render process main thread (TID_RENDERER) and WebWorker
  12. /// threads. A task runner for posting tasks on the associated thread can be
  13. /// retrieved via the CefV8Context::GetTaskRunner() method.
  14. /// </summary>
  15. public sealed unsafe partial class CefV8StackFrame
  16. {
  17. /// <summary>
  18. /// Returns true if the underlying handle is valid and it can be accessed on
  19. /// the current thread. Do not call any other methods if this method returns
  20. /// false.
  21. /// </summary>
  22. public bool IsValid
  23. {
  24. get { return cef_v8stack_frame_t.is_valid(_self) != 0; }
  25. }
  26. /// <summary>
  27. /// Returns the name of the resource script that contains the function.
  28. /// </summary>
  29. public string ScriptName
  30. {
  31. get
  32. {
  33. var n_result = cef_v8stack_frame_t.get_script_name(_self);
  34. return cef_string_userfree.ToString(n_result);
  35. }
  36. }
  37. /// <summary>
  38. /// Returns the name of the resource script that contains the function or the
  39. /// sourceURL value if the script name is undefined and its source ends with
  40. /// a "//@ sourceURL=..." string.
  41. /// </summary>
  42. public string ScriptNameOrSourceUrl
  43. {
  44. get
  45. {
  46. var n_result = cef_v8stack_frame_t.get_script_name_or_source_url(_self);
  47. return cef_string_userfree.ToString(n_result);
  48. }
  49. }
  50. /// <summary>
  51. /// Returns the name of the function.
  52. /// </summary>
  53. public string FunctionName
  54. {
  55. get
  56. {
  57. var n_result = cef_v8stack_frame_t.get_function_name(_self);
  58. return cef_string_userfree.ToString(n_result);
  59. }
  60. }
  61. /// <summary>
  62. /// Returns the 1-based line number for the function call or 0 if unknown.
  63. /// </summary>
  64. public int LineNumber
  65. {
  66. get { return cef_v8stack_frame_t.get_line_number(_self); }
  67. }
  68. /// <summary>
  69. /// Returns the 1-based column offset on the line for the function call or 0 if
  70. /// unknown.
  71. /// </summary>
  72. public int Column
  73. {
  74. get { return cef_v8stack_frame_t.get_column(_self); }
  75. }
  76. /// <summary>
  77. /// Returns true if the function was compiled using eval().
  78. /// </summary>
  79. public bool IsEval
  80. {
  81. get { return cef_v8stack_frame_t.is_eval(_self) != 0; }
  82. }
  83. /// <summary>
  84. /// Returns true if the function was called as a constructor via "new".
  85. /// </summary>
  86. public bool IsConstructor
  87. {
  88. get { return cef_v8stack_frame_t.is_constructor(_self) != 0; }
  89. }
  90. }
  91. }