Browse Source

src: remove unused of TickInfo::last_threw()

Environment::TickInfo::last_threw() is no longer in use.

Also pass Isolate to few methods and fix whitespace alignment.

PR-URL: https://github.com/nodejs/node/pull/4507
Reviewed-By: Fedor Indutny <fedor@indutny.com>
process-exit-stdio-flushing
Trevor Norris 9 years ago
parent
commit
f86a3a2fb5
  1. 5
      src/async-wrap.cc
  2. 10
      src/env-inl.h
  3. 3
      src/env.cc
  4. 3
      src/env.h
  5. 10
      src/node.cc

5
src/async-wrap.cc

@ -173,8 +173,8 @@ void LoadAsyncWrapperInfo(Environment* env) {
Local<Value> AsyncWrap::MakeCallback(const Local<Function> cb,
int argc,
Local<Value>* argv) {
int argc,
Local<Value>* argv) {
CHECK(env()->context() == env()->isolate()->GetCurrentContext());
Local<Function> pre_fn = env()->async_hooks_pre_function();
@ -254,7 +254,6 @@ Local<Value> AsyncWrap::MakeCallback(const Local<Function> cb,
env()->tick_callback_function()->Call(process, 0, nullptr);
if (try_catch.HasCaught()) {
tick_info->set_last_threw(true);
return Undefined(env()->isolate());
}

10
src/env-inl.h

@ -131,7 +131,7 @@ inline uint32_t Environment::DomainFlag::count() const {
return fields_[kCount];
}
inline Environment::TickInfo::TickInfo() : in_tick_(false), last_threw_(false) {
inline Environment::TickInfo::TickInfo() : in_tick_(false) {
for (int i = 0; i < kFieldsCount; ++i)
fields_[i] = 0;
}
@ -152,10 +152,6 @@ inline uint32_t Environment::TickInfo::index() const {
return fields_[kIndex];
}
inline bool Environment::TickInfo::last_threw() const {
return last_threw_;
}
inline uint32_t Environment::TickInfo::length() const {
return fields_[kLength];
}
@ -168,10 +164,6 @@ inline void Environment::TickInfo::set_index(uint32_t value) {
fields_[kIndex] = value;
}
inline void Environment::TickInfo::set_last_threw(bool value) {
last_threw_ = value;
}
inline Environment::ArrayBufferAllocatorInfo::ArrayBufferAllocatorInfo() {
for (int i = 0; i < kFieldsCount; ++i)
fields_[i] = 0;

3
src/env.cc

@ -81,12 +81,11 @@ bool Environment::KickNextTick(Environment::AsyncCallbackScope* scope) {
}
// process nextTicks after call
TryCatch try_catch;
TryCatch try_catch(isolate());
try_catch.SetVerbose(true);
tick_callback_function()->Call(process_object(), 0, nullptr);
if (try_catch.HasCaught()) {
info->set_last_threw(true);
return false;
}

3
src/env.h

@ -352,12 +352,10 @@ class Environment {
inline uint32_t* fields();
inline int fields_count() const;
inline bool in_tick() const;
inline bool last_threw() const;
inline uint32_t index() const;
inline uint32_t length() const;
inline void set_in_tick(bool value);
inline void set_index(uint32_t value);
inline void set_last_threw(bool value);
private:
friend class Environment; // So we can call the constructor.
@ -371,7 +369,6 @@ class Environment {
uint32_t fields_[kFieldsCount];
bool in_tick_;
bool last_threw_;
DISALLOW_COPY_AND_ASSIGN(TickInfo);
};

10
src/node.cc

@ -1127,10 +1127,10 @@ void SetupPromises(const FunctionCallbackInfo<Value>& args) {
Local<Value> MakeCallback(Environment* env,
Local<Value> recv,
const Local<Function> callback,
int argc,
Local<Value> argv[]) {
Local<Value> recv,
const Local<Function> callback,
int argc,
Local<Value> argv[]) {
// If you hit this assertion, you forgot to enter the v8::Context first.
CHECK_EQ(env->context(), env->isolate()->GetCurrentContext());
@ -1162,7 +1162,7 @@ Local<Value> MakeCallback(Environment* env,
}
}
TryCatch try_catch;
TryCatch try_catch(env->isolate());
try_catch.SetVerbose(true);
if (has_domain) {

Loading…
Cancel
Save