node_includes.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. // Copyright (c) 2013 GitHub, Inc.
  2. // Use of this source code is governed by the MIT license that can be
  3. // found in the LICENSE file.
  4. #ifndef ATOM_COMMON_NODE_INCLUDES_H_
  5. #define ATOM_COMMON_NODE_INCLUDES_H_
  6. #include "base/logging.h"
  7. // Include common headers for using node APIs.
  8. #ifdef NODE_SHARED_MODE
  9. #define BUILDING_NODE_EXTENSION
  10. #endif
  11. // The following define makes sure that we do not include the macros
  12. // again. But we still need the tracing functions, so declaring them.
  13. #define SRC_TRACING_TRACE_EVENT_H_
  14. #pragma push_macro("ASSERT")
  15. #pragma push_macro("CHECK")
  16. #pragma push_macro("CHECK_EQ")
  17. #pragma push_macro("CHECK_GE")
  18. #pragma push_macro("CHECK_GT")
  19. #pragma push_macro("CHECK_LE")
  20. #pragma push_macro("CHECK_LT")
  21. #pragma push_macro("CHECK_NE")
  22. #pragma push_macro("DCHECK")
  23. #pragma push_macro("DCHECK_EQ")
  24. #pragma push_macro("DCHECK_GE")
  25. #pragma push_macro("DCHECK_GT")
  26. #pragma push_macro("DCHECK_LE")
  27. #pragma push_macro("DCHECK_LT")
  28. #pragma push_macro("DCHECK_NE")
  29. #pragma push_macro("DISALLOW_COPY_AND_ASSIGN")
  30. #pragma push_macro("LIKELY")
  31. #pragma push_macro("NO_RETURN")
  32. #pragma push_macro("UNLIKELY")
  33. #undef ASSERT
  34. #undef CHECK
  35. #undef CHECK_EQ
  36. #undef CHECK_GE
  37. #undef CHECK_GT
  38. #undef CHECK_LE
  39. #undef CHECK_LT
  40. #undef CHECK_NE
  41. #undef DCHECK
  42. #undef DCHECK_EQ
  43. #undef DCHECK_GE
  44. #undef DCHECK_GT
  45. #undef DCHECK_LE
  46. #undef DCHECK_LT
  47. #undef DCHECK_NE
  48. #undef DISALLOW_COPY_AND_ASSIGN
  49. #undef LIKELY
  50. #undef NO_RETURN
  51. #undef UNLIKELY
  52. #undef debug_string // This is defined in macOS SDK in AssertMacros.h.
  53. #undef require_string // This is defined in macOS SDK in AssertMacros.h.
  54. #include "env-inl.h"
  55. #include "env.h"
  56. #include "node.h"
  57. #include "node_buffer.h"
  58. #include "node_internals.h"
  59. #include "node_options.h"
  60. #include "node_platform.h"
  61. // Alternative to NODE_MODULE_CONTEXT_AWARE_X.
  62. // Allows to explicitly register builtin modules instead of using
  63. // __attribute__((constructor)).
  64. #define NODE_LINKED_MODULE_CONTEXT_AWARE(modname, regfunc) \
  65. NODE_MODULE_CONTEXT_AWARE_CPP(modname, regfunc, nullptr, NM_F_LINKED)
  66. #pragma pop_macro("ASSERT")
  67. #pragma pop_macro("CHECK")
  68. #pragma pop_macro("CHECK_EQ")
  69. #pragma pop_macro("CHECK_GE")
  70. #pragma pop_macro("CHECK_GT")
  71. #pragma pop_macro("CHECK_LE")
  72. #pragma pop_macro("CHECK_LT")
  73. #pragma pop_macro("CHECK_NE")
  74. #pragma pop_macro("DCHECK")
  75. #pragma pop_macro("DCHECK_EQ")
  76. #pragma pop_macro("DCHECK_GE")
  77. #pragma pop_macro("DCHECK_GT")
  78. #pragma pop_macro("DCHECK_LE")
  79. #pragma pop_macro("DCHECK_LT")
  80. #pragma pop_macro("DCHECK_NE")
  81. #pragma pop_macro("DISALLOW_COPY_AND_ASSIGN")
  82. #pragma pop_macro("LIKELY")
  83. #pragma pop_macro("NO_RETURN")
  84. #pragma pop_macro("UNLIKELY")
  85. namespace node {
  86. namespace tracing {
  87. class TraceEventHelper {
  88. public:
  89. static v8::TracingController* GetTracingController();
  90. static node::tracing::Agent* GetAgent();
  91. static void SetAgent(node::tracing::Agent* agent);
  92. };
  93. } // namespace tracing
  94. } // namespace node
  95. #endif // ATOM_COMMON_NODE_INCLUDES_H_