-
Notifications
You must be signed in to change notification settings - Fork 464
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Preliminary refactoring from Babylon Native #569
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,16 @@ | ||
#ifndef SRC_NAPI_H_ | ||
#define SRC_NAPI_H_ | ||
|
||
#ifdef NODE_ADDON_API_DISABLE_NODE_SPECIFIC | ||
#define NAPI_NO_RETURN | ||
#endif | ||
|
||
#ifndef NODE_ADDON_API_DISABLE_NODE_SPECIFIC | ||
#include <node_api.h> | ||
#else | ||
#include "js_native_api.h" | ||
#endif | ||
|
||
#include <functional> | ||
#include <initializer_list> | ||
#include <memory> | ||
|
@@ -787,8 +796,8 @@ namespace Napi { | |
ArrayBuffer(); ///< Creates a new _empty_ ArrayBuffer instance. | ||
ArrayBuffer(napi_env env, napi_value value); ///< Wraps a N-API value primitive. | ||
|
||
void* Data(); ///< Gets a pointer to the data buffer. | ||
size_t ByteLength(); ///< Gets the length of the array buffer in bytes. | ||
void* Data() const; ///< Gets a pointer to the data buffer. | ||
size_t ByteLength() const; ///< Gets the length of the array buffer in bytes. | ||
Comment on lines
-790
to
+800
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These changes are unrelated, though relevant. Can you please submit them in a separate PR? |
||
|
||
private: | ||
mutable void* _data; | ||
|
@@ -1006,6 +1015,7 @@ namespace Napi { | |
Value Call(napi_value recv, const std::vector<napi_value>& args) const; | ||
Value Call(napi_value recv, size_t argc, const napi_value* args) const; | ||
|
||
#ifndef NODE_ADDON_API_DISABLE_NODE_SPECIFIC | ||
Value MakeCallback(napi_value recv, | ||
const std::initializer_list<napi_value>& args, | ||
napi_async_context context = nullptr) const; | ||
|
@@ -1016,6 +1026,7 @@ namespace Napi { | |
size_t argc, | ||
const napi_value* args, | ||
napi_async_context context = nullptr) const; | ||
#endif // NODE_ADDON_API_DISABLE_NODE_SPECIFIC | ||
|
||
Object New(const std::initializer_list<napi_value>& args) const; | ||
Object New(const std::vector<napi_value>& args) const; | ||
|
@@ -1044,6 +1055,7 @@ namespace Napi { | |
Promise(napi_env env, napi_value value); | ||
}; | ||
|
||
#ifndef NODE_ADDON_API_DISABLE_NODE_SPECIFIC | ||
template <typename T> | ||
class Buffer : public Uint8Array { | ||
public: | ||
|
@@ -1076,6 +1088,7 @@ namespace Napi { | |
Buffer(napi_env env, napi_value value, size_t length, T* data); | ||
void EnsureInfo() const; | ||
}; | ||
#endif // NODE_ADDON_API_DISABLE_NODE_SPECIFIC | ||
|
||
/// Holds a counted reference to a value; initially a weak reference unless otherwise specified, | ||
/// may be changed to/from a strong reference by adjusting the refcount. | ||
|
@@ -1187,6 +1200,7 @@ namespace Napi { | |
Napi::Value Call(napi_value recv, const std::vector<napi_value>& args) const; | ||
Napi::Value Call(napi_value recv, size_t argc, const napi_value* args) const; | ||
|
||
#ifndef NODE_ADDON_API_DISABLE_NODE_SPECIFIC | ||
Napi::Value MakeCallback(napi_value recv, | ||
const std::initializer_list<napi_value>& args, | ||
napi_async_context context = nullptr) const; | ||
|
@@ -1197,6 +1211,7 @@ namespace Napi { | |
size_t argc, | ||
const napi_value* args, | ||
napi_async_context context = nullptr) const; | ||
#endif // NODE_ADDON_API_DISABLE_NODE_SPECIFIC | ||
|
||
Object New(const std::initializer_list<napi_value>& args) const; | ||
Object New(const std::vector<napi_value>& args) const; | ||
|
@@ -1754,6 +1769,7 @@ namespace Napi { | |
napi_escapable_handle_scope _scope; | ||
}; | ||
|
||
#ifndef NODE_ADDON_API_DISABLE_NODE_SPECIFIC | ||
#if (NAPI_VERSION > 2) | ||
class CallbackScope { | ||
public: | ||
|
@@ -1855,6 +1871,7 @@ namespace Napi { | |
std::string _error; | ||
bool _suppress_destruct; | ||
}; | ||
#endif // NODE_ADDON_API_DISABLE_NODE_SPECIFIC | ||
|
||
#if (NAPI_VERSION > 3) | ||
class ThreadSafeFunction { | ||
|
@@ -2063,6 +2080,7 @@ namespace Napi { | |
}; | ||
#endif | ||
|
||
#ifndef NODE_ADDON_API_DISABLE_NODE_SPECIFIC | ||
// Memory management. | ||
class MemoryManagement { | ||
public: | ||
|
@@ -2075,6 +2093,7 @@ namespace Napi { | |
static uint32_t GetNapiVersion(Env env); | ||
static const napi_node_version* GetNodeVersion(Env env); | ||
}; | ||
#endif // NODE_ADDON_API_DISABLE_NODE_SPECIFIC | ||
|
||
} // namespace Napi | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is unrelated