summaryrefslogtreecommitdiff
path: root/src/node_internals.h
diff options
context:
space:
mode:
authorJoyee Cheung <joyeec9h3@gmail.com>2019-01-13 17:17:26 +0800
committerDaniel Bevenius <daniel.bevenius@gmail.com>2019-01-21 07:54:42 +0100
commit1838d00eba30708dd8468a5707489d1ff6bb8a9d (patch)
treeb757b6c004602f22bab5063a38a9e2cdde1f7fa1 /src/node_internals.h
parent8b2e861da1da827cf8c581efbfd126907df9b593 (diff)
downloadandroid-node-v8-1838d00eba30708dd8468a5707489d1ff6bb8a9d.tar.gz
android-node-v8-1838d00eba30708dd8468a5707489d1ff6bb8a9d.tar.bz2
android-node-v8-1838d00eba30708dd8468a5707489d1ff6bb8a9d.zip
src: reduce includes of node_internals.h
PR-URL: https://github.com/nodejs/node/pull/25507 Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/node_internals.h')
-rw-r--r--src/node_internals.h100
1 files changed, 0 insertions, 100 deletions
diff --git a/src/node_internals.h b/src/node_internals.h
index 70c82dd2fc..0d4fe74ebf 100644
--- a/src/node_internals.h
+++ b/src/node_internals.h
@@ -44,39 +44,9 @@
#define Z_MIN_WINDOWBITS 8
#define Z_MAX_WINDOWBITS 15
#define Z_DEFAULT_WINDOWBITS 15
-// Fewer than 64 bytes per chunk is not recommended.
-// Technically it could work with as few as 8, but even 64 bytes
-// is low. Usually a MB or more is best.
-#define Z_MIN_CHUNK 64
-#define Z_MAX_CHUNK std::numeric_limits<double>::infinity()
-#define Z_DEFAULT_CHUNK (16 * 1024)
-#define Z_MIN_MEMLEVEL 1
-#define Z_MAX_MEMLEVEL 9
-#define Z_DEFAULT_MEMLEVEL 8
-#define Z_MIN_LEVEL -1
-#define Z_MAX_LEVEL 9
-#define Z_DEFAULT_LEVEL Z_DEFAULT_COMPRESSION
struct sockaddr;
-// Variation on NODE_DEFINE_CONSTANT that sets a String value.
-#define NODE_DEFINE_STRING_CONSTANT(target, name, constant) \
- do { \
- v8::Isolate* isolate = target->GetIsolate(); \
- v8::Local<v8::String> constant_name = \
- v8::String::NewFromUtf8(isolate, name, v8::NewStringType::kNormal) \
- .ToLocalChecked(); \
- v8::Local<v8::String> constant_value = \
- v8::String::NewFromUtf8(isolate, constant, v8::NewStringType::kNormal)\
- .ToLocalChecked(); \
- v8::PropertyAttribute constant_attributes = \
- static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontDelete); \
- target->DefineOwnProperty(isolate->GetCurrentContext(), \
- constant_name, \
- constant_value, \
- constant_attributes).FromJust(); \
- } while (0)
-
namespace node {
namespace native_module {
@@ -126,80 +96,10 @@ void RegisterSignalHandler(int signal,
std::string GetHumanReadableProcessName();
void GetHumanReadableProcessName(char (*name)[1024]);
-template <typename T, size_t N>
-constexpr size_t arraysize(const T(&)[N]) { return N; }
-
-#ifndef ROUND_UP
-# define ROUND_UP(a, b) ((a) % (b) ? ((a) + (b)) - ((a) % (b)) : (a))
-#endif
-
-#ifdef __GNUC__
-# define MUST_USE_RESULT __attribute__((warn_unused_result))
-#else
-# define MUST_USE_RESULT
-#endif
-
-class SlicedArguments {
- public:
- inline explicit SlicedArguments(
- const v8::FunctionCallbackInfo<v8::Value>& args,
- size_t start = 0);
- inline size_t size() const { return size_; }
- inline v8::Local<v8::Value>* data() { return data_; }
-
- private:
- size_t size_;
- v8::Local<v8::Value>* data_;
- v8::Local<v8::Value> fixed_[64];
- std::vector<v8::Local<v8::Value>> dynamic_;
-};
-
-SlicedArguments::SlicedArguments(
- const v8::FunctionCallbackInfo<v8::Value>& args,
- size_t start) : size_(0), data_(fixed_) {
- const size_t length = static_cast<size_t>(args.Length());
- if (start >= length) return;
- const size_t size = length - start;
-
- if (size > arraysize(fixed_)) {
- dynamic_.resize(size);
- data_ = dynamic_.data();
- }
-
- for (size_t i = 0; i < size; ++i)
- data_[i] = args[i + start];
-
- size_ = size;
-}
-
namespace task_queue {
void PromiseRejectCallback(v8::PromiseRejectMessage message);
} // namespace task_queue
-enum Endianness {
- kLittleEndian, // _Not_ LITTLE_ENDIAN, clashes with endian.h.
- kBigEndian
-};
-
-inline enum Endianness GetEndianness() {
- // Constant-folded by the compiler.
- const union {
- uint8_t u8[2];
- uint16_t u16;
- } u = {
- { 1, 0 }
- };
- return u.u16 == 1 ? kLittleEndian : kBigEndian;
-}
-
-inline bool IsLittleEndian() {
- return GetEndianness() == kLittleEndian;
-}
-
-inline bool IsBigEndian() {
- return GetEndianness() == kBigEndian;
-}
-
class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
public:
inline uint32_t* zero_fill_field() { return &zero_fill_field_; }