Skip to content

Commit

Permalink
src: remove unused of TickInfo::last_threw()
Browse files Browse the repository at this point in the history
Environment::TickInfo::last_threw() is no longer in use.

Also pass Isolate to few methods and fix whitespace alignment.

PR-URL: #4507
Reviewed-By: Fedor Indutny <fedor@indutny.com>
  • Loading branch information
trevnorris authored and rvagg committed Feb 15, 2016
1 parent bcec2fe commit 406eb1f
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 22 deletions.
5 changes: 2 additions & 3 deletions src/async-wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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());
}

Expand Down
10 changes: 1 addition & 9 deletions src/env-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,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;
}
Expand All @@ -139,10 +139,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];
}
Expand All @@ -155,10 +151,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;
Expand Down
3 changes: 1 addition & 2 deletions src/env.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
3 changes: 0 additions & 3 deletions src/env.h
Original file line number Diff line number Diff line change
Expand Up @@ -345,12 +345,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.
Expand All @@ -364,7 +362,6 @@ class Environment {

uint32_t fields_[kFieldsCount];
bool in_tick_;
bool last_threw_;

DISALLOW_COPY_AND_ASSIGN(TickInfo);
};
Expand Down
10 changes: 5 additions & 5 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand Down Expand Up @@ -1162,7 +1162,7 @@ Local<Value> MakeCallback(Environment* env,
}
}

TryCatch try_catch;
TryCatch try_catch(env->isolate());
try_catch.SetVerbose(true);

if (has_domain) {
Expand Down

0 comments on commit 406eb1f

Please sign in to comment.