This repository has been archived by the owner on Jun 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 339
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
work around to make it pass build with node.js v10.2.0
- Loading branch information
1 parent
30e49bd
commit 229a4de
Showing
7 changed files
with
175 additions
and
3 deletions.
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
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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#ifndef SRC_CALLBACK_SCOPE_H_ | ||
#define SRC_CALLBACK_SCOPE_H_ | ||
|
||
#include "core.h" | ||
#include "v8.h" | ||
|
||
namespace node { | ||
|
||
typedef double async_id; | ||
struct async_context { | ||
::node::async_id async_id; | ||
::node::async_id trigger_async_id; | ||
}; | ||
|
||
class InternalCallbackScope; | ||
|
||
/* This class works like `MakeCallback()` in that it sets up a specific | ||
* asyncContext as the current one and informs the async_hooks and domains | ||
* modules that this context is currently active. | ||
* | ||
* `MakeCallback()` is a wrapper around this class as well as | ||
* `Function::Call()`. Either one of these mechanisms needs to be used for | ||
* top-level calls into JavaScript (i.e. without any existing JS stack). | ||
* | ||
* This object should be stack-allocated to ensure that it is contained in a | ||
* valid HandleScope. | ||
*/ | ||
class NODE_EXTERN CallbackScope { | ||
public: | ||
CallbackScope(v8::Isolate* isolate, | ||
v8::Local<v8::Object> resource, | ||
async_context asyncContext); | ||
~CallbackScope(); | ||
|
||
private: | ||
InternalCallbackScope* private_; | ||
v8::TryCatch try_catch_; | ||
|
||
void operator=(const CallbackScope&) = delete; | ||
void operator=(CallbackScope&&) = delete; | ||
CallbackScope(const CallbackScope&) = delete; | ||
CallbackScope(CallbackScope&&) = delete; | ||
}; | ||
|
||
} // namespace node | ||
|
||
#endif // SRC_CALLBACK_SCOPE_H_ |
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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#ifndef SRC_CORE_H_ | ||
#define SRC_CORE_H_ | ||
|
||
#ifdef _WIN32 | ||
# ifndef BUILDING_NODE_EXTENSION | ||
# define NODE_EXTERN __declspec(dllexport) | ||
# else | ||
# define NODE_EXTERN __declspec(dllimport) | ||
# endif | ||
#else | ||
# define NODE_EXTERN /* nothing */ | ||
#endif | ||
|
||
#define NODE_MAKE_VERSION(major, minor, patch) \ | ||
((major) * 0x1000 + (minor) * 0x100 + (patch)) | ||
|
||
#ifdef __clang__ | ||
# define NODE_CLANG_AT_LEAST(major, minor, patch) \ | ||
(NODE_MAKE_VERSION(major, minor, patch) <= \ | ||
NODE_MAKE_VERSION(__clang_major__, __clang_minor__, __clang_patchlevel__)) | ||
#else | ||
# define NODE_CLANG_AT_LEAST(major, minor, patch) (0) | ||
#endif | ||
|
||
#ifdef __GNUC__ | ||
# define NODE_GNUC_AT_LEAST(major, minor, patch) \ | ||
(NODE_MAKE_VERSION(major, minor, patch) <= \ | ||
NODE_MAKE_VERSION(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__)) | ||
#else | ||
# define NODE_GNUC_AT_LEAST(major, minor, patch) (0) | ||
#endif | ||
|
||
#if NODE_CLANG_AT_LEAST(2, 9, 0) || NODE_GNUC_AT_LEAST(4, 5, 0) | ||
# define NODE_DEPRECATED(message, declarator) \ | ||
__attribute__((deprecated(message))) declarator | ||
#elif defined(_MSC_VER) | ||
# define NODE_DEPRECATED(message, declarator) \ | ||
__declspec(deprecated) declarator | ||
#else | ||
# define NODE_DEPRECATED(message, declarator) \ | ||
declarator | ||
#endif | ||
|
||
#endif // SRC_CORE_H_ |
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 |
---|---|---|
@@ -0,0 +1,76 @@ | ||
#ifndef SRC_EXCEPTIONS_H_ | ||
#define SRC_EXCEPTIONS_H_ | ||
|
||
#include "core.h" | ||
#include "v8.h" | ||
|
||
namespace node { | ||
|
||
NODE_EXTERN v8::Local<v8::Value> ErrnoException(v8::Isolate* isolate, | ||
int errorno, | ||
const char* syscall = nullptr, | ||
const char* message = nullptr, | ||
const char* path = nullptr); | ||
NODE_EXTERN v8::Local<v8::Value> UVException(v8::Isolate* isolate, | ||
int errorno, | ||
const char* syscall = nullptr, | ||
const char* message = nullptr, | ||
const char* path = nullptr); | ||
NODE_EXTERN v8::Local<v8::Value> UVException(v8::Isolate* isolate, | ||
int errorno, | ||
const char* syscall, | ||
const char* message, | ||
const char* path, | ||
const char* dest); | ||
|
||
NODE_DEPRECATED( | ||
"Use ErrnoException(isolate, ...)", | ||
inline v8::Local<v8::Value> ErrnoException( | ||
int errorno, | ||
const char* syscall = nullptr, | ||
const char* message = nullptr, | ||
const char* path = nullptr) { | ||
return ErrnoException(v8::Isolate::GetCurrent(), | ||
errorno, | ||
syscall, | ||
message, | ||
path); | ||
}) | ||
|
||
inline v8::Local<v8::Value> UVException(int errorno, | ||
const char* syscall = nullptr, | ||
const char* message = nullptr, | ||
const char* path = nullptr) { | ||
return UVException(v8::Isolate::GetCurrent(), | ||
errorno, | ||
syscall, | ||
message, | ||
path); | ||
} | ||
|
||
#ifdef _WIN32 | ||
NODE_EXTERN v8::Local<v8::Value> WinapiErrnoException( | ||
v8::Isolate* isolate, | ||
int errorno, | ||
const char *syscall = nullptr, | ||
const char *msg = "", | ||
const char *path = nullptr); | ||
|
||
NODE_DEPRECATED( | ||
"Use WinapiErrnoException(isolate, ...)", | ||
inline v8::Local<v8::Value> WinapiErrnoException( | ||
int errorno, | ||
const char *syscall = nullptr, | ||
const char *msg = "", | ||
const char *path = nullptr) { | ||
return WinapiErrnoException(v8::Isolate::GetCurrent(), | ||
errorno, | ||
syscall, | ||
msg, | ||
path); | ||
}) | ||
#endif | ||
|
||
} // namespace node | ||
|
||
#endif // SRC_EXCEPTIONS_H_ |
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