diff options
author | Joyee Cheung <joyeec9h3@gmail.com> | 2019-04-21 13:47:30 +0800 |
---|---|---|
committer | Joyee Cheung <joyeec9h3@gmail.com> | 2019-04-26 14:23:31 +0800 |
commit | 0ae46a7a862e26ccd611aed4d189a5e480639a4c (patch) | |
tree | 9b37a35a1e512b1c09c6e8f45ab3a45d3e67c43b /src/env-inl.h | |
parent | 5fe4d5966fd9c2b30b3da3ec7cb47132aa8cdfdd (diff) | |
download | android-node-v8-0ae46a7a862e26ccd611aed4d189a5e480639a4c.tar.gz android-node-v8-0ae46a7a862e26ccd611aed4d189a5e480639a4c.tar.bz2 android-node-v8-0ae46a7a862e26ccd611aed4d189a5e480639a4c.zip |
src: use predefined AliasedBuffer types in the code base
Instead of allowing the callers to instantiate the template
with any numeric types (such as aliasing a Uint8Array to double[]),
predefine types that make sense and use those instead.
PR-URL: https://github.com/nodejs/node/pull/27334
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/env-inl.h')
-rw-r--r-- | src/env-inl.h | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/src/env-inl.h b/src/env-inl.h index ee0503620c..36f8506baf 100644 --- a/src/env-inl.h +++ b/src/env-inl.h @@ -109,16 +109,15 @@ inline AsyncHooks::AsyncHooks() NODE_ASYNC_PROVIDER_TYPES(V) #undef V } - -inline AliasedBuffer<uint32_t, v8::Uint32Array>& AsyncHooks::fields() { +inline AliasedUint32Array& AsyncHooks::fields() { return fields_; } -inline AliasedBuffer<double, v8::Float64Array>& AsyncHooks::async_id_fields() { +inline AliasedFloat64Array& AsyncHooks::async_id_fields() { return async_id_fields_; } -inline AliasedBuffer<double, v8::Float64Array>& AsyncHooks::async_ids_stack() { +inline AliasedFloat64Array& AsyncHooks::async_ids_stack() { return async_ids_stack_; } @@ -243,8 +242,7 @@ inline void Environment::PopAsyncCallbackScope() { inline ImmediateInfo::ImmediateInfo(v8::Isolate* isolate) : fields_(isolate, kFieldsCount) {} -inline AliasedBuffer<uint32_t, v8::Uint32Array>& - ImmediateInfo::fields() { +inline AliasedUint32Array& ImmediateInfo::fields() { return fields_; } @@ -279,7 +277,7 @@ inline void ImmediateInfo::ref_count_dec(uint32_t decrement) { inline TickInfo::TickInfo(v8::Isolate* isolate) : fields_(isolate, kFieldsCount) {} -inline AliasedBuffer<uint8_t, v8::Uint8Array>& TickInfo::fields() { +inline AliasedUint8Array& TickInfo::fields() { return fields_; } @@ -486,13 +484,11 @@ inline void Environment::set_abort_on_uncaught_exception(bool value) { options_->abort_on_uncaught_exception = value; } -inline AliasedBuffer<uint32_t, v8::Uint32Array>& -Environment::should_abort_on_uncaught_toggle() { +inline AliasedUint32Array& Environment::should_abort_on_uncaught_toggle() { return should_abort_on_uncaught_toggle_; } -inline AliasedBuffer<int32_t, v8::Int32Array>& -Environment::stream_base_state() { +inline AliasedInt32Array& Environment::stream_base_state() { return stream_base_state_; } @@ -622,13 +618,11 @@ void Environment::set_debug_enabled(DebugCategory category, bool enabled) { debug_enabled_[static_cast<int>(category)] = enabled; } -inline AliasedBuffer<double, v8::Float64Array>* -Environment::fs_stats_field_array() { +inline AliasedFloat64Array* Environment::fs_stats_field_array() { return &fs_stats_field_array_; } -inline AliasedBuffer<uint64_t, v8::BigUint64Array>* -Environment::fs_stats_field_bigint_array() { +inline AliasedBigUint64Array* Environment::fs_stats_field_bigint_array() { return &fs_stats_field_bigint_array_; } |