| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent a6ce1de commit 5b5d95d
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -61,7 +61,7 @@ namespace v8impl { | |||
| 61 | 61 | ||
| 62 | 62 | namespace { | |
| 63 | 63 | ||
| 64 | - inline static napi_status V8NameFromPropertyDescriptor( | ||
| 64 | + inline napi_status V8NameFromPropertyDescriptor( | ||
| 65 | 65 | napi_env env, | |
| 66 | 66 | const napi_property_descriptor* p, | |
| 67 | 67 | v8::Local<v8::Name>* result) { | |
@@ -79,7 +79,7 @@ inline static napi_status V8NameFromPropertyDescriptor( | |||
| 79 | 79 | } | |
| 80 | 80 | ||
| 81 | 81 | // convert from n-api property attributes to v8::PropertyAttribute | |
| 82 | - inline static v8::PropertyAttribute V8PropertyAttributesFromDescriptor( | ||
| 82 | + inline v8::PropertyAttribute V8PropertyAttributesFromDescriptor( | ||
| 83 | 83 | const napi_property_descriptor* descriptor) { | |
| 84 | 84 | unsigned int attribute_flags = v8::PropertyAttribute::None; | |
| 85 | 85 | ||
@@ -100,12 +100,12 @@ inline static v8::PropertyAttribute V8PropertyAttributesFromDescriptor( | |||
| 100 | 100 | return static_cast<v8::PropertyAttribute>(attribute_flags); | |
| 101 | 101 | } | |
| 102 | 102 | ||
| 103 | - inline static napi_deferred JsDeferredFromNodePersistent( | ||
| 103 | + inline napi_deferred JsDeferredFromNodePersistent( | ||
| 104 | 104 | v8impl::Persistent<v8::Value>* local) { | |
| 105 | 105 | return reinterpret_cast<napi_deferred>(local); | |
| 106 | 106 | } | |
| 107 | 107 | ||
| 108 | - inline static v8impl::Persistent<v8::Value>* NodePersistentFromJsDeferred( | ||
| 108 | + inline v8impl::Persistent<v8::Value>* NodePersistentFromJsDeferred( | ||
| 109 | 109 | napi_deferred local) { | |
| 110 | 110 | return reinterpret_cast<v8impl::Persistent<v8::Value>*>(local); | |
| 111 | 111 | } | |
@@ -139,32 +139,30 @@ class EscapableHandleScopeWrapper { | |||
| 139 | 139 | bool escape_called_; | |
| 140 | 140 | }; | |
| 141 | 141 | ||
| 142 | - inline static napi_handle_scope JsHandleScopeFromV8HandleScope( | ||
| 143 | - HandleScopeWrapper* s) { | ||
| 142 | + inline napi_handle_scope JsHandleScopeFromV8HandleScope(HandleScopeWrapper* s) { | ||
| 144 | 143 | return reinterpret_cast<napi_handle_scope>(s); | |
| 145 | 144 | } | |
| 146 | 145 | ||
| 147 | - inline static HandleScopeWrapper* V8HandleScopeFromJsHandleScope( | ||
| 148 | - napi_handle_scope s) { | ||
| 146 | + inline HandleScopeWrapper* V8HandleScopeFromJsHandleScope(napi_handle_scope s) { | ||
| 149 | 147 | return reinterpret_cast<HandleScopeWrapper*>(s); | |
| 150 | 148 | } | |
| 151 | 149 | ||
| 152 | - inline static napi_escapable_handle_scope | ||
| 150 | + inline napi_escapable_handle_scope | ||
| 153 | 151 | JsEscapableHandleScopeFromV8EscapableHandleScope( | |
| 154 | 152 | EscapableHandleScopeWrapper* s) { | |
| 155 | 153 | return reinterpret_cast<napi_escapable_handle_scope>(s); | |
| 156 | 154 | } | |
| 157 | 155 | ||
| 158 | - inline static EscapableHandleScopeWrapper* | ||
| 156 | + inline EscapableHandleScopeWrapper* | ||
| 159 | 157 | V8EscapableHandleScopeFromJsEscapableHandleScope( | |
| 160 | 158 | napi_escapable_handle_scope s) { | |
| 161 | 159 | return reinterpret_cast<EscapableHandleScopeWrapper*>(s); | |
| 162 | 160 | } | |
| 163 | 161 | ||
| 164 | - inline static napi_status ConcludeDeferred(napi_env env, | ||
| 165 | - napi_deferred deferred, | ||
| 166 | - napi_value result, | ||
| 167 | - bool is_resolved) { | ||
| 162 | + inline napi_status ConcludeDeferred(napi_env env, | ||
| 163 | + napi_deferred deferred, | ||
| 164 | + napi_value result, | ||
| 165 | + bool is_resolved) { | ||
| 168 | 166 | NAPI_PREAMBLE(env); | |
| 169 | 167 | CHECK_ARG(env, result); | |
| 170 | 168 | ||
@@ -191,10 +189,10 @@ inline static napi_status ConcludeDeferred(napi_env env, | |||
| 191 | 189 | ||
| 192 | 190 | enum UnwrapAction { KeepWrap, RemoveWrap }; | |
| 193 | 191 | ||
| 194 | - inline static napi_status Unwrap(napi_env env, | ||
| 195 | - napi_value js_object, | ||
| 196 | - void** result, | ||
| 197 | - UnwrapAction action) { | ||
| 192 | + inline napi_status Unwrap(napi_env env, | ||
| 193 | + napi_value js_object, | ||
| 194 | + void** result, | ||
| 195 | + UnwrapAction action) { | ||
| 198 | 196 | NAPI_PREAMBLE(env); | |
| 199 | 197 | CHECK_ARG(env, js_object); | |
| 200 | 198 | if (action == KeepWrap) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,8 +1,6 @@ | |||
| 1 | 1 | #ifndef SRC_JS_NATIVE_API_V8_H_ | |
| 2 | 2 | #define SRC_JS_NATIVE_API_V8_H_ | |
| 3 | 3 | ||
| 4 | - // This file needs to be compatible with C compilers. | ||
| 5 | - #include <string.h> // NOLINT(modernize-deprecated-headers) | ||
| 6 | 4 | #include "js_native_api_types.h" | |
| 7 | 5 | #include "js_native_api_v8_internals.h" | |
| 8 | 6 | ||
@@ -152,7 +150,7 @@ class EnvRefHolder { | |||
| 152 | 150 | napi_env _env; | |
| 153 | 151 | }; | |
| 154 | 152 | ||
| 155 | - static inline napi_status napi_clear_last_error(napi_env env) { | ||
| 153 | + inline napi_status napi_clear_last_error(napi_env env) { | ||
| 156 | 154 | env->last_error.error_code = napi_ok; | |
| 157 | 155 | ||
| 158 | 156 | // TODO(boingoing): Should this be a callback? | |
@@ -162,10 +160,10 @@ static inline napi_status napi_clear_last_error(napi_env env) { | |||
| 162 | 160 | return napi_ok; | |
| 163 | 161 | } | |
| 164 | 162 | ||
| 165 | - static inline napi_status napi_set_last_error(napi_env env, | ||
| 166 | - napi_status error_code, | ||
| 167 | - uint32_t engine_error_code = 0, | ||
| 168 | - void* engine_reserved = nullptr) { | ||
| 163 | + inline napi_status napi_set_last_error(napi_env env, | ||
| 164 | + napi_status error_code, | ||
| 165 | + uint32_t engine_error_code = 0, | ||
| 166 | + void* engine_reserved = nullptr) { | ||
| 169 | 167 | env->last_error.error_code = error_code; | |
| 170 | 168 | env->last_error.engine_error_code = engine_error_code; | |
| 171 | 169 | env->last_error.engine_reserved = engine_reserved; | |
@@ -275,6 +273,12 @@ static inline napi_status napi_set_last_error(napi_env env, | |||
| 275 | 273 | #define CHECK_MAYBE_EMPTY_WITH_PREAMBLE(env, maybe, status) \ | |
| 276 | 274 | RETURN_STATUS_IF_FALSE_WITH_PREAMBLE((env), !((maybe).IsEmpty()), (status)) | |
| 277 | 275 | ||
| 276 | + #define STATUS_CALL(call) \ | ||
| 277 | + do { \ | ||
| 278 | + napi_status status = (call); \ | ||
| 279 | + if (status != napi_ok) return status; \ | ||
| 280 | + } while (0) | ||
| 281 | + | ||
| 278 | 282 | namespace v8impl { | |
| 279 | 283 | ||
| 280 | 284 | //=== Conversion between V8 Handles and napi_value ======================== | |
@@ -431,10 +435,4 @@ class Reference : public RefBase { | |||
| 431 | 435 | ||
| 432 | 436 | } // end of namespace v8impl | |
| 433 | 437 | ||
| 434 | - #define STATUS_CALL(call) \ | ||
| 435 | - do { \ | ||
| 436 | - napi_status status = (call); \ | ||
| 437 | - if (status != napi_ok) return status; \ | ||
| 438 | - } while (0) | ||
| 439 | - | ||
| 440 | 438 | #endif // SRC_JS_NATIVE_API_V8_H_ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -16,6 +16,7 @@ | |||
| 16 | 16 | #include "util-inl.h" | |
| 17 | 17 | ||
| 18 | 18 | #include <atomic> | |
| 19 | + #include <cstring> | ||
| 19 | 20 | #include <memory> | |
| 20 | 21 | ||
| 21 | 22 | node_napi_env__::node_napi_env__(v8::Local<v8::Context> context, | |
@@ -124,8 +125,8 @@ class BufferFinalizer : private Finalizer { | |||
| 124 | 125 | }; | |
| 125 | 126 | }; | |
| 126 | 127 | ||
| 127 | - static inline napi_env NewEnv(v8::Local<v8::Context> context, | ||
| 128 | - const std::string& module_filename) { | ||
| 128 | + inline napi_env NewEnv(v8::Local<v8::Context> context, | ||
| 129 | + const std::string& module_filename) { | ||
| 129 | 130 | node_napi_env result; | |
| 130 | 131 | ||
| 131 | 132 | result = new node_napi_env__(context, module_filename); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments